The LOOPOP, or Loop optimization, parameter is used to either enable or disable LINGO's loop optimization step.  Loop optimization reformulates expressions containing set looping functions in order to make them more efficient, while maintaining mathematical equivalency.  The end goal of loop optimization is to minimize the number of passes through the inner loop of any nested loops in an expression.

As an example, consider the following transportation model fragment, that just contains constraints for satisfying customer demand:

MODEL:

! A transportation problem fragment;

SETS:

  WAREHOUSE /1..50/  : CAPACITY;

  CUSTOMER /1..5000/ : DEMAND;

  ROUTES( WAREHOUSE, CUSTOMER) : COST, VOLUME;

ENDSETS

 

! The demand constraints;

@FOR( CUSTOMER( J):

   @SUM( ROUTES( I, J): VOLUME( I, J)) >= DEMAND( J)

);

 

END

Transportation Model Fragment with Inefficient Constraints

In the demand constraints expression there are two loops - an outer @FOR() over the CUSTOMER set and an inner @SUM() over the ROUTES set.  As written, the inner loop must be executed 50*50*5000=1.25 million times.  Note that a  valid reformulation of these demand constraints would be:

! The demand constraints;

@FOR( CUSTOMER( J):

   @SUM( WAREHOUSE( I): VOLUME( I, J)) >= DEMAND( J)

);

With the expression rewritten in this manner, the inner loop will now only be executed 50*5000 times, for a 98% reduction in total passes.  LINGO's loop optimizer seeks out such inefficient loops and, invisible to the user, rewrites them before the model gets passed to the generator.  Of course, the end result of such reformulations are faster generation times.  In fact, the speedup from reformulation can be quite dramatic in many cases.  In this particular example, the reformulated version ran over 400 times faster in the model generator.

LINGO defaults to disabling the LOOPOP feature.