Omitting dimensions

Problems with modeling
Post Reply
hein123
User
User
Posts: 2
Joined: 1 month ago

Omitting dimensions

Post by hein123 » 1 month ago

Hello everyone!

The following three parameters are loaded from a GDX file, partly defined over the universal set (*).

parameter1(r,i,*,t)
parameter2(*,*,*,*,*,*,*)
parameter3(r,*,i,*,t)

Now, I want to omit some dimensions by summing over (*).
However, this doesn't work with GAMS.
Note that the universal sets (*) refer to different sets.

For parameter1(r,i,*,t) I found a solution by using the alias command (*,g) and then summing over the subset of g, i(g):
parameter11(r,i,t) = sum(i(g),parameter1(r,i,g,t));

Yet, this solution doesn't work anymore for parameter2 or parameter3, as they are defined over more than one universal set (*).

Do you have a suggestion how to solve this problem?

Thanks in advance!

GFA
User
User
Posts: 34
Joined: 3 years ago

Re: Omitting dimensions

Post by GFA » 1 month ago

Hi hein,

Have a look here and especially at example 4: https://www.gams.com/latest/docs/UG_GDX.html
You might want to use something like: "$load setNo1<Parameter2.dim1" etc. to load the setelements from GDX.

Regards,
GFA

User avatar
bussieck
Moderator
Moderator
Posts: 645
Joined: 5 years ago

Re: Omitting dimensions

Post by bussieck » 1 month ago

Yet, this solution doesn't work anymore for parameter2 or parameter3, as they are defined over more than one universal set (*).
Why not? Just make more aliases: alias(*,u1,u2,u3,u4,u5,u6,u7) and use the same technique as for parameter1.

-Michael

hein123
User
User
Posts: 2
Joined: 1 month ago

Re: Omitting dimensions

Post by hein123 » 3 weeks ago

Thanks for the suggestions, GVA and Michael!

Both methods worked!

Post Reply