help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-glpk] Re: Subsets in GNU MathProg


From: Marcos Vinicius Lazarini
Subject: [Help-glpk] Re: Subsets in GNU MathProg
Date: Fri, 17 Oct 2003 13:45:50 -0300 (EST)

Hi Andrew,

Now I understand my mistake (at least, I hope so). But I got various
errors, somewhat confusing, when my constrains use the set S declared that
way:

(some good messages here)
my_file.mod:47: cannot convert setof to floating-point number
Model processing error

Line 47 of my_file.mod:
s.t. test: sum{j in S,k in S: k > j} Y[j,k] <= sum{j in S} Z[j];


or


(some good messages here)
my_file.mod:47: Z[setof] out of domain
Model processing error

Line 47 of my_file.mod:
s.t. tmp: sum{i in S}Z[i]<= 10;



Or when I don't refer this set S (incorrectly declared) in any constrains
(s.t. clauses), there is no error message - even a solution was found (I
think it was correct).

Is this the right behavior?


Thanks for your help,

Marcos Lazarini


On Fri, 17 Oct 2003, Andrew Makhorin wrote:

> >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).
> 
> 
> 






reply via email to

[Prev in Thread] Current Thread [Next in Thread]