Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Identifying the binding constraints

    Posted 04/18/19 10:58 AM

    Originally posted by: open_ball


    Hi,

    If I have a set of constraints without an objective function and want to send a solution vector to identify which constraints are active, how can I accomplish that?


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Identifying the binding constraints

    Posted 04/18/19 11:21 AM

    Every API has a method for querying the slacks for the current solution. Please check the reference documentation for the API you are using.


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Identifying the binding constraints

    Posted 04/18/19 11:34 AM

    Originally posted by: open_ball


    Hi Daniel,

    Thanks for your answer. Do you mind telling me your insight what I plan to do? I am just curios what your insight is.

     

    I use OPL and as you know callbacks are not usable there. I intend to implement my own lazy constraint function. As stated here https://www.ibm.com/support/knowledgecenter/SSSA5P_12.6.1/ilog.odms.cplex.help/CPLEX/UsrMan/topics/progr_adv/usr_cut_lazy_constr/04_diffs.html , "Lazy constraints are only (and always) checked when an integer-feasible solution candidate has been identified, and of course, any of these constraints that turn out to be violated will then be applied to the full model.".

     

    I will solve master problem until finding the first incumbent. Then, I will go to the sub problem and create a cut. Rather than adding this cut into my master problem, I will collect all such cuts in a different mod file. Also, whenever I find an incumbent, I will go through all the lazy cuts, and identify the binding ones. If there's an active cut, then I will add that into the master problem. Then, I will warm start the master problem with the best incumbent that I have at hand. Does this make sense to you? Do you think that what I plan is compatible with what a callback function does? I guess only thing I will be missing is that callback function might eliminate the previously added lazy cuts in the following iterations. I won't be able to accomplish that. 

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Identifying the binding constraints

    Posted 04/21/19 03:10 PM

    I am not sure this will play out as you expect.

    Whenever you stop, add a constraint and then warmstart, CPLEX will have to start the tree search from scratch. Adding a new constraint invalidates the current search tree and hence it has to be discarded. Doing this restart for every cut you find may turn out to be prohibitively expensive.

    In your case I would just use C++, Java, or C#, load the OPL model into CPLEX and then implement a callback. You can check the oplrunsample example that ships with CPLEX to see how to load OPL models into one of these programming languages.


    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Identifying the binding constraints

    Posted 04/21/19 04:16 PM

    Originally posted by: open_ball


    Daniel,

    Thanks for the detailed explanation. That is what exactly happens to me. Since the tree restarts every time when I add a constraint, my algorithm does not really converge and takes a very long time. Since model is quite big and complicated in terms of number of constraint and variable types, I do not want to re start everything from scratch in an API.

     

    I am familiar with loading the model to Java from OPL, but I don't really know how I can utilize the call back function after loading the model. I do have a sample code to implement  lazy constraints in Java, but the entire model is built up in Java. Do you have any small code sample (e.g., capacitated facility location problem) that shows how to load an OPL model to Java and implement a callback? 

     

    Edit: Daniel, I have one more question. Does there exist any restriction when a model is loaded from OPL. Would I have access to everything provided in Java?


    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: Identifying the binding constraints

    Posted 04/29/19 12:52 AM

    Please take a look at example opl/examples/opl_interfaces/java/oplrunsample that ships with CPLEX.

    This example loads an OPL model into Java and at some points calls opl.getCplex(). This function returns the IloCplex instance that will be used for the solve. You can then register a lazy constraint callback with that instance. Examples for using a lazy constraint callback in Java are in cplex/examples/src/java/AdMIPex5.java and examples/src/java/BendersATSP.java. And as you can see, AdMIPex5.java is indeed solving a facility location problem (but without using OPL).

    About your last question: yes, you should have access to all the stuff.


    #CPLEXOptimizers
    #DecisionOptimization