27.10.2013 Views

Quick start - Gams

Quick start - Gams

Quick start - Gams

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

most modelers use when employing GAMS modeling. Namely, GAMS exercises are usually<br />

supported by small hand formulations that capture problem essence and serve as an aid in GAMS<br />

model formulation.<br />

Context changes<br />

Consider the optimization example from above (goodoptalgebra.gms) which involved a farming<br />

example. This can be rewritten to another context as follows (newcontext.gms)<br />

SET Products Items produced by firm<br />

/Chairs , Tables , Dressers /<br />

Resources Resources limiting firm production<br />

/RawWood , Labor , WarehouseSpace/;<br />

PARAMETER Netreturns(products) Net returns per unit produced<br />

/Chairs 19 , Tables 50, Dressers 75/<br />

Endowments(resources) Amount of each resource available<br />

/RawWood 700 , Labor 1000 , WarehouseSpace 240/;<br />

TABLE Resourceusage(resources,products) Resource usage per unit produced<br />

Chairs Tables Dressers<br />

RawWood 8 20 32<br />

Labor 12 32 45<br />

WarehouseSpace 4 12 10 ;<br />

POSITIVE VARIABLES Production(products) Number of units produced;<br />

VARIABLES Profit Total fir summed net returns ;<br />

EQUATIONS ProfitAcct Profit accounting equation ,<br />

Available(Resources) Resource availability limit;<br />

ProfitAcct..<br />

PROFIT<br />

=E= SUM(products,netreturns(products)*production(products)) ;<br />

available(resources)..<br />

SUM(products,<br />

resourceusage(resources,products) *production(products))<br />

=L= endowments(resources);<br />

MODEL RESALLOC /ALL/;<br />

SOLVE RESALLOC USING LP MAXIMIZING PROFIT;<br />

where only the lines in black changed not those in red relative to the farming example. So what?<br />

The algebraic structure once built did not need to be altered and GAMS models can easily be<br />

changed from one context to another.<br />

Expandability<br />

Consider the newcontext.gms optimization example from just above that made three products<br />

from three resources. Two new products and two new resources can be added as follows<br />

(expand.gms)<br />

SET Products Items produced by firm<br />

/Chairs , Tables , Dressers, HeadBoards, Cabinets /<br />

Resources Resources limiting firm production<br />

/RawWood , Labor , WarehouseSpace , Hardware, ShopTime/;<br />

PARAMETER Netreturns(products) Net returns per unit produced<br />

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

Endowments(resources) Amount of each resource available<br />

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

TABLE Resourceusage(resources,products) Resource usage per unit produced<br />

Chairs Tables Dressers HeadBoards Cabinets<br />

RawWood 8 20 32 22 15<br />

Labor 12 32 45 12 18<br />

WarehouseSpace 4 12 10 3 7<br />

Hardware 1 1 3 0 2<br />

Courtesy of B.A. McCarl, October 2002 42

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!