Sunday, August 16, 2009

GAMS: allow declarations inside loop

Many newer languages allow for declarations almost anywhere. In a large GAMS model I had a case like this:

loop(i,
  ….much code here…
#include xxx.inc
  ….much code here…
);

Inside the include file I needed a local set so I could simplify some expressions. I can not place the set declaration there, but am forced to move it far, far away outside the loop. For small models this is not a big problem, but for very large models it would be beneficial to allow declarations inside loops so we can declare symbols close to where they are used.

No comments:

Post a Comment