> I'm having problems with creating a subset.
> 
> What I want to be able to do is this:
> sum for s in S', forall S' where S' is a subset of Sc such that the
> size of S' = mc[c]
> 
> set S; /* The set of servers */
> set C; /* The set of Cluster */
> set Sc {c in C}; /* The set of servers in cluster c */
> param mc {c in C}, integer, > 0;
> 
> Is there a way to do this with GMPL?

If you need to enumerate all subsets of a given n-element set, you may
try the following:

set N := 1..n;
/* n-element set */

set U := 0..2^n-1;
/* "set" of all subsets of N numbered from 0 to 2^n-1 */

param e{i in U, j in N}, binary, := (i div 2^(j-1)) mod 2;
/* e[i,j] is 1 iff i-th subset of N includes element j */




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

Reply via email to