Originally posted by: JorisK
Dear,
I'm implementing a MIP model with both lazy constraints (LazyConstraintCallback) and valid inequalities (User Cut Callback). In my problem I have several constraints which you can view as the DFJ subtour constraints in a Traveling Salesman Problem. Since there are exponentially many of those constraints, I do not generate them all beforehand but I add them using lazy constraints. I have implemented a separation algorithm which checks whether, for a given integer solution, a constraint needs to be added to the set of lazy constraints. The exact same algorithm can be used to search for valid inequalities when solving the linear programming relaxation.
1. When I use my algorithm to generate lazy constraints, I get nice and correct solutions; everything works great.
2. When I use my algorithm to generate both constraints which are used in the LazyConstraintCallback as well as in the User Cut Callback, something goes wrong. For a number of instances, I get weird, undefined behavior: the number of iterations increases drastically, I do no longer find solutions for those instances, and usually, after a while I have a crash somewhere in my code due to unexpected results which violate the input conditions of my algorithm.
3. In some examples of User Cut Callbacks, I noticed this piece of code:
public class UserCutCallbackImpl extends UserCutCallback{
...
@Override
protected void main() throws IloException {
if(!this.isAfterCutLoop()){
return;
}
...
}
}
I have added the if(!this.isAfterCutLoop()) condition to my code, and now my user cuts seem to work fine! I get correct results again.
Can anyone explain this, or am I missing something? Is it mandatory to add the isAfterCutLoop check? I basically try to pinpoint the cause of the behavior; it might simply be the case that there is a well hidden bug in my separation code.
#CPLEXOptimizers#DecisionOptimization