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.

The optimization example is as follows<br />

Max<br />

s.<br />

t.<br />

109*<br />

X<br />

X<br />

X<br />

X<br />

corn<br />

corn<br />

corn<br />

corn<br />

+<br />

90*<br />

+ X<br />

_ 4*<br />

X<br />

X<br />

wheat<br />

X<br />

wheat<br />

wheat<br />

wheat<br />

+ 115*<br />

X<br />

+ X<br />

+ 8*<br />

X<br />

X<br />

Cotton<br />

Cotton<br />

Cotton<br />

Cotton<br />

≤100<br />

≤ 500<br />

≥ 0<br />

This is a special case of the general resource allocation problem that can be written as<br />

where<br />

Max<br />

s.<br />

t.<br />

∑<br />

j<br />

∑<br />

j<br />

C<br />

a<br />

X<br />

j<br />

ij<br />

j<br />

X<br />

X<br />

j<br />

j<br />

b<br />

i<br />

0<br />

for all i<br />

for all<br />

j = { corn wheat cotton }<br />

i = { land labor }<br />

xj = { Xcorn Xwheat Xcotton }<br />

cj = { 109 90 115 }<br />

aij = 1 1 1<br />

6 4 8<br />

bi = { 100 500 }’<br />

Such a model can be cast in GAMS as (optalgebra.gms)<br />

SET j /Corn,Wheat,Cotton/<br />

i /Land ,Labor/;<br />

PARAMETER<br />

c(j) / corn 109 ,wheat 90 ,cotton 115/<br />

b(i) /land 100 ,labor 500/;<br />

TABLE a(i,j)<br />

corn wheat cotton<br />

land 1 1 1<br />

labor 6 4 8 ;<br />

POSITIVE VARIABLES x(j);<br />

VARIABLES PROFIT ;<br />

EQUATIONS OBJective ,<br />

constraint(i) ;<br />

OBJective.. PROFIT=E= SUM(J,(c(J))*x(J)) ;<br />

constraint(i).. SUM(J,a(i,J) *x(J)) =L= b(i);<br />

MODEL RESALLOC /ALL/;<br />

SOLVE RESALLOC USING LP MAXIMIZING PROFIT;<br />

I will dissect the GAMS components after presenting the other example.<br />

Revised equilibrium example<br />

≤<br />

≥<br />

j<br />

( land)<br />

( labor)<br />

( nonnegativity)<br />

Courtesy of B.A. McCarl, October 2002 25

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

Saved successfully!

Ooh no, something went wrong!