Circular or Equilibrium Leads and Lags: ++ / --

Top  Previous  Next

Some problems involve sets defined over time covering quarters or months.  Often when operating with such sets one may wish to define carryover relationships where the year wraps around in an equilibrium fashion and beginning storage in January equals ending storage in December.  These operators only work with ordered sets.

Examples:

The GAMS equilibrium lead and lag features for set referencing are used as  follows (dynindex.gms)

 

Stockbal3(t).. endstock(t--1)=e=beginstock(t);

 

Where the --1 notation references the previous time period to the current one and wraps to the last element when on the first element, or equivalently

 

Stockbal4(t).. endstock(t)=e=beginstock(t++1);

Notes:

The lead and lag can also use ++n (--n) to go n periods into the future (past).
When a case t--1 or t++1 etc does not exist the reference wraps restarting at the top or the bottom.