*XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX* $ontext This file is part of the teaching material of the International Agricultural Trade and Development Group of Humboldt-Universität zu Berlin on: -------------------------------------------------------------------------------- Introduction to Simulation Models in Market and Policy Analysis -------------------------------------------------------------------------------- * PE03 Exercise - A Market Equilibrium Model in GAMS Overview: VARIABLES PARAMETER EQUATIONS MODEL DEFINITION AND SOLVE *XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX* $offtext *XXXX VARIABLES XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX* * declare variables you want to use in your model Variables SUPPLY Supply (Mio t) DEMAND Demand (Mio t) NX Net exports (Mio t) PRICE Price (USD per t) ; *Start values for variables SUPPLY.L = 256; DEMAND.L = 180; NX.L = SUPPLY.L - DEMAND.L; PRICE.L = 400; *XXXX PARAMETER XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX* * declare parameters you want to use in your model. * you can assign values to them now or later. Parameters el_supply Price elasticity of supply el_dem Price elasticity of demand par_supply Supply parameter par_dem Demand parameter ; el_supply = 0.5; el_dem = -0.1; * Calibration of parameters par_supply = SUPPLY.L/PRICE.L**el_supply; par_dem = DEMAND.L/PRICE.L**el_dem; Display par_supply, par_dem; *XXXX EQUATIONS XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX* * declare and define equations you want to use in your model. * Declaration of equations Equations q_dem demand equation q_supply supply equation q_nx net export equation ; * Definition of equations q_dem.. DEMAND =E= par_dem * PRICE**el_dem ; q_supply.. SUPPLY =E= par_supply * PRICE**el_supply ; q_nx.. NX =E= SUPPLY - DEMAND; * Closures (to ensure a square model) *PRICE.fx=400; NX.fx=76; *XXXX MODEL DEFINITION AND SOLVE XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX* * define model: give a name and decide which equations should be part of it *MODEL market /q_dem, q_supply, q_nx/; MODEL market /all/; *solve the model and decide how it should be solved. *Solve market using MCP; SOLVE market maximizing price using nlp; *SOLVE market minimizing price using nlp;