tutorialGAMS2009.pdf

(483 KB) Pobierz
EnvironmentalEconomicsandNaturalResourcesGroup
Hollandseweg1
6706KNWageningen,theNetherlands
READER
GAMSforenvironmentaleconomic
modelling
versionApril2009
RobDellink
withcontributionsby:JuanCarlosAltamiranoCabrera,KellydeBruin,EkkovanIerland,CarolPhua,
ArjanRuijs,ErikSchmieman,JuditSzõnyi,FrankVöhringerandXueqinZhu
924640890.003.png 924640890.004.png 924640890.005.png 924640890.006.png 924640890.001.png 924640890.002.png
C ONTENTS
1.
Introduction .....................................................................................................................5
1.1.
Introduction .........................................................................................................5
1.2.
GAMS on the Internet .........................................................................................5
1.3.
GAMS at your home computer ...........................................................................6
1.4.
The “GAMS for environmental economic modelling” website ..........................6
2.
GAMS for environmental-economic modelling..............................................................7
2.1.
For what type of problems can GAMS be used?.................................................7
2.2.
Working with GAMS-IDE ..................................................................................7
2.3.
The general structure of GAMS programs ..........................................................9
2.4.
Scenarios and sensitivity analysis .....................................................................14
2.5.
General guidelines model analysis ....................................................................14
3. Learning exercises .........................................................................................................17
3.1. Introductory level ..............................................................................................17
3.2. Intermediate level ..............................................................................................22
3.3. Advanced level ..................................................................................................33
4. Modelling exercises.......................................................................................................39
4.1. Linear optimisation modelling ..........................................................................39
4.2. Partial equilibrium modelling............................................................................40
4.3. Game theoretic modelling .................................................................................42
4.4. Input-output modelling......................................................................................42
4.5. Computable general equilibrium modelling ......................................................43
4.6. Neo-classical growth modelling ........................................................................49
Appendix I: Common error messages in GAMS ..................................................................51
Appendix II: Solutions to the exercises.................................................................................57
II.1.
Results for Introductory level ............................................................................57
II.2.
Results for Intermediate level............................................................................61
II.3.
Results for Advanced level................................................................................68
II.4.
Results for Modelling exercises ........................................................................73
1
E XERCISES
Exercise 3.1.1. Starting GAMS-IDE ....................................................................................17
Exercise 3.1.2. The basic blocks of writing a model in the IDE ..........................................17
Exercise 3.1.3. Reading the process window .......................................................................18
Exercise 3.1.4. Reading the listing file.................................................................................18
Exercise 3.1.5. Debugging a compilation error ....................................................................20
Exercise 3.1.6. Debugging a logical error ............................................................................20
Exercise 3.1.7. Building a new model ..................................................................................20
Exercise 3.1.8. Understanding what you have done.............................................................21
Exercise 3.2.1. DISPLAY your results.................................................................................22
Exercise 3.2.2. Commenting out single lines .......................................................................22
Exercise 3.2.3. Using SCALARS.........................................................................................23
Exercise 3.2.4. Solving more than one model ......................................................................23
Exercise 3.2.5. Using multidimensional PARAMETERS ..................................................24
Exercise 3.2.6. SETS and vector specification.....................................................................24
Exercise 3.2.7. Summing over an index ...............................................................................25
Exercise 3.2.8. Including time: a dynamic specification......................................................25
Exercise 3.2.9. Using TABLES for data input .....................................................................26
Exercise 3.2.10. Defining POSITIVE VARIABLES ...........................................................27
Exercise 3.2.11. Providing starting values ...........................................................................27
Exercise 3.2.12. Providing lower and upper bounds ............................................................27
Exercise 3.2.13. Fixing variables .........................................................................................28
Exercise 3.2.14. Using the LOOP statement ........................................................................28
Exercise 3.2.15. Using conditional statements ($-operations) .............................................28
Exercise 3.2.16. Using lags and leads in parameters and variables......................................29
Exercise 3.2.17. Raising to a power .....................................................................................29
Exercise 3.2.18. Using ORD and CARD .............................................................................30
Exercise 3.2.19. Using a free variable..................................................................................30
Exercise 3.2.20. Mapping set elements (optional) ...............................................................31
Exercise 3.2.21. Exporting your results to Excel (optional).................................................32
Exercise 3.2.22. Understanding what you have done...........................................................32
Exercise 3.3.1. Specifying a dynamic optimisation model ..................................................33
Exercise 3.3.2. Making some more scenarios .....................................................................35
Exercise 3.3.3. Specifying a model for transboundary pollution (optional).........................35
Exercise 3.3.4. Investigating international co-operation (optional) .....................................36
Exercise 3.3.5. A basic systems model (optional)................................................................36
Exercise 3.3.6. Understanding what you have done.............................................................37
Exercise 4.1.1. A basic linear optimisation model ...............................................................39
Exercise 4.2.1. A basic partial equilibrium model ...............................................................40
Exercise 4.3.1. A model for stability of international climate negotiations .........................42
Exercise 4.4.1. A basic input-output model .........................................................................42
Exercise 4.4.2. An extended input-output model .................................................................43
Exercise 4.4.3. An input-output model with purification (optional) ....................................43
Exercise 4.5.1. A basic CGE model .....................................................................................44
Exercise 4.5.2. Interpretation of the CGE model .................................................................44
Exercise 4.5.3. CGE model with environmental issues........................................................45
Exercise 4.5.4. Specifying an open economy (optional) ......................................................46
Exercise 4.5.5. Specifying a multi-country model (optional) ..............................................47
Exercise 4.5.6. The Dinwiddy and Teal model (optional)....................................................48
Exercise 4.5.7. The basic CGE model in MPSGE (optional)...............................................49
Exercise 4.6.1. A basic growth model (a simplified DICE model) ......................................49
Exercise 4.6.2. An extended growth model (the DICE model)............................................50
2
P REFACE TO THIS VERSION
This is the 2006-version of the GAMS-reader that is available for self-study. Over the last
years, this GAMS reader has developed from an internal document just for students at
Wageningen University full of bugs, typos and unclarities, to a balanced self-study guide
for all kinds of users in Wageningen and around the world. The associated website (go to
http://www.enr.wur.nl/uk/ and click on ‘GAMS for environmental economic modelling’)
has proven it’s raison-d’être and gets a stable 200 – 300 hits per month, and over 50 percent
of those come from outside Europe.
The differences with the previous version (edition March 2004) are limited to editorial
changes. The basic concept of the reader is (still) that users do not need a background in
economics or environmental issues to be able to learn GAMS. Some basic knowledge of
economics and environmental economics is useful for the interpretation of the model
results, but this is not essential.
A CKNOWLEDGEMENTS
Many thanks to all colleagues at the Environmental Economics Group of Wageningen
University for numerous comments. Also thanks to all MSc students of the “Scenario
Studies and the Environment” and “Theories and Models in Environmental Economics”
courses, the PhDs that participated in the SENSE course “Introduction to environmental
economics” or in the CEEPA Training of trainers workshop, and all other users around the
world, who had to cope with an early, unpolished version of the reader. Thanks also to all
course coordinators who use this reader in their classes for their interest in our material.
Obviously, all responsibilities for errors remain with the authors.
I NSTRUCTOR S L IBRARY
There is an Instructor’s Library available for lecturers who want to use this reader in their
teaching. The Instructor’s Library contains the GAMS codes to all exercises. Interested
lecturers can contact Rob Dellink to obtain the Instructor’s Library. The Instructor’s Manual
as released with previous versions of the reader is no longer maintained.
For more information, see the “GAMS for environmental economic modelling” website on
the Internet homepage of the Environmental Economics Group at Wageningen University.
Go to http://www.enr.wur.nl/uk/ and click ‘GAMS for environmental economic modelling’.
3
Zgłoś jeśli naruszono regulamin