Strict inequality logical implication in optimization problems

327 Views Asked by At

I have $ x \in \{0,1\}$ and $y \geq 0$ and I want to model that $x=1$ iff $y>0$, is this possible while keeping the constraint linear? Thanks.

One part of the implication is easy $ y \leq Mx$. The other part I can approximate as $ \epsilon x \leq y $. Where $\epsilon$ is small and $M$ is big. But this doesn't work if $y$ is very small.

2

There are 2 best solutions below

0
On BEST ANSWER

In practice, if $y$ is computed (as opposed to a parameter that is read in and never changed), the chances are high that you will get a nonzero value (possibly even negative) when it should be zero, due to rounding error. Constraints aside, you probably should set a tolerance value $\epsilon > 0$, small but not too small, and round $y$ to $0$ any time $|y|<\epsilon$. That will let you proceed as you proposed in your question.

0
On

Your constraint handles y>0⟹x=1. To handle the reverse case, you want x=1 to be less optimal than x=0 when y=0. You can handle this by adjusting the objective function by −Mx (in the case of maximisation), as it will force x=0 unless it is required to be positive at the optimal solution. – Daryl