0

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,

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

2 Comments

It worked! Just a small correction for the last equation: 0.001*(1-b) <= aplus + amin <= M*(1-b) should be 0.001*(1-b) <= aplus + amin <= M*b
I think my version is correct. If b=1 then 0<=aplus+amin<=0 ==> aplus+amin=0. If b=0 then 0.01 <= aplus+amin <= M.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.