[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-glpk] Re: Subsets in GNU MathProg
From: |
Andrew Makhorin |
Subject: |
[Help-glpk] Re: Subsets in GNU MathProg |
Date: |
Fri, 17 Oct 2003 16:55:12 +0300 |
>I know there is a keyword named 'setof' (that maybe solve my problem),
>but I can't understand its behavior reading the documentation.
>
>When I do a
>
>set N := aa bb cc dd ee ff gg;
>set S := setof N;
>
>what happens exactly? With this syntax, will S be any subset of N (all
>the combinations)?
>
Consider an example:
S := setof{i in I, (j,k) in J cross K: i+j <> k} (i+1, j, k-1);
In a procedural language (like Algol) the construction above could be
expressed as follows:
S := empty set;
for all i in I do
for all (j,k) in J cross K do
if i + j != k then
S := S union { (i+1, j, k-1) };
Thus, the construction "set S := setof N" is syntactically invalid,
because there is missing an "integrand", i.e. a n-tuple which forms the
resultant set (as (i+1, j, k-1) in the example above).