Subsets

Problems with syntax of GAMS
Post Reply
Gunners
User
User
Posts: 1
Joined: 8 months ago

Subsets

Post by Gunners » 8 months ago

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: 127
Joined: 4 years ago
Location: Fairfax, VA

Re: Subsets

Post by dirkse » 8 months ago

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 80 times
-Steve

Post Reply