Tuesday, January 8, 2013

Optimizing some GAMS code

Some part of a large GAMS model was running slow so we had to investigate. The first line in the box below was the culprit:

image

We tried two alternative formulations using implicit loops. The performance gains on this data set were enormous (now the GAMS part is no longer the bottleneck in the process, the bulk of the time has moved back to database operations). Explicit loops can be much more expensive than implicit loops, especially when dealing with big data.