Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

How to write the constraint with if else consition involving binary and integer variables.

  • 1.  How to write the constraint with if else consition involving binary and integer variables.

    Posted Mon November 16, 2015 02:28 PM

    Originally posted by: Zoubeir


    I have the following constraint: (xij is a binary variable and qi is an integer variable)

    if then 

    else if  then qi > 0

     

    How can I write it in an optimization problem?


    #DecisionOptimization
    #MathematicalProgramming-General


  • 2.  Re: How to write the constraint with if else consition involving binary and integer variables.

    Posted Tue November 17, 2015 02:19 AM

    The answer is indicator or logical constraints. How to add these constraints depends on the API you are using. What API do you use?

    Note however that strict inequality is not supported in linear programming. So you will not be able to say "qi>0" but only "qi>=epsilon". This is not always a problem since sometimes it is sufficient to only have "x[ij]=0 implies q[i]=0" since a non-zero q[i] improves the objective function and the solver will thus choose that automatically if possible.


    #DecisionOptimization
    #MathematicalProgramming-General


  • 3.  Re: How to write the constraint with if else consition involving binary and integer variables.

    Posted Tue November 17, 2015 11:41 AM

    Originally posted by: Zoubeir


    I am using CPLEX with Python. 


    #DecisionOptimization
    #MathematicalProgramming-General


  • 4.  Re: How to write the constraint with if else consition involving binary and integer variables.

    Posted Tue November 17, 2015 12:20 PM