From 5e8a36c15ec21d3ca1237776f4e18e5af6176e07 Mon Sep 17 00:00:00 2001 From: Chase Date: Mon, 6 Apr 2015 17:57:44 -0400 Subject: [PATCH] CC: Added Balint and Tom's oligopoly.py edits. --- examples/oligopoly.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/examples/oligopoly.py b/examples/oligopoly.py index 6994db4e2..74c97e40e 100644 --- a/examples/oligopoly.py +++ b/examples/oligopoly.py @@ -145,9 +145,28 @@ def solve_for_opt_policy(params, eta0=0., Q0=0., q0=0.): P, F, D0, Pf,Ff = solve_for_opt_policy(params) -# np.set_printoptions(precision=2) + +# Checking time-inconsistency: +A, B, Q, R, Rf = setup_matrices(params) +# arbitrary initial z_0 +y0 = np.array([[1, 1, 1, 1]]).T +# optimal x_0 = i_0 +i0 = np.dot(D0,y0) +# iterate one period using the closed-loop system +y1 = np.dot( A + np.dot(B,F) , np.vstack([y0, i0]) ) +# the last element of y_1 is x_1 = i_1 +i1_0 = y1[-1,0] + +# compare this to the case when the leader solves a Stackelberg problem +# in period 1. if in period 1 the leader could choose i1 given +# (1, v_1, Q_1, \bar{q}_1) +i1_1 = np.dot(D0, y1[0:-1,0]) + + print("P = {}".format(P)) print("-F = {}".format(F)) print("D0 = {}".format(D0)) print("Pf = {}".format(Pf)) print("-Ff = {}".format(Ff)) +print("i1_0 = {}".format(i1_0)) +print("i1_1 = {}".format(i1_1))