CMGCR
Lectures Readings Modeling software Models Links

Getting started with the General Algebraic Modeling System (GAMS) on DICE

Running GAMS


The easiest way to run netlogo on DICE is to use my installation:

# put GAMS directory on your path
export GAMS=/afs/inf.ed.ac.uk/user/n/ngoddard/public/cmgcr/gams

# make the gams executable accessible
export PATH=$GAMS:$PATH

# make a directory to work in and move to it
mkdir gams; cd gams

# copy in the getting-started models
cp $GAMS/models/*.gms .

You can put the first two lines in your ~/.bashrc file, or you can just type them to the prompt (in which case the gams executable will only be available as long as your terminal window is open).

Then you can run GAMS on a model just by typing "gams modelfile.gms" to the prompt.

You can also download GAMS from the GAMS website:


http://www.gams.com/download/

Getting started with GAMS models

There is a sequence of models used in class:

  1. The simple one-product market equilibrium model using a single equation and three equations. In this model, the supply function is given, the demand function is given, and these two functions are set to be equal at equlibrium price. Then this set of equations is solved for equilibrium price.

    Task.

    • Run the model with: gams mkteql.gms
    • Examine the output file mkteql.lst to see that it contains the equilibrium price.
    • Introduce a syntax error, rerun the model and examine the ouptut file.

    What do you think of the language? What do you think of the error reporting?

  2. The simple transportation problem (Dantzig, G B, Chapter 3.3. In Linear Programming and Extensions. Princeton University Press, Princeton, New Jersey, 1963). We consider as an example a simple transportation problem. In this problem we are given a set of production plants and a set of potential markets. Each plant has a given level of production, and each market has a known level of demand. The cost of shipping one unit of the product from the plants to the markets is also given.

    A simple, algebraic, statement of the problem is the following: Let i and j be indices for the plants and markets, respectively. Denot by s_i the supply of each plant, and by d_j the demand at each market. Let also x_ij denote the decision variables, indicating the amount supplied to market j by planti, and let c_ij denot the cost of shipping one unit from i to j. Then the following linear program determines the least-cost solution:


    Minimize Sum_i Sum_j c_ij*x_ij,
    such that Sum_j x_ij <= s_i, for all i,
    and Sum_i x_ij >= d_j, for all j.

    A complete, commented GAMS statement of this model is here.

    Task:

    • Run the model and examine the output file - one of the canning plants is at full capacity, the other is not.
    • Edit the model so that the other plant is going to be running at capacity (hint: what is being minimised?)
    • Run your edited model to verify you are correct.
  3. The same model, but with several scenarios (different equilibria) run, is here.

  4. A research model is here. This is a model of the world economy as described in the Stern report, but with different parameters. One thing it shows is how sensitive the model results are the the choice of the discount rate.

Other GAMS models

A large database of models is maintained at the GAMS site.


Home : Teaching : Courses : Cmgcr 

Informatics Forum, 10 Crichton Street, Edinburgh, EH8 9AB, Scotland, UK
Tel: +44 131 651 5661, Fax: +44 131 651 1426, E-mail: school-office@inf.ed.ac.uk
Please contact our webadmin with any comments or corrections. Logging and Cookies
Unless explicitly stated otherwise, all material is copyright © The University of Edinburgh