Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  How to add constraints?

    Posted 02/11/08 07:13 PM

    Originally posted by: SystemAdmin


    [mamba said:]

    Hi all,

    I am trying to implement a kind of branch-and-bound-algorithm (in java using cplex) for a special integer problem. After solving the relaxed problem, I want to branch on a noninteger variable, say x(i) = 0.5. Since  x(i) is binary, I want to add to my LP problem a constraint of the form x(i) = 1. I tried to do this with the following code:

    IloRange newEquation = myModel.getCplex().Eq ( x(i), 1);
    myModel.getCplex().add(newEquation);

    I also tried the following:

    IloAddable newEquation = myModel.getCplex().addEq( x(i), 1);

    And finally I tried to set the lower bounds of x(i) = 1

    But for any reason this is not working, cplex is doing nothing, when I solve my problem, x(i) still has value 0.5 (or anything else but NOT 1) and I have no idea why.
    Maybe you have an idea why this is not working.

    Thanks for your help,
    Melanie

    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: How to add constraints?

    Posted 02/11/08 07:36 PM

    Originally posted by: SystemAdmin


    [ChrisHane said:]

    Hello Melanie,

    Take a look at the examples AdMIPex1.java to ex5. They explain how to use the MIP callbacks to implement special branching rules.

    Regards,
    Chris
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: How to add constraints?

    Posted 02/11/08 08:31 PM

    Originally posted by: SystemAdmin


    [mamba said:]

    Ok I will have a look at these examples. But why can't I do it the way I wanted to do it?

    Thanks,
    Melanie
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: How to add constraints?

    Posted 02/11/08 08:51 PM

    Originally posted by: SystemAdmin


    [ChrisHane said:]

    Hi,

    There is a difference between adding a constraint to the model and adding a cut.  These two things may be the same theoretically, but in the software they need to be handled differently because of when they occur.

    Without getting into too many details, if add() was used in the manner you wish, then CPLEX needs to be told if this change means you intend to solve a new model, or if this change is intended as a valid inequality.  Instead, CPLEX uses callbacks to implement valid inequalities and local cuts (as well as other functions inside the tree). 

    Chris
    #CPLEXOptimizers
    #DecisionOptimization