pythonlinear-programmingconstraint-programmingmixed-integer-programmingcoin-or-cbc

MIP (mixed integer problem) Build Constraint with OR


I have an MIP where I want to assign at least two variables (binary) from the same location.

How to implement the or in this case. I want something like this:

x1 + x2 + x3 + x4 >= 2 or
x5 + x6 + x7 + x8 + x9 >= 2 or
x10 + x11 + x12 >= 2

x1,...,x12 are binary variables.

How could it be implemented?

I had a look here but could not work it out to my case.


Solution

  • x1 + x2 + x3 + x4 >= 2⋅δ1
    x5 + x6 + x7 + x8 + x9 >= 2⋅δ2
    x10 + x11 + x12 >= 2⋅δ3
    δ1+δ2+δ3 = 1 
    δ1,δ2,δ3 ∈ {0,1}
    

    If you want, you can replace δ1+δ2+δ3=1 by δ1+δ2+δ3>=1.