How to linearize if, then constraint.
1,017
Solution 1
$$\begin{array}{l} y-z\leq (1-x)M\\ z-y\leq (1-x)M \end{array} $$
where $M$ is a sufficiently large constant.
Solution 2
One way to do it is to enforce $$x(y-z) = 0$$ since this implies that $x=0$ or $y-z=0$. Note, however, that this is not a linear constraint...
Related videos on Youtube
Author by
mahdi
Updated on May 23, 2020Comments
-
mahdi over 3 years
I want to model the following constraint:
- $x$ is a binary variable,
- $y$ and $z$ are positive variables,
- if $x=1$ then $y=z$.
I want to code this constraint in Gams.