How can I linearize the IFF-THEN constraint with binary and continuous variable?

284 Views Asked by At

I have an optimization problem where

$a_{m,n}\in\{0,1\}$ is a binary variable and $0\le f_{m,n}\le 1$ is a continuous vaiable

I have an Iff-THEN constraint like this

IFF $a_{m,n}=1$, THEN $f_{m,n}>0$

and

IFF $a_{m,n}=0$, THEN $f_{m,n}=0$

How can I linearize them?

I tried as below:

$f>a-1$

$f\le a$

but it is not working

1

There are 1 best solutions below

5
On BEST ANSWER

First, note that you can't impose strict $>$ constraints. Instead, you'll have to choose a small $\epsilon > 0$ and then require $f \ge \epsilon$. Then these constraints should do the trick:

$$\begin{align} f & \le Ma \\ f & \ge \epsilon - M(1-a) \end{align}$$

Here, $M$ is a large constant. You should set it equal to the largest value that $f$ can reasonably take.

The logic is: If $a = 0$, then the first constraint says that $f$ must equal $0$ (and the second constraint has no effect). If $a = 1$, then the second constraint says that $f$ must be greater than or equal to $\epsilon$ (and the first constraint has no effect).