How to linearize this if-then constraint? $x \geq 1\Rightarrow y=0$ otherwise use $y$ as it is.

614 Views Asked by At

If $x \geq 1$ then force $y=0$; otherwise $y$ should take its value, where $x$ and $y$ are non-negative integer decision variables. The variables $x$ and $y$ are calculated in other constraints. I tried the following by introducing a binary variable $z$, but it didn't work:

$x \geq 1-M(1-z)$

$y \leq M(1-z)$

1

There are 1 best solutions below

4
On

Equivalently, you want to enforce $x>0 \implies y \le 0$. Suppose $M_x$ is an upper bound on $x$ and $M_y$ is an upper bound on $y$. Introduce binary variable $z$ and impose linear constraints \begin{align} x &\le M_x z \tag1\label1 \\ y &\le M_y(1-z) \tag2\label2 \end{align} Constraint \eqref{1} enforces $x > 0 \implies z = 1$. Constraint \eqref{2} enforces $z = 1 \implies y \le 0$.