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
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
Thank you! I will implement them and keep you posted on how they work