Element Position

Top  Previous  Next

Dynamic models often lead one to need to specify initial, terminal and normal operating rules.  For example, given a model defined over years one could want beginning storage in year one to equal Initial storage, ending storage in the last period to equal a fixed amount and initial storage in the years in between to equal carry out storage from the year before.  This is commonly imposed using CARD and ORD.  In such a case one could impose the following (dynindex.gms)

 

Storecarry(t)..        Beginstorage(t) =e= initial$(ord(t) eq 1) +endstorage(t-1);

Termstore(t)$(ord(t)=card(t))..        Endstorage(t)=e=finalstore;