I'm new in GAMS, and I would like to create a parameter that returns items of a set instead of real numbers:
sets
A / A1, A2, A3, A4, A5 /
B / B1, B2, B3, B4, B5 /;
parameters
C(A)
/
A1 B5,
A2 B4,
A3 B3,
A4 B2,
A5 B1
/
D(B)
/
B1 A3,
B2 A4,
B3 A2,
B4 A1,
B5 A5
/;
display C, D;
When I try to compile this code, I obtain the following error: Real number expected
.
I searched on Google if there is a way to achieve what I want, and I find the data type Acronym
which allows the usage of non-number value. However, an Acronym
cannot be used as an index for parameters, unlike set
. I tried to have both acronym
and set
for the same values (e.g. replacing A
by SetA
and AcroA
and B
by SetB
and AcroB
) but I did not find anything about how to put values from a set
to an acronym
and vice-versa.
Is there a way to achieve what I want to do, with or without Acronyms
?