Chien-Chung Huang wrote:
> However, in the model, we have the constraints which some boolean is
> not the same as the input variables.
> For example, b1,b2 are the variables. c1,c2 is the input parameters.
> (True or False)
> if b1=c1, then b2<> c2.
I'm not positive I understand this. If you are saying that b1 and b2
are 0-1 variables, c1 and c2 are 0-1 parameters, and you want to
enforce (b1 == c1) => (b2 <> c2), you can do it by introducing a new
binary variable y and the following constraints:
y <= b1 + c1 <= 2 - y;
1 - y <= b2 + c2 <= 1 + y.
The key is that if b1, b2, c1 and c2 are all 0-1, then b1 <> c1 iff b1
+ c2 = 1 and similarly for b2 and c2. Looking that the first
constraint, if b1 = c1 then b1 + c1 is either 0 or 2, either of which
forces y = 0, which in the second constraint forces b2 + c2 = 1 (so b2
<> c2). On the other hand, if b1 = c1 then y can be either 0 or 1 in
the first constraint, and y = 1 makes the second constraint vacuous.
/Paul
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To post to this group, send email to
ampl@...
To unsubscribe from this group, send email to
ampl-unsubscribe@...
For more options, visit this group at
http://groups.google.com/group/ampl?hl=en-~----------~----~----~----~------~----~------~--~---