Forum Discussion
FICO
9 months agoCommunity Manager
Are preintsol callbacks threadsafe?
The optimizer documentation states "When the MIP callbacks are called they are MUTEX protected to allow non threadsafe user callbacks." In my Java code for one-tree Benders, if I specify a single thr...
FICO
9 months agoCommunity Manager
I've narrowed the bug down to a print statement. When I create my master MIP (instance of XpressProblem), I create 15 binary variables (stored in Variable[] use) and one continuous variable (stored in Variable flowCost). Inside the callback, I create an instance of LinExpression using the use variables, then add a cut based on that expression and the flowCost. That seems to be fine, even with multiple threads. The exception occurs (sometimes, not always) when I try to print the cut and/or the value of flowCost.
Just now I tried to replace the original variables with those associated with the prob argument. Since I could not find a direct way to reference them, I tried prob.variableForIndex(i) as a replacement for use. That earned me a null pointer exception because "this.variableHandler" is null.
I fixed the problem by adapting your code (in your answer to another of my questions) for accessing the original names of the cut variables. This seems to work with multiple threads. Thanks for that code! It does seem to me to be unnecessarily clunky in this context. If a LinExpression instance inside a callback can use the original variables and produce correct cuts (throwing no exceptions), it seems that the toString method of that LinExpression should also work.
Related Content
Related Content
How to make cuts added in a preIntsol callback globally valid (root node) instead of local to the current subtree?
I'm using the Xpress Optimizer Java API (com.dashoptimization, Xpress 9.4) to solve a MIP with lazy constraints that are generated dynamically. My constraints are all globally valid — they are not lo...2 months agoPlace FICO® Xpress Optimization ForumFICO® Xpress Optimization Forum2 unread comments2 unread3Views0likes2CommentsVariable names in callback (Java API)
I construct a cut in a preintsol callback using variables from the model containing the callback. When constructing the model, I give the variables names (using withName(...)) and store them in a vec...9 months agoPlace FICO® Xpress Optimization ForumFICO® Xpress Optimization Forum4 unread comments4 unread1View0likes4CommentsVariable object mapping issue in Python Callbacks with Presolve enabled
Hi, I am implementing a Branch-and-Cut algorithm using the Xpress Python interface. I have structured my code as a class where I create variables (using xp.var) and store them in a dictionary attrib...8 months agoPlace FICO® Xpress Optimization ForumFICO® Xpress Optimization Forum6 unread comments6 unread0Views0likes6Comments