1

I have an integer variable $q_i$ and a binary variable $x_{ ij }$.

How can I write the following constraint?

if $x_{ ij } = 0$ then $q_i = 0$

else if $x_{ ij } = 1$ then $q_i > 0$

drzbir
  • 496
  • 4
  • 19

1 Answers1

2

$q_i \ge x_{ij}$ sets the lower bound for $q_i$ so that $q_i \ge 0$ if $x_{ij}=0$ and $q_i \ge 1$ if $x_{ij}=1$

$q_i \le 999999 x_{ij}$ sets the upper bound for $q_i$ so that $q_i \le 0$ if $x_{ij}=0$ and $q_i \le 999999$ if $x_{ij}=1$. You can set the $999999$ as large as you need.

tomi
  • 9,594