Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Coding Indicator Constraints through OPL

    Posted 01/29/18 11:10 AM

    Originally posted by: naveendivakaran


    Hi,

    I have'nt used indicator constraints so far. I am trying to understand how I would Code Indicator Constraints through OPL. I am basically trying to convert the following Big-M utilized constraints to indicator constraints. Please help me understand how to code them up.

    x <= M*b

    y <= M*(1-b)

    where x>= 0, and y>=0 are integer variables and b is binary. If x > 0 then y should be equal to zero. That doesnt mean that if x=0, y > 0. 

    This is what I tried to do with OPL

    b == (x>=1)

    b == (y==0)

    But I dont think that is correct because these constraints suggest that if b == 0 then y has to be greater than 0. Am I right? Also, what is the difference between indicator constraints and logical constraints. I believe what I have written above are logical constraints. Correct me if I am wrong.

     

    -Naveen


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Coding Indicator Constraints through OPL

    Posted 01/29/18 11:45 AM

    The most direct translation of indicator constraints is by using the "implies" operator (=>), see here. You constraints would read something like this:

    (b == 0) => (x == 0);
    (b == 1) => (y == 0);

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Coding Indicator Constraints through OPL

    Posted 01/29/18 11:54 AM

    Originally posted by: naveendivakaran


    Thanks for your quick response.

    So does your constraints also imply (b == 0) => (y > 0) without stating it?

    Are these constraints logical constraints? or indicator constraints? or indicator constraints and logical constraints are the same in linear programming context?

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Coding Indicator Constraints through OPL

    Posted 01/30/18 02:45 AM

    No, the constraints do not imply the reverse. They are just implications (left side implies right side). If you want equivalence then you can use something like

    (b == 1) == (y == 0)

    Note however that strict inequality is not supported in linear programming. Stating (b==0) => (y>0) one way or the other requires emulating strict inequality. In CPLEX this is done by replacing y>0 by y>=eps with a small eps. If y is integer we can choose eps=1 and everything is fine. If y is float then you may get into numerical problems.

    Indicator and logical constraints are more or less the same. The engine itself only supports indicator constraints of the form

    (binary variable == value) => linear constraint

    OPL instead supports more complex logical constraints (and, or, implies, ...) but will under the hood translate all of them to indicator constraints before passing the model to the engine.


    #CPLEXOptimizers
    #DecisionOptimization