Subsets

Problems with syntax of GAMS
Post Reply
Gunners
User
User
Posts: 3
Joined: 4 years ago

Subsets

Post 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.
User avatar
dirkse
Moderator
Moderator
Posts: 214
Joined: 7 years ago
Location: Fairfax, VA

Re: Subsets

Post 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 281 times
-Steve
Post Reply