How to write the following if-then condition in Mixed Integer Programming? If a<b then c=1, 0 otherwise

872 Views Asked by At

I am new to mixed-integer programming and I am confused about how to approach this if-then condition. How do I the following constraint in mixed-integer programming: if Dm +t < Dn + then Zmn=1, 0 otherwise.

1

There are 1 best solutions below

3
On BEST ANSWER

You cannot enforce a strict inequality, so you must choose between two formulations that come close but do not exactly match what you want. I'll phrase this in terms of the title of your question. In both versions, $c$ is a binary variable.

Option 1: $a \ge b - M_1 c$ and $a \le b + M_2(1-c)$, where $M_1$ and $M_2$ are suitably large constants. If $a > b$ this forces $c=0$, and if $a < b$ this forces $c=1$. The downside is that if $a=b$, $c$ can be either 0 or 1.

Option 2: $a \ge b - M_1 c$ and $a \le b - \epsilon + M_2(1-c)$, where $M_1$ and $M_2$ are suitably large constants and $\epsilon > 0$ is a small constant (but not so small as to look like rounding error to your solver). If $a \ge b$ this forces $c=0$, and if $a \le b-\epsilon$ this forces $c=1$. The downside is that $b-\epsilon < a < b$ is now infeasible.