Decision Optimization

Decision Optimization

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

 View Only
  • 1.  Lazy Constraint Callback (C++)

    Posted Tue April 16, 2013 07:55 AM

    Originally posted by: MohsenReisi


    Hi,

    I am using ILOLAZYCONSTRAINTCALLBACK3 to add my lazy constraints if they are violated in the branch and cut tree . In the callback function there is an alogorithm to get the new integer solutions, find the lazy constraints that are violated, and add them to the model. In order to decrease the run-time I am trying to make the algorithm more efficient. 

    I have noticed that when I use the call back function even when the function is empty, the tree size become larger and consequently the run-time is increased comparing with the situation that call back function is not used.  I should mention that I only use one thread to solve the IP model. Does anyone know why calling an empty lazy constraint call back function make the tree size much larger?

    Thanks, Mohsen

     

     

     

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Lazy Constraint Callback (C++)

    Posted Tue April 16, 2013 01:08 PM

    The reason is that lazy constraint callbacks are control callbacks and using control callbacks disables dynamic search. You should see a message similar to this in the log:

    Warning, control callbacks may disable some MIP features.

    To confirm this you can explicitly disable dynamic search by setting parameter MIPSearch to 1. This should produce the same tree as the empty lazy constraint callback.


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Lazy Constraint Callback (C++)

    Posted Tue April 16, 2013 06:52 PM

    Originally posted by: MohsenReisi


    Thanks Daniel. The other option to add lazy constraints is using addLazyConstraints() when the model is being built.  I think if this option is used, it is possible to use the dynamic serach. 

     

    Which way of adding lazy constraints is more efficient: 1- using lazy constaint callback  2- add all the lazy constrtaints at the beginning using addLazyConstraints()?

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Lazy Constraint Callback (C++)

    Posted Wed April 17, 2013 12:18 AM

    Right, with addLazyConstraints() and without callback CPLEX will use dynamic search.

    Which of the two is more efficient highly depends on the number of lazy constraints you have.

    If you do not have too many constraints and it is easy to enumerate them, then I would go for addLazyConstraints(). Usually a callback is only used when the number of lazy constraints is too big to be enumerated up front.


    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Lazy Constraint Callback (C++)

    Posted Wed April 17, 2013 12:38 AM

    Originally posted by: MohsenReisi


    That makes sense. For my case adding the lazy constraints makes the problem size (number of rows and columns) 10 times larger . Therefore it is more reasonable to use callback.

    I am using cplex 12.5, and I am not sure if in this version It is posssible to create a new set of varibles in the callback function and add them to the model?


    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: Lazy Constraint Callback (C++)

    Posted Wed April 17, 2013 01:05 AM

    No, you cannot create new variables in a callback.

    One can sometimes work around that restriction by creating the variables in the original model in a way that does not affect the objective function or feasibility and protect them from being presolved out. In the callback you can then "activate" those variables by putting them into violated constraints.


    #CPLEXOptimizers
    #DecisionOptimization