This question already has an answer here:
I have two variables $A$ and $B$, with $A$ being binary and $B$ is a real number where $B \ge 0$. My conditions are:
if B > 0 A = 1 else A = 0
How to express this as a linear program? I have figured out one condition using the big-M method:
$MA \gt B$
which means that if $B>0$, then $A$ must be 1 to satisfy this constraint. However if $B=0$, then $A$ can be either 1 or 0, and I need another constraint. How to enforce $A$ to be 0 when $B=0$?