Change the sequence of the dimensions

Problems with syntax of GAMS
Post Reply
Basstoelpel
User
User
Posts: 3
Joined: 5 years ago

Change the sequence of the dimensions

Post by Basstoelpel »

Hello,

I want to change the sequence of the dimensions of the parameter tch from tch (c,*,t) to tch(t,c,*). Is that possible and if how?

Thanks in advance
User avatar
bussieck
Moderator
Moderator
Posts: 1033
Joined: 7 years ago

Re: Change the sequence of the dimensions

Post by bussieck »

There is no magic to this. Just do it in the declaration and at every place you use tch. There is not automation help to refactor your code this way (neither in the IDE not in Studio). You need to do this manually.

-Michael
Basstoelpel
User
User
Posts: 3
Joined: 5 years ago

Re: Change the sequence of the dimensions

Post by Basstoelpel »

Hi Michael,

thanks for your reply. I must have been unprecise.

Due to the data structure from an Excel input (which I don't want to change), it is not possible to change the declaration. I was wondering whether there is a leaner way than introducing a second parameter tch2(t,c,*) = tch(c,*,t).
User avatar
bussieck
Moderator
Moderator
Posts: 1033
Joined: 7 years ago

Re: Change the sequence of the dimensions

Post by bussieck »

No, unfortunately not. The following code does a fast copy and frees up memory used by tch (if this is not needed anymore):

Code: Select all

Parameter tch(c,*,t), tch2(t,c,*);
$gdxin fromExcel
$load tch
option tch2<tch, clear=tch;
-Michael
Basstoelpel
User
User
Posts: 3
Joined: 5 years ago

Re: Change the sequence of the dimensions

Post by Basstoelpel »

Too bad. Anyway thanks for your support!
Post Reply