Let $x$ be an integer such that $x \in [ - 10,10]$ and $b$ a binary variable. Apply integer programming to express $b = 1 \leftrightarrow x \ge3$

My work:

\begin{equation} \begin{cases} \text{if}\,\,\,\,\ b = 1, & \text{then}\,\,\,\,\,\,\ x \ge3 \\ \text{if}\,\,\,\,\ x \ge3, & \text{then}\,\,\,\,\,\,\ b = 1 \end{cases} \end{equation}

I got the following encoding $$3 + {M_1}(1 - b) \le x \le 2 + {M_2}b$$where $${M_1} \le- 13{\text{ and }}{M_2} \ge8$$

Checking:

Case: $b = 0$ $$3 + {M_1} \le x \le 2$$For ${M_1} \le - 13$, we have $x = - 10, - 9, \ldots ,2$

Case: $b = 1$ $$3 \le x \le 2 + {M_2}$$ For ${M_2} \ge 8$, we have $x = 3, 4, \ldots ,10$

Thus, by choosing $b = \{ 0,1\} $ we can force $x$ to take any value from its domain.

没有正确的解决方案

许可以下: CC-BY-SA归因
不隶属于 cs.stackexchange
scroll top