Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  UserCutCallback and isAfterCutLoop()

    Posted 11/16/12 07:24 AM

    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


  • 2.  Re: UserCutCallback and isAfterCutLoop()

    Posted 11/19/12 08:22 AM

    Originally posted by: SystemAdmin


    Using isAfterCutLoop() is not a prerequisite for correctness.
    CPLEX calls a user cut callback multiple times during the cut generation loop. The isAfterCutLoop() function just tells you whether CPLEX is about to finish the cut loop. An example situation in which this information is useful is if you only want to generate your cuts after all CPLEX cuts have been generated. In this case you would only generate cuts if isAfterCutLoop() returns true. You can find more information about this in the reference documentation.
    I suspect that there is a bug in your separator or you be suffering from bad numerics. To debug this a useful strategy is
    1. Run your code without the user cut callback.
    2. Save the optimal solution and store somewhere where your program can access it.
    3. Now run your code with the user cut callback enabled. Before adding a cut via add() or addLocal() test whether it cuts off the recorded optimal solution.
    This should tell you rather quickly where things go wrong.
    #CPLEXOptimizers
    #DecisionOptimization