On Wed, 19 Jun 2013, Andrew Makhorin wrote:
-------- Forwarded Message -------- From: Alan Zinober <[email protected]> To: [email protected] Subject: Either...or logic Date: Wed, 19 Jun 2013 09:54:28 +0100Suppose set S; # eg S = {1,3,4,6,8} N = card(S); var x{i in S} binary; # x = 1 if the item i is active ; x = 0 if no items are included I have a logical constraint having the form: either sum{i in S} x[i] = N or sum{i in S} x[i] = 0 In words either all the items x[i] are included or none are. This will be repeated many times in my model. What is the optimal manner of implementing this in the model?
i in S, j in S : x[i] = x[j] I'm sure I've mangled the syntax. -- Michael [email protected] "On Monday, I'm gonna have to tell my kindergarten class, whom I teach not to run with scissors, that my fiance ran me through with a broadsword." -- Lily _______________________________________________ Help-glpk mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-glpk
