0

I have the following condition:

  • If $x = 0$ and $c=0$ then $z=1$.
  • If $x>0$ and $c=1$ then $z = 1$.
  • If $x>0$ and $c=0$ then $z = 0$.

I find the constraint $x(1-c) \geqslant 1-z$, but it misses the last point.

EDIT

The variables $z$ and $c$ are binary variables.

1 Answers1

3

$$z=-sgn(x)+sgn(c)+1$$ does the job.

Peter
  • 84,454