27.10.2013 Views

Quick start - Gams

Quick start - Gams

Quick start - Gams

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Report writing<br />

Corn Wheat Available Value<br />

Land .Total 100.0000<br />

Land .Use by 50.0000 50.0000<br />

Land .Marginal 52.0000<br />

Labor.Total 500.0000<br />

Labor.Use by 300.0000 200.0000<br />

Labor.Marginal 9.5000<br />

GAMS permits one to do calculations using solution information to improve the information<br />

content of the output. This exercise is commonly called report writing. Information relative to<br />

the variable, equation and model solution is passed to GAMS from solvers. These data can be<br />

used in report writing computations.<br />

In GAMS the solution level for a variable is Variablename.L while it is Equationname.L for an<br />

equation. The dual or shadow price information for an equation is addressed as Equationname.M<br />

and the reduced cost for a variable is Equationname.M. The numerical values of these<br />

parameters are generally undefined until a solve is performed and retains the value from the most<br />

recent solve from then on. In the algebraic version of the equilibrium model (econequilalg.gms)<br />

I introduce the following report writing sequence<br />

set qitem /Demand, Supply, "Market Clearing"/;<br />

set item /Quantity,Price/<br />

parameter myreport(qitem,item,commodities);<br />

myreport("Demand","Quantity",commodities)= Qd.l(commodities);<br />

myreport("Supply","Quantity",commodities)= Qs.l(commodities);<br />

myreport("Market Clearing","Price",commodities)= p.l(commodities);<br />

display myreport;<br />

which saves the supply and demand quantities along with the market clearing price. The<br />

resultant report is generated with a display statement and is<br />

---- 39 PARAMETER myreport<br />

Corn Wheat<br />

Supply .Quantity 1.711 8.156<br />

Demand .Quantity 1.711 8.156<br />

Market Clearing.Price 2.671 4.618<br />

where I have color coded the originating statements and resultant output.<br />

A report writing sequence is also introduced into the optimization example (goodoptalgebra.gms)<br />

as follows<br />

set item /Total,"Use by",Marginal/;<br />

set qitem /Available,Corn,Wheat,Cotton,Value/;<br />

parameter Thisreport(resources,item,qitem) Report on resources;<br />

Thisreport(resources,"Total","Available")=endowments(resources);<br />

Thisreport(resources,"Use by",qitem)=<br />

sum(products$sameas(products,qitem),<br />

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

Courtesy of B.A. McCarl, October 2002 40

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

Saved successfully!

Ooh no, something went wrong!