Does anybody know how to write conditional constraint in mixed integer programming for this case:
if a == 0 then b = 1
else b = 0
-M <= a <= M
b={0,1}
Note that M can be any continuous number. Thanks.
Regards,
Does anybody know how to write conditional constraint in mixed integer programming for this case:
if a == 0 then b = 1
else b = 0
-M <= a <= M
b={0,1}
Note that M can be any continuous number. Thanks.
Regards,
I would approach this as follows. First use a variable splitting approach by introducing two non-negative variables aplus, amin
:
0 <= aplus <= d*M
0 <= amin <= (1-d)*M
a = aplus-amin
d in {0,1}
Now we can do:
0.001*(1-b) <= aplus + amin <= M*(1-b)
In many cases we can simplify this but that requires knowledge of the rest of the model.