Page 1 of 1

Omitting dimensions

Posted: Sun Sep 12, 2021 12:50 pm
by hein123
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!

Re: Omitting dimensions

Posted: Sun Sep 12, 2021 10:40 pm
by GFA
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

Re: Omitting dimensions

Posted: Mon Sep 13, 2021 8:47 am
by bussieck
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

Re: Omitting dimensions

Posted: Tue Sep 28, 2021 3:36 pm
by hein123
Thanks for the suggestions, GVA and Michael!

Both methods worked!