1

This question is to query the solution provided by Erwin Kalvelagen to the post

Indicator Variable if x is in specific range

and

conditional constraint: if $x \in [a,b]=> z=1$

(Sorry for not adding comments under the original posts since I don't have enough reputations to do so ...)

In Erwin Kalvelagen's solution, we can observe that $z = 0$ does guarantee that either $x<a$ or $x>b$. However, it does not guarantee that $z = 1$ leads to $x \in [a, b]$.

For example, considering when $x<a$, $z=1$, $\delta = 1$, the first inequality is $$x \leq a - 0.001 + M + M $$ which is correct.

The second inequality : $$ x \geq b + 0.001 - 0 - M $$

which is also correct (since $b - M$ is a very big negative number)

However, now the $x$ does NOT belong to the interval $[a, b]$, hence $z = 1$ is NOT an indicator to its belongingness.

Could someone help to address it? Or let me know where I am wrong?

Thank you very much!

Yu Wang
  • 13

1 Answers1

1

You seem to additionally want $z=1 \Rightarrow x \in [a,b]$. This can be linearized as: $$\begin{align} & x \ge a - M(1-z)\\ & x \le b + M(1-z) \end{align} $$

LinAlg
  • 19,822
  • Thanks for your answer. So basically, if we want to have double-binding between $z = 1$ and $x \in [a, b]$. Then we need to have all 4 inequalities: $$x<a + M \delta + M z$$ $$x> b - M (1 - \delta) - M z$$ $$x > a - M (1 - z)$$ $$x < b + M (1- z)$$. Right? – Yu Wang Dec 07 '18 at 00:13
  • @YuWang that's right. Note that you need non-strict inequalities in linear optimization. – LinAlg Dec 07 '18 at 00:26