Decision Optimization

Decision Optimization

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

 View Only
  • 1.  CutCallback never called.

    Posted Sun September 18, 2011 09:01 AM

    Originally posted by: SystemAdmin


    Hi everybody,

    I have a code using Cutcallbacks in Cplex 12.2 which works fine.
    When I migrate to CPlex 12.3, I understand that the cut callbacks are now inheriting from UserCutCallbackI.

    But there is an issues, formerly, before an integer solution be installed as an incumbent it has to pass through the cuttcallback. There one could catch it and cut it and avoid it from being installed in the incumbent callback.
    Now, the same code, even if I put a "reject()" command in an empty incumbent callback would not call the main function of incumbent callback.

    My MIP is very simple and the first integer solution (is actually a feasibility problem) is optimal but there are cuts which need to cut off this solution and must be generated from inside a the main function of cutcalback class. And this never happens.

    How to enforce the cutcallback to be called.

    Any comment appreciated.

    Shahin
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: CutCallback never called.

    Posted Mon September 19, 2011 02:14 PM

    Originally posted by: SystemAdmin


    Before 12.2 there was some sort of mixup between cut callbacks and lazy constraint callbacks. The result was that lazy constraint callbacks were invoked were only cut callbacks should be invoked and vice versa. This was fixed/cleaned up in version 12.3.
    The result is that cut callbacks and lazy constraint callbacks now are really two different things. This means that the cut callback is invoked during cut loops while the lazy constraint callback is only invoked when an incumbent is found.
    Consequently, if you want to cut off feasible solutions you need to use a lazy constraint callback instead of a cut callback.
    Still, if you registered a cut callback that callback should be invoked -- unless of course your model is so simple that it solves before the cut loop is actually started.
    So the short answer to your question is: Use a lazy constraint callback instead of a cut callback (conceptually, this is what you should have done in your old code but before 12.2 it did not make any difference).
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: CutCallback never called.

    Posted Mon September 19, 2011 02:31 PM

    Originally posted by: SystemAdmin


    One additional comment:

    In some cases users want to be called during the cut loop (to tighten the LP formulation by separating the LP solution) and if a new incumbent candidate has been found (to cut off an infeasible integral solution). In this case, just install the same callback method as cut callback and as lazy constraint callback.

    Or, alternatively, implement your cut separation method in a local function and just call it from both the cut and the lazy constraint callback.
    Tobias
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: CutCallback never called.

    Posted Mon September 19, 2011 03:56 PM

    Originally posted by: SystemAdmin


    Thanks you both for your comments.
    appreciated.
    In fact, i noticed that after one/two hours but there was no way to remove the port.
    I referred to documentation. Of course your explanation is better.

    I have got another question here. May i ask what is the order in which callbacks are called?
    Formerly, a solution was going to the cutcallback before being installed as incumbent. now it seems that you have already made your decision when delivering an integer solution to the lazyconstraints. So I am curious to know in which order exact the callbacks are visited if they all exist.

    Thanks in advance.
    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: CutCallback never called.

    Posted Mon September 19, 2011 04:12 PM

    Originally posted by: SystemAdmin


    There are two cases to distinguish:
    (a) the incumbent was found as integral solution to a node LP relaxation,
    (b) the incumbent was found by a primal heuristic.

    In case (a) we call first the lazy constraint callback and then the incumbent callback. The "wherefrom" flag in the incumbent callback will be CPX_CALLBACK_MIP_INCUMBENT_NODESOLN.

    In case (b) it is only guaranteed that we call the incumbent callback, with "wherefrom" equal to CPX_CALLBACK_MIP_INCUMBENT_USERSOLN or CPX_CALLBACK_MIP_INCUMBENT_HEURSOLN. We may also call the lazy constraint callback (before calling the incumbent callback), but this happens only for heuristics that look close to the LP optimum and for which adding lazy constraints tightens the formulation at the area of interest.
    Tobias
    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: CutCallback never called.

    Posted Mon September 19, 2011 04:16 PM

    Originally posted by: SystemAdmin


    Thank you indeed.
    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: CutCallback never called.

    Posted Thu October 20, 2011 03:09 AM

    Originally posted by: Michael_D


    Pardon me for jumping in, but this thread is really disconcerting.

    Does this mean that in cplex 12.3, instead of the former cut callback, there are three callbacks to be implemented: lazy constraint callback, cut callback (as you write earlier, it is also sensible to check the lazy constraints during the cut loop), and incumbent callback (to handle case (b))?

    Why shouldn't the lazy constraint callback be called under all circumstances before a potential solution is declared an 'incumbent'? If the lazy constraint callback is not called, it is impossible to say whether a potential incumbent is feasible, that is, fulfils all constraints, including the lazy ones.

    What do you mean by 'heuristics that look close to the LP optimum and for which adding lazy constraints tightens the formulation at the area of interest'? How can cplex know whether or not 'adding lazy constraints tightens the formulation at the area of interest' when the lazy constraints are not separated?

    Could it be that also in version 12.2, the cut callback may or may not be called when a potential incumbent is found by a heuristic, although the documentation (version 12.2) says: 'An instance of the class IloCplex::CutCallbackI represents a user-written callback in an application that uses an instance of IloCplex to solve a mixed integer programming problem (a MIP). This class offers a method to add a local or global cut to the current node LP subproblem from a user-written callback. CPLEX also calls the callback when comparing an integer feasible solution, including one provided by a MIP start before any nodes exist, against lazy constraints.' (IDE and OPL > OPL Interfaces > C++ interface reference manual > optim.cplex.cpp.advanced > Classes > Class IloCplex::CutCallbackI)?

    Thanks in advance for shedding some light on this issue.

    Michael
    #CPLEXOptimizers
    #DecisionOptimization


  • 8.  Re: CutCallback never called.

    Posted Tue October 25, 2011 02:45 PM

    Originally posted by: SystemAdmin


    Thanks again for the question...

    As explained in this other thread: http://www.ibm.com/developerworks/forums/thread.jspa?messageID=14696815 my comment was wrong.

    It suffices to have a lazy constraint callback. If you have one, you don't need to have an incumbent callback. Of course, you can have both...
    Tobias
    #CPLEXOptimizers
    #DecisionOptimization