Originally posted by: JorisK
Dear,
I'm trying to solve a MIP model where some cuts are added through the Lazy Constraint callback (cplex 12.4, Java interface). When I run my implementation on some test instances, everything seems to work fine: the results are correct. However, when I first generate a solution using some heuristic, and feed this to the MIP model as a warm start (addMipStart() ), I get some awkward results: the lazy constraint callback is invoked with a fractional solution (the model only has boolean variables). Isn't it true that this callback is only invoked on integer solutions? Below is my implementation of the Lazy Constraint Callback:
private class LazyConstraintCallbackImpl extends IloCplex.LazyConstraintCallback {
@Override
protected void main() throws IloException {
//mipData.flowVars is an array of IloIntVar (boolVars)
double[] values=this.getValues(mipData.flowVars);
System.out.println("Values:\n"+Arrays.toString(values));
for(int i=0; i<values.length; i++)
values[i]=CplexUtil.doubleToRoundedDouble(values[i]);
List<IloConstraint> newCuts=subtourSeparator.getCuts(values);
for(IloConstraint cut: newCuts)
this.add(cut);
}
}
The System.out in the above code prints:
Values: [0.0, 0.0, 0.5463610315186248, 0.0, 0.0, 0.0, 0.0, 0.0, 0.4536389684813752, 0.0, 0.0, 0.0, ........., 0.0, 0.0, 0.0, 0.0, 0.6804584527220632, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.9072779369627508, 0.0, 0.09272206303724917, 0.0, 0.0]
These fractional values are certainly no rounding errors. My application terminates (crashes) as it expected that the lazy constraint callback is only invoked on integer solutions.
Attached I have added an export of my model, my param file and my mip start. When I load these into the interactive optimizer, everything works fine: the solution is correct. Note that the MIP start is already the optimal solution.
So in summary: my application works great without a MIP start, but whenever I add a MIP start, the lazy constraint callback is invoked on fractional solutions.
Suggestions are welcome.
#CPLEXOptimizers#DecisionOptimization