How to linearize if, then constraint.

1.5k Views Asked by At

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.

2

There are 2 best solutions below

0
On

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...

0
On

$$\begin{array}{l} y-z\leq (1-x)M\\ z-y\leq (1-x)M \end{array} $$

where $M$ is a sufficiently large constant.