Watch out for incomplete suppression

Top  Previous  Next

(trnssu.gms)

When I use conditionals to eliminate variables I must be careful to watch out for cases of incomplete elimination.  Variables may still be there that I thought were gone.  Below, I do not suppress zero transport cost cases in the bottom 2 equations and will end up with variables present that trivially allow demand satisfaction.

 

TCOST =E= SUM((PLANT,MARKET)$cost(plant,market)

, SHIPMENTS(PLANT,MARKET)*COST(PLANT,MARKET));

fsSUPPLYEQ(PLANT)$supply(plant)..

 SUM(MARKET, SHIPMENTS(PLANT, MARKET))=L=  SUPPLY(PLANT);

fsDEMANDEQ(MARKET)$demand(market)..

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

 

In general poor quality answers can be avoided if one is careful to suppress variables in a consistent fashion across all equations.