Top Banner
Mixed Complementarity Formulations of Stochastic Equilibrium Models with Recourse Thomas F. Rutherford Ann Arbor, MI Alex Meeraus GAMS Development Corporation, Washington DC GOR Workshop “Optimization under Uncertainty ” Bad Honnef, Germany, October 20-21, 2005
50

Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

Sep 20, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

Mixed Complementarity Formulations ofStochastic Equilibrium Models with Recourse

Thomas F. RutherfordAnn Arbor, MI

Alex MeerausGAMS Development Corporation, Washington DC

GOR Workshop “Optimization under Uncertainty ”Bad Honnef, Germany, October 20-21, 2005

Page 2: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

2

Page 3: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

3

Page 4: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

4

Page 5: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

5

Three illustrative models

• Lifecyle consumption-savings decisions with income uncertainty (finite horizon NLP)

• Ramsey growth model with uncertain technology change (infinite-horizon NLP)

• Growth model with anticipated tax policy and parameter uncertainty (infinite-horizon MCP)

Page 6: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

6

Programming Techniques

• Event tree management logic tool (probtree)• Tight formulations• Graphical tools for debugging (treeplot) and

reporting (fanplot)• Complementarity programming in a

stochastic framework

Page 7: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

7

Mixed ComplementarityProblem - MCP Definition

Page 8: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

8

Credits

• DMR School– Sherman Robinson, Jaime deMelo,Kemal Dervis

• MPSGE School– Tom Rutherford, Alan Manne

• MCP Solvers– MILES Tom Rutherford– PATH Michael Ferris, Stephen Dirkse, Todd Munson

Page 9: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

9

Lifecycle Model

• A lifecycle savings investment model in which there is income uncertainty maximizing the discounted expected utility

• Utility function: Logarithm of consumption• Version 1: Borrowing and savings• Version 2: Only savings

Page 10: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

Earnings Profiles in Four States of NatureLifecycle Consumption-Savings Model

10

20

40

50

60

70

80

90

100

30

K$ per year

20 40 60age

Page 11: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

Tree Plot of Lifecycle Probability Treegams treeplot

30pa

40pa

80pa

100pa

20 40 60

Page 12: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

12

Transition in GAMS

setst Time periods for a typical life-cycle (ages) /20*75/

sw States of world / 30pa peak earn 30K per year40pa peak earn 40K per year80pa peak earn 80K per year100pa peak earn 100K per year /

transition(t,sw,sw) State transitions /20.40pa. 30pa Learn at age 20 if you are going to college25.40pa. 80pa Learn at age 25 if you earn a PhD degree35.80pa.100pa Learn at age 35 that you are good at business /

parameter pi(sw) Subjective probability /30pa 0.3 40pa 0.480pa 0.2100pa 0.1 /

Page 13: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

Tree Plot of Lifecycle Probability Treegams treeplot --piscale=yes

30pa

40pa

80pa

100pa

20 40 60

Page 14: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

14

Data Structures for Stochastic Programming

sets eq(t,sw) Equilibrium structure: sw is active in tst(t,sw,sow) State transitions: sw transitions to sow in tsm(t,sw,sow) State matching: sw is represented by sow in tsp(t,sw) Preceding state of world

* Call Tom's probtree utility$batinclude probtree t sw transition eq st sm

loop(st(t,sow,sw), sp(t,sw) = ord(sw)-ord(sow));

b.lo(t,sw)=-inf; b.up(t,sw)=+inf; // Borrowing and savingb.fx(tlast,sw) = 0; // No debt or savings at the end

solve lcycle using nlp maximizing eu; // solve stoch. model

loop(sw, pi(sow)=0; pi(sw)=1; // Solve deterministic for swsolve lcycle using nlp maximizing eu );

Page 15: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

15

Live Runs - Lifecycle Model

Page 16: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

Consumption Profiles with BorrowingLifecycle Consumption-Savings Model

20

30

40

50

60

70

80

20 40 60

Page 17: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

Consumption Profiles with Liquidity ConstraintsLifecycle Consumption-Savings Model

20

30

40

50

60

70

80

90

100

20 40 60

Page 18: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

Asset Balances with BorrowingLifecycle Consumption-Savings Model

-700

-600

-500

-400

-300

-200

-100

0

100

20 40 60

Page 19: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

Asset Balances with Liquidity ConstraintsLifecycle Consumption-Savings Model

0

20

40

60

80

100

120

20 40 60

Page 20: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

20

Lessons Learned

1. Event tree representation via state transitions using probtree utility

2. Event tree visualization using treeplotutility.

3. Without hedging possibilities stochasticitycannot be exploited

4. Importance of visual presentation of input and output

Page 21: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

21

Classic Ramsey Model

• Ramsey Model with uncertain technology change• Infinite horizon model in which there is an uncertain

transition path to a deterministic horizon• Motivate formulations with and without non-

anticipativity constraints

• Ramsey, F P, A Mathematical Theory of Saving. Economics Journal (1928). Also see GAMS Model library www.gams.com/modlib/libhtml/ramsey.htm

Page 22: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

22

The Ramsey Model implicit algebra

Page 23: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

23

Data Structure for Stochastic Programming

sw

t

eq

Page 24: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

24

Data Structure for SP - cont.

st

sm

Page 25: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

25

Ramsey Model Conventional Explicit Syntax

Page 26: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

26

Ramsey ModelTight Formulation

Page 27: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

27

Recovery of Solutionfrom a tight Formulation

Page 28: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

Assumed Probability Distribution for Date of Technical Change

Ramsey Growth Model

0

0.01

0.02

0.03

0.04

0.05

0.06

0.07

0.08

0.09

0.1

2010 2020 2030 2040 2050

Page 29: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

Cumulative Probability Density Function

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

2020 2040 2060 2080 2100

Page 30: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

30

GAMS Code Building the Event Tree

set t Time periods in the model /2005*2100/sw States of world /2010*2030,never/transition(t,sw,sw) State transitions;

* Define the event tree by specifying which states* generate transitions. In this case 2010 defines the root* node of the tree.

transition("2010","2010","2011") = yes;loop((t,sw)$transition(t,sw,sw+1),transition(t+1,sw+1,sw+2) = yes);

pi(sw) = exp(-var*sqr(ord(sw)-card(sw)/2)); // Normal distribution

•Normalize:

pi("never") = 0; pi(sw) = 0.75*pi(sw)/sum(sow,pi(sow)); pi("never") = 1 - sum(sw,pi(sw));

Page 31: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

Stochastic StructureRamsey Growth Model

201020112012201320142015201620172018201920202021202220232024202520262027202820292030never

2020 2040 2060 2080 2100

Page 32: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

Stochastic StructureRamsey Growth Model (--piscale=yes)

20102011201220132014201520162017

2018

2019

2020

2021

2022

2023

2024202520262027202820292030

never

2020 2040 2060 2080 2100

Page 33: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

33

Live Runs – Ramsey Model

Page 34: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

InvestmentRamsey Growth Model

0.94

0.96

0.98

1

1.02

1.04

1.06

1.08

1.1

2010 2020 2030 2040 2050

Page 35: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

Rental Price of CapitalRamsey Growth Model

0.108

0.11

0.112

0.114

0.116

0.118

0.12

0.122

0.124

2010 2020 2030 2040 2050

Page 36: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

Equilibrium Wage RatesRamsey Growth Model

59

59.5

60

60.5

61

61.5

62

62.5

63

63.5

64

2010 2020 2030 2040 2050

Page 37: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

37

Lessons Learned

1. Two mathematically equivalent formulations: with and without non-anticipativity constraints (NAC). Tight formulation is preferred (no NAC) with easy recovery of solution of the explicit problem (using Tom‘s tools)

2. Construction of transition matrix3. Discretization of continuous distributions

Page 38: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

38

Enhanced Ramsey Model

• Complementarity problem based on the Ramsey model

• Features an ad-valorem tax on capital services, hence there is no corresponding optimization problem

• In this application the policy is deterministic - a capital tax is applied five years in the future.

Page 39: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

39

Enhanced Ramsey Model – cont.

• The uncertainty concerns a model parameter - the capital-labor elasticity of substitution.

• The investors in the model only know the probability distribution of this parameter, the true value of which will only be revealed after the policy shock.

• We use the model to characterize a rational-expectations forecast of the impact of the capital tax, taking into account hedging behavior which reflects uncertainty regarding model parameters.

Page 40: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

40

Stochastic Structures

set t Time periods in the model /2005*2060/sw States of world /s0*s10/transition(t,sw,sw) State transitions;

transition("2008","s0",sw) = yes;transition("2008","s0","s0") = no;

parameter pi(sw) Perceived probability;pi(sw) = 1/card(sw);

Page 41: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

Stochastic StructureCapital Tax Impacts with Structural Uncertainty

s0

s1

s2

s3

s4

s5

s6

s7

s8

s9

s10

2010 2020 2030 2040 2050

Page 42: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

42

Explicit MCP Formulation

Page 43: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

43

Formulation using MPSGE Sublanguage

$model:stc

$sectors:u(sw) ! Utilityy(t,sw)$eq(t,sw) ! Outputi(tp,sw)$(t(tp) and eq(tp,sw)) ! Investmentk(tp,sw)$(t(tp) and eq(tp,sw)) ! Capitalc(t,sw)$eq(t,sw) ! Consumption

...

$prod:y(t,sw)$eq(t,sw) s:sigma(sw)o:p(t,sw) q:y0i:pl(t,sw) q:l0i:rk(t,sw) q:rk0 a:ra t:tk(t)

Page 44: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

44

Live Runs Ramsey MCP Model

Page 45: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

InvestmentCapital Tax Impacts with Structural Uncertainty

0.6

0.62

0.64

0.66

0.68

0.7

0.72

0.74

0.76

0.78

0.8

2010 2020 2030 2040

Page 46: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

Wage ForecastCapital Tax Impacts with Structural Uncertainty

0.82

0.84

0.86

0.88

0.9

0.92

0.94

0.96

0.98

1

2010 2020 2030 2040

Page 47: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

Return to CapitalCapital Tax Impacts with Structural Uncertainty

0.8

0.85

0.9

0.95

1

1.05

1.1

2010 2020 2030 2040

Page 48: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

OutputCapital Tax Impacts with Structural Uncertainty

0.82

0.84

0.86

0.88

0.9

0.92

0.94

0.96

0.98

1

2010 2020 2030 2040

Page 49: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

49

Lessons Learned

1. Lessons learned from NLP models carry over to MCP formulation

2. Application specific sublanguage MPSGE naturally accommodates stochastic formulations

3. Fan diagrams allow effective presentation of large number of scenarios

Page 50: Mixed Complementarity Formulations of Stochastic ... · 30 GAMS Code Building the Event Tree set t Time periods in the model /2005*2100/ sw States of world /2010*2030,never/ transition(t,sw,sw)

50

Summary

• Tom, please add some more comments• The models will be available on

www.mpsge.org and the GAMS web site www.gams.com

• Reproducability• Consistent notation for optimization and

complementarity