Data exchange: $gdxin works but execute_load fails

Hello GAMS users,

I am trying to load set and parameter from a GDX file (subhessian.gdx) using the ‘execute_load’ command. For some reason it doesn’t load the data and returns a ‘zero’ value for all the parameters. However, the strange thing is I am able to use ‘$gdxin’ to load the set and parameter with no problem. Could anyone help me to make the ‘execute_load’ also works? Since my ultimate goal is to load the GDX file ‘subhessian.gdx’ in a loop, so I guess I have to use ‘execute_load’ instead of ‘$gdxin’.

And help with this is greatly appreciated.

Thanks.
subhessian.gdx (13.8 KB)
main.gms (414 Bytes)

Understand the difference between compile time and execution time (https://www.gams.com/32/docs/UG_GamsCall.html#UG_GamsCall_TwoPass). GAMS cannot extend the universe of labels (set elements) at run time. All labels must be known at the end of compilation. Your program has no labels and hence execute_load does not load anything because you do a filtered load. If you try a domain controlled load execute_loadDC you will get execution errors because the data you want to load violates the domain of the sets (which are all empty).

-Michael