In order for my proposed solution to work, first, you need to define values Xij_min
and Xij_max
to represent the minimum and maximum limits of the Xij
variable when it is Xij > 0
.
Xij_min
can be as small as you wish or makes sense and Xij_max
can be arbitrarily high if there are no physical limits to your variables.
Then by adding the two following constraints, what you want can be achieved:
Xij >= Xij_min * Yij
Xij <= Xij_max * Yij
For the sake of this example, I will assume Xij_min = 0.1
and Xij_max = 1000
. This will make the constraints:
Xij >= 0.1 * Yij
Xij <= 1000 * Yij
If Xij
is to take a value between 0.1 and 1000 (which we defined as the feasible, positive range), then Yij
will have to be 1.
Now if Xij
becomes 0, then in order for these constraints to hold Yij
will need to be 0 in order to have Xij <= 0
and Xij >= 0
.