[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 22:41:49 +0300 |
>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:
>
Which 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;
Not seeing the complete model it is hard to say what's happening.
Both errors appear during run-time, i.e. when the translation is
done and the mathprog translator is executing the pseudo-code. The
message "Z[setof] out of domain" means that you attempt to refer to
the element Z['setof'], where "setof" is a symbolic *value* of the
subscript which, however, does not belong to the indexing set over
which the parameter Z is defined. For example, in the context
param Z{1..10};
param foo := Z[11];
there would be "Z[11] out of domain". Note that elements of indexing
sets may be numeric as well as symbolic quantities.
The message "cannot convert setof to floating-point number" means that
there is an attempt to perform some numeric operation on the value
"setof" which is symbolic, not numeric. For example:
set S := {'aaa', 'bbb', 'ccc'};
param p{i in S} := i + 1;
in whicn case there would be "cannot convert aaa to floating-point
number".
>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?
To make sure that your model is correctly generated you can specify the
option --wtxt as follows:
glpsol -m foo.mod --wtxt bar.txt
Then the generated model is written to the file bar.txt in plain text
format suitable for visual analysis.