[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] Set of sets
From: |
Andrew Makhorin |
Subject: |
Re: [Help-glpk] Set of sets |
Date: |
Wed, 10 Dec 2008 03:10:11 +0300 |
> sets of sets are not to be properly supported by GLPK:
> The for statement does not support set of sets:
> set M{1..2};
> solve;
> for {m in M}
> display m;
> data;
> set M[1] := 1 2;
> set M[2] := A B C;
> results in
> M must be subscripted
Dummy index cannot be a set, i.e. context '{m in M}' is not valid
in this case. The following statement is correct:
for {i in 1..2, m in M[i]}
display ...
> Setof does not support set of sets:
> set M := setof{ i in {1..3} } {1..i};
> results in
> integrand following setof{...} has invalid type
In setof integrand cannot be a set, it can be only a n-tuple.
The following statement is correct:
set M{i in 1..3} := 1..i;
> set M:= {{1..2}, {1..3}};
> results in a set of tuples ( {1..2} cross {1..3} ). It should better
> return a set of sets.
I do not think so. 'set M:= {{1..2}, {1..3}};' means the same as
'set M:= {i in {1..2}, j in {1..3}};' with dummy indices omitted, so
formally it is a cross product.
> Same for
> set M:= {({1..2}), ({1..3})};
> Same for
> set A := {1..2};
> set B := {1..3};
> set M:= {A,B};
> cf. http://lists.gnu.org/archive/html/help-glpk/2008-05/msg00043.html
A set of sets is like an array of sets, i.e. like an array, whose
members are plain sets; it is similar to a subscripted parameter, whose
members are numbers or symbols.