[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] [Fwd: Either...or logic]
From: |
Michael Hennebry |
Subject: |
Re: [Help-glpk] [Fwd: Either...or logic] |
Date: |
Wed, 19 Jun 2013 10:22:41 -0500 (CDT) |
User-agent: |
Alpine 1.00 (DEB 882 2007-12-20) |
On Wed, 19 Jun 2013, Andrew Makhorin wrote:
-------- Forwarded Message --------
From: Alan Zinober <address@hidden>
To: address@hidden
Subject: Either...or logic
Date: Wed, 19 Jun 2013 09:54:28 +0100
Suppose
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 address@hidden
"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