Data exchange: $gdxin works but execute_load fails

Problems with syntax of GAMS
Post Reply
jshengdb
User
User
Posts: 14
Joined: 6 years ago

Data exchange: $gdxin works but execute_load fails

Post by jshengdb »

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.
main.gms
(414 Bytes) Downloaded 225 times
subhessian.gdx
(13.83 KiB) Downloaded 207 times
User avatar
bussieck
Moderator
Moderator
Posts: 1037
Joined: 7 years ago

Re: Data exchange: $gdxin works but execute_load fails

Post by bussieck »

Understand the difference between compile time and execution time (https://www.gams.com/32/docs/UG_GamsCal ... ll_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
Post Reply