How to write an if-then constraint in Gurobi without using big M formulation?

60 views
Skip to first unread message

Mlika Zoubeir

unread,
Jun 13, 2016, 2:56:20 PM6/13/16
to Gurobi Optimization
I have a constraint of the form

If z = 1 then a^T x - b >= 0


where x is a binary vector [x_1, x_2, ..., x_n]^T of size n where x_i is in {0, 1} for all i. The vector a = [a_1, a_2, ..., a_n]^T and b = [b_1, b_2, ..., b_n]^T are real-valued vector given as inputs.

Is there anyway to write this in Gurobi without using big M formulation (maybe using SOS constraints)? 

Tobias Achterberg

unread,
Jun 14, 2016, 3:26:40 AM6/14/16
to gur...@googlegroups.com
Yes, you can write this using an SOS1 constraint:

a*x - b + s >= 0
SOS1(z,s)
s >= 0

The trick is to introduce an additional slack variable s, which allows to
violate the constraint (if a*x - b < 0, then just set s large enough to make the
constraint feasible). But the SOS1 constraint says that at most one of z and s
can be non-zero. Hence, if z = 1 the SOS1 forces s = 0, which means that the
constraint a*x - b >= 0 needs to be satisfied.

Tobias
Reply all
Reply to author
Forward
0 new messages