Q: I was just wondering whether a cleaner way of including set identifiers in a GDX file name has been invented..
Things are somewhat better:
set i /i1*i5/, c /c1*c3/; parameter r_c(i,c); file fhelp; loop(i, r_c(i,c) = uniformInt(1,10); put_utility fhelp 'gdxout' / 'results_' i.tl:0 '.gdx'; execute_unload; );
The put_utility allows to construct a file name using the normal put features for the next gdx execution-time operation. An execute_unload
without a file name specified will use the file name constructed this way. gdxin
and execute_load
work in a similar way.
Bruce McCarl has documented this feature in his McCarl GAMS Guide (in the IDE Help→Expanded GAMS Guide (McCarl). Search for put_utility
and chose topic reading multiple GDX files
.