Page 1 of 1

Subsets

Posted: Fri Jan 10, 2020 2:11 pm
by Gunners
hi, i'm new to the forum and i just started using gams and i don't know how to be able to write an index dependent on another. that is, I have my index j of values ​​{1,2,3,4,5}, and I would like to write an index k (i) whose values ​​change as i changes. so for example I have k (1) of values ​​{1,2}, k (2) of values ​​{2,3,5,7} up to k (5). thanks in advance for your reply.

Re: Subsets

Posted: Mon Jan 13, 2020 4:26 am
by dirkse
Gunners,

If you need to essentially have a subset of j defined for each value of i, the GAMS way to do this is with what I call a mapping set. The attached code illustrates what I mean.
mapping.gms
(223 Bytes) Downloaded 292 times
-Steve