Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

lazy constraint callback

  • 1.  lazy constraint callback

    Posted Fri January 13, 2012 03:44 AM

    Originally posted by: amindehghanian


    Hi,

    I am using a Branch&Cut algorithm for some MILP. For this sake, I am using "cpxsetlazyconstraintcallbackfunc" to see if the optimal solution at that node satisfies my lazy constraints or not. If it does not, I generate and add a globally valid cut to my MILP.

    For some of instances, I observe that my final optimal solution does not satisfy my lazy constraints!

    Would you kindly tell me when CPLEX 12.3 stops and considers a solution as an optimal one when we are using "cpxsetlazyconstraintcallbackfunc"?

    Thanks in advance,
    Amin
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: lazy constraint callback

    Posted Fri January 13, 2012 03:59 AM

    Originally posted by: SystemAdmin


    Are the instances for which you observe the problems very simple? Is it possible that they are solved in presolve (even before the root node is processed)?
    Is your callback invoked at all for the problematic instances?
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: lazy constraint callback

    Posted Sat January 14, 2012 02:43 PM

    Originally posted by: amindehghanian


    Thanks for your answer Daniel!

    1. Yes I would say that those instances are simple.
    2.Even, when I turn off presolve, I still have that problem.

    3. Yes, my callback is invoked at all problem instances. But even, for some other instances (when I have true optimal solution), I observe that CPLEX does not invoke my callback for the final optimal solution, and it seems CPLEX obtains optimal solution by some heuristic without checking if it satisfies my lazyconstraints?????

    Thanks again,

    P.S: needless to say that I already turned off dual reduction of CPLEX
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: lazy constraint callback

    Posted Sat January 14, 2012 02:56 PM

    Originally posted by: amindehghanian


    In particular, I am very surprised about above number 3 since according to your help for CPXsetlazyconstraintcallbackfunc:
    "The user-written callback is called by CPLEX in these situations:

    when CPLEX compares an integer-feasible solution (including an integer-feasible solution provided by a MIP start before any nodes exist) to lazy constraints; "

    Though I don't observe this!!
    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: lazy constraint callback

    Posted Sun January 15, 2012 05:10 AM

    Originally posted by: SystemAdmin


    When presolve is able to eliminate all variables and constraints from the problem then the lazy constraint callback may not be called. But if I understand correctly this is not what you observe.
    Could you enable screen output (CPXsetintparam(env, CPX_PARAM_SCRIND, CPX_ON)) and show us the log output for one or two problems where things go wrong?
    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: lazy constraint callback

    Posted Sun January 15, 2012 03:49 PM

    Originally posted by: amindehghanian


    I have attached the log output for one instance! Actually, this is the only instance which I have observed this behavior so far!
    The interesting point is that, I had this problem with this instance one month ago, then it went away without any change in my code. Right now, it came back again!!

    I am afraid that this issue is why I can't solve some hard instances exactly!

    To be an emphasis, when I turn off presolve, I still have this issue!

    Thanks,
    Amin
    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: lazy constraint callback

    Posted Mon January 16, 2012 11:40 AM

    Originally posted by: SystemAdmin


    Could you please provide the full log, starting with the first line of output done by CPLEX?
    I am just curious: Does the problem persist when you use only one thread?
    #CPLEXOptimizers
    #DecisionOptimization


  • 8.  Re: lazy constraint callback

    Posted Mon January 16, 2012 02:42 PM

    Originally posted by: amindehghanian


    I attached the whole log output.
    Thanks,
    #CPLEXOptimizers
    #DecisionOptimization


  • 9.  Re: lazy constraint callback

    Posted Tue January 17, 2012 09:35 AM

    Originally posted by: SystemAdmin


    Thanks. The output looks good.
    Did you check whether the solution that is found is presented to your callback at all? Could you print a line from your callback whenever the callback is invoked and another line whenever the callback is invoked but does not produce a violated constraint?
    Is your callback invoked and does not produce a violated constraint or is it not invoked at all?
    #CPLEXOptimizers
    #DecisionOptimization


  • 10.  Re: lazy constraint callback

    Posted Tue January 17, 2012 01:57 PM

    Originally posted by: amindehghanian


    For this example, my callback is invoked 12 times, and it generates a violated constraint all the time. After, the 12 th call, CPLEX produces the optimal solution from nowhere(it has never been my incumbent or even an optimal solution of a node so far).
    At this point, I expected the lazy constraint callback would have been invoked to check the feasibility while it has never happened??

    One programming question:after generating each violated constraint, I set "*useraction_p = CPX_CALLBACK_SET" while I am generating several violated constraints at each call. Could it be the source of error?

    Thanks,
    #CPLEXOptimizers
    #DecisionOptimization


  • 11.  Re: lazy constraint callback

    Posted Tue January 17, 2012 02:28 PM

    Originally posted by: amindehghanian


    I have a strong feeling that this should be because of multiple cut generations at each call.
    Actually, because of structure of my algorithm for cut generation, I check the feasibility of each point twice at each call.
    This is while if I check it just once, I don't observer any issue!

    P.S. Due to performance considerations, I have to use multiple cut generations at each call
    #CPLEXOptimizers
    #DecisionOptimization


  • 12.  Re: lazy constraint callback

    Posted Tue January 17, 2012 03:32 PM

    Originally posted by: SystemAdmin


    Setting *useraction_p should not be a problem, even when it is set multiple times. I have to admit that I am running out of ideas what might be going wrong here.
    Could you additionally add an incumbent callback and see if that callback is invoked for the solution?
    Could you show us your callback code (just the callback function itself) so that we can double-check that nothing obvious goes wrong there. If you don't want to post the code here you may send it to me: daniel(dot)junglas(at)de(dot)ibm(dot)com. Could you also indicate what you changed in your callback code that made the problems go away?
    #CPLEXOptimizers
    #DecisionOptimization


  • 13.  Re: lazy constraint callback

    Posted Tue January 17, 2012 04:48 PM

    Originally posted by: amindehghanian


    Thanks for your attention. Honestly, I am also very confused about this thing.

    If I add an incumbent callback, everything will be OK though I prefer not doing it due to performance considerations!

    I will email you the code for callback!
    #CPLEXOptimizers
    #DecisionOptimization


  • 14.  Re: lazy constraint callback

    Posted Tue January 17, 2012 06:12 PM

    Originally posted by: amindehghanian


    Daniel,

    I emailed you the code, you must have received it.

    Thanks again,
    #CPLEXOptimizers
    #DecisionOptimization


  • 15.  Re: lazy constraint callback

    Posted Sun March 17, 2013 06:44 PM

    Originally posted by: mhoang


    I have the same problem with lazy constraints callback, cplex 12.5. Please notice me the conclusion you made for this! Thank you.
    #CPLEXOptimizers
    #DecisionOptimization


  • 16.  Re: lazy constraint callback

    Posted Tue June 11, 2013 10:50 PM

    Originally posted by: amindehghanian


    CPLEX has some issue on that. You need to use incumbent callback to make sure your solution is feasible.


    #CPLEXOptimizers
    #DecisionOptimization