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.

Ease of use with NLP, MIP, CGE and other problem forms............................................... 47<br />

Interface with other packages.............................................................................................. 47<br />

Alphabetic list of features ........................................................................................................ 47<br />

Basic models<br />

In my GAMS short courses I have discovered users approach modeling with at least three<br />

different orientations. These involve users who wish to<br />

Solve objective function oriented constrained optimization problems.<br />

Solve economically based general equilibrium problems.<br />

Solve engineering based nonlinear systems of equations.<br />

In this tutorial I will use three base examples, one from each case hopefully allowing access to<br />

more than one class of user.<br />

Solving an optimization problem<br />

Many optimization problem forms exist. The simplest of these is the Linear Programming or LP<br />

problem. Suppose I wish to solve the optimization problem<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 />

( land)<br />

( labor)<br />

( nonnegativity)<br />

where this is a farm profit maximization problem with three decision variables: Xcorn is the land<br />

area devoted to corn production, Xwheat is the land area devoted to wheat production and Xcotton is<br />

the land area devoted to cotton production. The first equation gives an expression for total profit<br />

as a function of per acre contributions times the acreage allocated by crop and will be<br />

maximized. The second equation limits the choice of the decision variables to the land available<br />

and the third to the labor available. Finally, we only allow positive or zero acreage.<br />

The simplest GAMS formulation of this is (optimize.gms )<br />

VARIABLES Z;<br />

POSITIVE VARIABLES Xcorn , Xwheat , Xcotton;<br />

EQUATIONS OBJ, land , labor;<br />

OBJ.. Z =E= 109 * Xcorn + 90 * Xwheat + 115 * Xcotton;<br />

land.. Xcorn + Xwheat + Xcotton =L= 100;<br />

labor.. 6*Xcorn + 4 * Xwheat + 8 * Xcotton =L= 500;<br />

MODEL farmPROBLEM /ALL/;<br />

SOLVE PROBLEM USING LP MAXIMIZING Z;<br />

Below after introduction of the other two examples I will dissect this formulation explaining its<br />

Courtesy of B.A. McCarl, October 2002 3

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

Saved successfully!

Ooh no, something went wrong!