Help translating dynamic set statement from GNU mathprog
Posted: Sat Jan 28, 2023 1:30 pm
I'm trying to translate a model written in GNU mathprog. Most of it is pretty straightforward, but there are some dynamic set declarations and operations that are puzzling me.
This is an example of a statement for a dynamic set in GNU mathprog that I'm struggling to translate into GAMS:
set MODExTECHNOLOGYperEMISSION{e in EMISSION} within MODE_OF_OPERATION cross TECHNOLOGY
:= {m in MODE_OF_OPERATION, t in TECHNOLOGY : exists{r in REGION, y in YEAR} EmissionActivityRatio[r,t,e,m,y] <> 0};
For some explanation: EmissionActivityRatio(r,t,e,m,y) is a parameter.
Static sets are: REGTION, TECHNOLOGY, EMISSION, MODE_OF_OPERATION, YEAR
Then later in the code, this set is used like this in a constraint:
s.t. E5_DiscountedEmissionsPenaltyByTechnology{r in REGION, t in TECHNOLOGY, y in YEAR}: sum{e in EMISSION, l in TIMESLICE, (m,tt) in MODExTECHNOLOGYperEMISSION[e]: t=tt} EmissionActivityRatio[r,t,e,m,y]*RateOfActivity[r,l,t,m,y]*YearSplit[l,y]*EmissionsPenalty[r,e,y]/DiscountFactorMid[r,y] = DiscountedTechnologyEmissionsPenalty[r,t,y];
tt is an alias of t and TECHNOLOGY. TIMESLICE is another set. RateOfActivity[r,l,t,m,y] and DiscountedTechnologyEmissionsPenalty[r,t,y] are variables. Yearsplit[l,y], EmissionsPenalty[r,e,y] and DiscountFactorMid[r,y] are parameters.
If anyone can help with equivalent GAMS statements for the set statement and constraint equation above, I would be really grateful.
This is an example of a statement for a dynamic set in GNU mathprog that I'm struggling to translate into GAMS:
set MODExTECHNOLOGYperEMISSION{e in EMISSION} within MODE_OF_OPERATION cross TECHNOLOGY
:= {m in MODE_OF_OPERATION, t in TECHNOLOGY : exists{r in REGION, y in YEAR} EmissionActivityRatio[r,t,e,m,y] <> 0};
For some explanation: EmissionActivityRatio(r,t,e,m,y) is a parameter.
Static sets are: REGTION, TECHNOLOGY, EMISSION, MODE_OF_OPERATION, YEAR
Then later in the code, this set is used like this in a constraint:
s.t. E5_DiscountedEmissionsPenaltyByTechnology{r in REGION, t in TECHNOLOGY, y in YEAR}: sum{e in EMISSION, l in TIMESLICE, (m,tt) in MODExTECHNOLOGYperEMISSION[e]: t=tt} EmissionActivityRatio[r,t,e,m,y]*RateOfActivity[r,l,t,m,y]*YearSplit[l,y]*EmissionsPenalty[r,e,y]/DiscountFactorMid[r,y] = DiscountedTechnologyEmissionsPenalty[r,t,y];
tt is an alias of t and TECHNOLOGY. TIMESLICE is another set. RateOfActivity[r,l,t,m,y] and DiscountedTechnologyEmissionsPenalty[r,t,y] are variables. Yearsplit[l,y], EmissionsPenalty[r,e,y] and DiscountFactorMid[r,y] are parameters.
If anyone can help with equivalent GAMS statements for the set statement and constraint equation above, I would be really grateful.