Friday, October 22, 2010

Speed of loops in GAMS

In general loops are slow in GAMS. See http://yetanothermathprogrammingconsultant.blogspot.com/2009/08/gams-speed-of-loops.html. There are some exceptions however. Here is an example:

image Note that map(i,k) has a diagonal structure.

The timings are:

method 1: loop 0.156 seconds
method 2: sum 3.495 seconds

No comments:

Post a Comment