Page 1 of 1

Command to aggregate parameters

Posted: Tue Jun 14, 2022 10:27 am
by Abich1414.
Dear Micheal and GAMS family, I am trying to calculate the aggregated weighted average of parameters of the aggregated regions. But I failed to do that. it is very urgent. Could you please help me?. I have attached the file below and i am grateful if you could help me.

I have 3 parameters (AVEt,AVEnt and trade), sector I_org, region R_org and S_org in the gdx file
I have aggregated the sectors from i_org to I, Regions from R_org to R and S_org to S.
Now what i want to calculate is the new parameter of weighted average of AVET of the new aggregated sector I from the aggregated R to the other aggregated region S that is ( sum (trade*AVEt/ sum trade)

WAVEt(i,r,s)=

Thank you in advance.
Agg.gdx
(1.48 MiB) Downloaded 114 times

Re: Command to aggregate parameters

Posted: Wed Jun 15, 2022 7:11 am
by bussieck
Why don't you share your attempts that also shows the aggregation of the sets etc. Please share where the issue are and what you are struggling with. You need to have a basic understanding of GAMS and its language before you can use it. I understand and sympathetic about the struggles learning GAMS, it is quite different than regular programming languages, but it is worth learning starting with the tutorials on the GAMS web site.

-Michael

Re: Command to aggregate parameters

Posted: Wed Jun 15, 2022 9:21 am
by Abich1414.
Dear Micheal, Thank you for your dedicated response to GAMS users and sorry for not sharing my attempt.
Please have a look at the following code.
The problem I faced is the newly created parameter WAAVEt(i,r,s) is not displayed in the GDX file.
Here is, the command I used to create the new parameter.
Parameter WAAVEt(i,r,s) " trade based weighted average of AVEt";
WAAVET(i,r,s) =SUM((i_org,r_org,s_org, AVEt(i_org,r_org,s_org ))$ (AVEt(i_org,r_org,s_org)* trade(i_org,r_org,s_org))/sum(trade(i_org,r_org,s_org)));


DISPLAY AVEt, AVEnt , r , i, WAAVEt;

But WAAVEt is not displayed in the GDX file

For your reference, I have attached the GMS and GDX file.
Sincerely,
Agg.gms
(3.96 KiB) Downloaded 125 times
Agg.gdx
(1.48 MiB) Downloaded 125 times