Reputation: 125
Consider the following problem in GAMS. I have two disjoint sets:
i
and j
. These are proper subsets of a subset k
, where the union of i
and j
exactly equal the elements of k
. I wish to construct a new variable X(k
) (for the proper subset), that is a concatenation of A(i
) and B(j
). Intuitively, I wish to declare:
parameter
X(k);
X(k)=A(i)+B(j);
Of course, this operation is not legal as i and j do not conform. But the idea is to take the values from A(i) for the i elements of X(k), and the rest to be taken from B(j). Any help on this is much appreciated!!
Upvotes: 0
Views: 1112
Reputation: 2292
This sounds like a perfect example for an implicit set definition. So, you can do the following:
Set
k
i(k<) / i1*i3 /
$onMulti
j(k<) / j1*j3 /;
parameter X(k);
Check this for more information:
https://www.gams.com/32/docs/UG_SetDefinition.html#UG_SetDefinition_ImplicitSetDefinition
Upvotes: 1