Expandability

Top  Previous  Next

Consider the newcontext.gms optimization example from just above.  That examples depicts production of three products from three resources.  One could add two new products and two new resources as follows (expand.gms)

 

SET       Products  Items produced by firm

              /Chairs  , Tables , Dressers, HeadBoards, Cabinets /

          Resources  Resources limiting firm production

              /RawWood , Labor  , WarehouseSpace , Hardware, ShopTime/;

PARAMETER Netreturns(products)  Net returns per unit produced

            /Chairs 19,Tables 50,Dressers 75,HeadBoards 28,Cabinets 25/

          Endowments(resources) Amount of each resource available

            /RawWood 700,Labor 1000,WarehouseSpace 240,Hardware 100, Shoptime 600/;

TABLE     Resourceusage(resources,products) Resource usage per unit produced

                          Chairs   Tables  Dressers HeadBoards Cabinets

          RawWood            8        20      32         22      15

          Labor             12        32      45         12      18

          WarehouseSpace     4        12      10          3       7

          Hardware           1         1       3          0       2

          Shoptime           6         8      30          5      12;

POSITIVE VARIABLES   Production(products) Number of units produced;

VARIABLES            Profit               Total fir summed net returns ;

EQUATIONS            ProfitAcct           Profit accounting equation ,

                     Available(Resources) Resource availability limit;

 ProfitAcct..

      PROFIT

      =E= SUM(products,netreturns(products)*production(products)) ;

 available(resources)..

      SUM(products,

          resourceusage(resources,products) *production(products))

      =L= endowments(resources);

MODEL RESALLOC /ALL/;

SOLVE RESALLOC USING LP MAXIMIZING PROFIT;

 

where only the material in black was added with no alterations of that in red relative to the newcontext.gms example.  So what?  The algebraic structure once built did not need to be altered and GAMS models can easily be expanded from smaller to larger data sets.  Such capabilities constitute a major GAMS model development strategy. One can originally develop a model with a small data set and fully debug it.  Then later one can move to the full problem data set without having to alter any of the algebraic structure but have confidence in the algebraic structure.  This is discussed further in the Small to Large: Aid in Development and Debugging chapter.