> Please could you help me to express the following constraint if
> possible.
> 
> 
> for i in {1..2} if V[i] =1 then 2<= sum {x in MySet} V2[x] <=3
>                     else (V[i] =0) then sum {x in MySet} V2[x]  may
> have any value (i do not care about the value in this case)
> 
> 
> 
> 
> with V and V2 are boolean variables
> 

The disjunctive condition

   if z = 1 then   a <= x <= b
   if z = 0 then -M1 <= x <= +M2

where M1 and M2 are sufficiently big numbers, is equivalent to:

   a * z - M1 * (1 - z) <= x <= b * z + M2 * (1 - z)

from which it follows that:

   x >= (a + M1) * z - M1
   x <= (b - M2) * z + M2

Note that M1 = - inf x, and M2 = + sup x should be chosen as small as
possible.


_______________________________________________
Help-glpk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-glpk

Reply via email to