Complex logic binary and M

45 Views Asked by At

Here's the problem:

a and b are continuous between -15 and 15. Explain how the following conditions can be represented as linear constraints using binary variables: At least two of the conditions must be met.

Condition 1: $(a-b)^2 \le 16$

Condition 2: $ b \le 3$ and $a \ge -1$

Condition 3: $a = -1 $

Note that big-M parameters must be the best possible big Ms.

I think there should be a binary variable for each condition, and that condition 2 must be split out into two binary variables, but I feel pretty lost on how I can apply big M logic.

1

There are 1 best solutions below

1
On BEST ANSWER

Yes, you want three binary variables $x_i$, with linear constraint $\sum_i x_i \ge 2$. Note that the first condition is equivalent to $|a-b|\le 4$. The big-M constraints are \begin{align} a-b-4&\le M_1(1-x_1)\\ -a+b-4&\le M_2(1-x_1)\\ b-3&\le M_3(1-x_2)\\ -a-1 &\le M_4(1-x_2)\\ -a-1 &\le M_5(1-x_3)\\ a+1 &\le M_6(1-x_3)\\ \end{align} I’ll leave it you to supply the big-M values.