Equation existence limited using conditionals

Top  Previous  Next

(transbad.gms vs. transfix.gms)

Equations such as

 

slDEMANDEQ(MARKET)..

SUM(PLANT, SHIP(PLANT, MARKET))=G=DEMAND(MARKET);

 

may not really be relevant for all possible elements of the market set.  I might only define equations when there is nonzero demand.  Program execution time and model size would be helped by

 

inDEMANDEQ(MARKET)$demand(market)..

SUM(PLANT,  SHIP(PLANT, MARKET)) =G= DEMAND(MARKET);

 

In general, speed can often be helped by using tuples, subsets or conditionals to reduce attention only to relevant equations.