Search code examples
linear-programmingcplexpyomo

Minimum between two boolean decision variables in Pyomo


I need to do something like this:

d1 == min(d2,d3)

where d is a decision variable. I need to use Pyomo. In cplex the solution is achieved by the funnction minl, how can do this in Pyomo or in an equivalent linear form? I searched for a solution on Google and found that I could assert that d1 must be less or equal to d2 and d3. But this do not fit my proble, because if d2 and d3 is equal to 1, d1 <= 1 while I need d1 == 1.

Thanks for replies.


Solution

  • When the d variables are binary variables,

    d1 = min(d2,d3)
    

    is really the same as multiplication

    d1 = d2*d3
    

    This is often linearized as

    d1 <= d2
    d1 <= d3
    d1 >= d2+d3-1