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.

Notes<br />

Table intercepts(curvetype,commodities)<br />

corn wheat<br />

demand 4 8<br />

supply 1 2;<br />

table slopes(curvetype,commodities,commodities)<br />

corn wheat<br />

demand.corn -.3 -.1<br />

demand.wheat -.07 -.4<br />

supply.corn .5 .1<br />

supply.wheat .1 .3 ;<br />

Alignment is important. Each numerical entry must occur somewhere below one and only<br />

one column name in the Table.<br />

All elements that are not given explicit values or have blanks under them are implicitly<br />

assigned to equal zero.<br />

Items in tables must be defined with respect to at least 2 sets and can be defined over up<br />

to 10 sets. When more than two dimensional items are entered, as in the equilibrium<br />

example, periods(.) set off the element names<br />

set1elementname.set2elementname.set3elementname etc .<br />

Tables are a specific input entry format for the general GAMS parameter class of items<br />

that also encompasses scalars.<br />

More on tables appears in the Data Entry chapter.<br />

Direct assignment<br />

Data may also be entered through replacement or assignment statements. Such statements<br />

involve the use of a statement like<br />

parametername(setdependency) = expression;<br />

where the parameters on the left hand side must have been previously defined in a set, parameter<br />

or table statement.<br />

Examples<br />

(Caldata.gms)<br />

scalar a1;<br />

scalars a2 /11/;<br />

parameter cc(j) , bc(j) /j2 22/;<br />

a1=10;<br />

a2=5;<br />

cc(j)=bc(j)+10;<br />

cc("j1")=1;<br />

Courtesy of B.A. McCarl, October 2002 30

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

Saved successfully!

Ooh no, something went wrong!