How to linearize a conditional constraint in linear programming

154 Views Asked by At

How can I linearize this constraint:

  • if $x\leq 0 $ then $y=0$

  • if $x > 0$ then $y=1$

1

There are 1 best solutions below

0
On BEST ANSWER

Suppose $x$ is not an Integer:

Let $M$ denote the “largest” number in $\Bbb R$, and then let $y$ be a binary variable and do the following:

$$x\le yM$$ $$x>-M(1-y)$$

That strict inequality, $>$, is going to make the feasible region open. So, depending on the objective function of the original problem, this could mean the model is infeasible.

Suppose $x$ is an Integer:

Let $M$ denote the “largest” number in $\Bbb R$, and then let $y$ be a binary variable and do the following:

$$x\le yM$$ $$x\ge -M(1-y)+1$$