Multiple sets - different input datasets

Problems with modeling
Post Reply
fermar
User
User
Posts: 2
Joined: 2 years ago

Multiple sets - different input datasets

Post by fermar » 2 years ago

Hi all,
I have a somewhat complex model, input dataset is large and it would be hard to set and reset parameters for multiple solves in just one run. However, when using a gms file with $include commands (one for each model run with a different input dataset) obviously errors occur as GAMS interprets that parameters are being redefined.
Is there any way to run this model (with different datasets) but somehow "reset" the definitions? any other plausible approach perhaps?
Cheers
Mario

User avatar
Renger
Posts: 379
Joined: 3 years ago

Re: Multiple sets - different input datasets

Post by Renger » 2 years ago

Hi Fermar

It looks like you are including files with the parameter definition.
One way would be to rename these parameters in the include files and assign them to the main parameter.

in the include file: parameter sc1values(tech,t) ...

in main file
$include file with sc1values
values = sc1values(tech,t);
solve mymodel

$include file with sc1values
...

Or you have all the values in an excel (pivot) table with the scenario names as an additional dimension.
You then read the table with gdxxrw and assign the values in a loop

set scen 'Scenarios' /sc1*sc5/;
paramter scenvales(scen, tech,t) Values for the different scenarios;
* Read the values with gdxxrw (see the documentation)
loop(scen,
values(tech,t) = scenvalues(scen, tech,t);
solve model
);

Hope this helps
Cheers
Renger
____________________________________
Enjoy modeling even more: The lazy economist

fermar
User
User
Posts: 2
Joined: 2 years ago

Re: Multiple sets - different input datasets

Post by fermar » 2 years ago

Thank you! I will implement them and keep you posted on how they work

Post Reply