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:
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