I would like to run my gams file gamsfile.gms several times for different values a and b. For this, I created a file which states
set
a /boat, house, car/
b /y1*y8/;
file myfile /input.inc/;
loop((a,b),
put myfile;
put "$setglobal value_a " a.tl /;
put "$setglobal value_b " b.tl /;
putclose myfile;
execute 'GAMS gamsfile.gms o=gamsfile.lst'
);
gamsfile.gms starts with
$INCLUDE input.inc
$gdxIn data_%value_a%_%value_b%.gdx
However, when I let this run, GAMS seems to create the input.inc file only after the execution of gamsfile.gms has already started - so gamsfile.lst reports that there was no input.inc file that it could open, while input.inc appears in the folder right afterwards.
If I run it again, gams can open the include file (since it still exists frm the previous run), but only with the last values that were written on there.
I don’t understand this, as everything should run in run time. Does anyone have an idea?