GitHub

@@ -35,7 +35,8 @@ tags: [hide-output]

35353636

## Overview

373738-

This lecture can be viewed as an application of the {doc}`quantecon lecture <lqcontrol>`.

38+

This lecture can be viewed as an application of this {doc}`quantecon lecture <lqcontrol>` about linear quadratic control

39+

theory.

39404041

It formulates a discounted dynamic program for a firm that

4142

chooses a production schedule to balance

@@ -46,19 +47,19 @@ chooses a production schedule to balance

4647

In the tradition of a classic book by Holt, Modigliani, Muth, and

4748

Simon {cite}`Holt_Modigliani_Muth_Simon`, we simplify the

4849

firm’s problem by formulating it as a linear quadratic discounted

49-

dynamic programming problem of the type studied in this {doc}`quantecon <lqcontrol>`.

50+

dynamic programming problem of the type studied in this {doc}`quantecon lecture <lqcontrol>`.

50515152

Because its costs of production are increasing and quadratic in

52-

production, the firm wants to smooth production across time provided

53+

production, the firm holds inventories as a buffer stock in order to smooth production across time, provided

5354

that holding inventories is not too costly.

545555-

But the firm also prefers to sell out of existing inventories, a

56+

But the firm also wants to make its sales out of existing inventories, a

5657

preference that we represent by a cost that is quadratic in the

5758

difference between sales in a period and the firm’s beginning of period

5859

inventories.

596060-

We compute examples designed to indicate how the firm optimally chooses

61-

to smooth production and manage inventories while keeping inventories

61+

We compute examples designed to indicate how the firm optimally

62+

smooths production while keeping inventories

6263

close to sales.

63646465

To introduce components of the model, let

@@ -72,7 +73,7 @@ To introduce components of the model, let

7273

- $d(I_t, S_t) = d_1 I_t + d_2 (S_t - I_t)^2$, where

7374

$d_1>0, d_2 >0$, be a cost-of-holding-inventories function,

7475

consisting of two components:

75-

- a cost $d_1 t$ of carrying inventories, and

76+

- a cost $d_1 I_t$ of carrying inventories, and

7677

- a cost $d_2 (S_t - I_t)^2$ of having inventories deviate

7778

from sales

7879

- $p_t = a_0 - a_1 S_t + v_t$ be an inverse demand function for a

@@ -84,7 +85,7 @@ To introduce components of the model, let

8485

be the present value of the firm’s profits at

8586

time $0$

8687

- $I_{t+1} = I_t + Q_t - S_t$ be the law of motion of inventories

87-

- $z_{t+1} = A_{22} z_t + C_2 \epsilon_{t+1}$ be the law

88+

- $z_{t+1} = A_{22} z_t + C_2 \epsilon_{t+1}$ be a law

8889

of motion for an exogenous state vector $z_t$ that contains

8990

time $t$ information useful for predicting the demand shock

9091

$v_t$

@@ -133,17 +134,20 @@ appears in the firm’s one-period profit function)

133134

We can express the firm’s profit as a function of states and controls as

134135135136

$$

136-

\pi_t = - (x_t' R x_t + u_t' Q u_t + 2 u_t' H x_t )

137+

\pi_t = - (x_t' R x_t + u_t' Q u_t + 2 u_t' N x_t )

137138

$$

138139139-

To form the matrices $R, Q, H$, we note that the firm’s profits at

140+

To form the matrices $R, Q, N$ in an LQ dynamic programming problem, we note that the firm’s profits at

140141

time $t$ function can be expressed

141142142143

$$

144+

\begin{equation}

145+

\begin{split}

143146

\pi_{t} =&p_{t}S_{t}-c\left(Q_{t}\right)-d\left(I_{t},S_{t}\right) \\

144147

=&\left(a_{0}-a_{1}S_{t}+v_{t}\right)S_{t}-c_{1}Q_{t}-c_{2}Q_{t}^{2}-d_{1}I_{t}-d_{2}\left(S_{t}-I_{t}\right)^{2} \\

145148

=&a_{0}S_{t}-a_{1}S_{t}^{2}+Gz_{t}S_{t}-c_{1}Q_{t}-c_{2}Q_{t}^{2}-d_{1}I_{t}-d_{2}S_{t}^{2}-d_{2}I_{t}^{2}+2d_{2}S_{t}I_{t} \\

146-

=&-\left(\underset{x_{t}^{\prime}Rx_{t}}{\underbrace{d_{1}I_{t}+d_{2}I_{t}^{2}}}\underset{u_{t}^{\prime}Qu_{t}}{\underbrace{+a_{1}S_{t}^{2}+d_{2}S_{t}^{2}+c_{2}Q_{t}^{2}}}\underset{2u_{t}^{\prime}Hx_{t}}{\underbrace{-a_{0}S_{t}-Gz_{t}S_{t}+c_{1}Q_{t}-2d_{2}S_{t}I_{t}}}\right) \\

149+

=&-\left(\underset{x_{t}^{\prime}Rx_{t}}{\underbrace{d_{1}I_{t}+d_{2}I_{t}^{2}}}\underset{u_{t}^{\prime}Qu_{t}}{\underbrace{+a_{1}S_{t}^{2}+d_{2}S_{t}^{2}+c_{2}Q_{t}^{2}}}

150+

\underset{2u_{t}^{\prime}N x_{t}}{\underbrace{-a_{0}S_{t}-Gz_{t}S_{t}+c_{1}Q_{t}-2d_{2}S_{t}I_{t}}}\right) \\

147151

=&-\left(\left[\begin{array}{cc}

148152

I_{t} & z_{t}^{\prime}\end{array}\right]\underset{\equiv R}{\underbrace{\left[\begin{array}{cc}

149153

d_{2} & \frac{d_{1}}{2}S_{c}\\

@@ -166,12 +170,14 @@ Q_{t} & S_{t}\end{array}\right]\underset{\equiv N}{\underbrace{\left[\begin{arra

166170

I_{t}\\

167171

z_{t}

168172

\end{array}\right]\right)

173+

\end{split}

174+

\end{equation}

169175

$$

170176171177

where $S_{c}=\left[1,0\right]$.

172178173179

**Remark on notation:** The notation for cross product term in the

174-

QuantEcon library is $N$ instead of $H$.

180+

QuantEcon library is $N$.

175181176182

The firms’ optimum decision rule takes the form

177183

@@ -185,6 +191,16 @@ $$

185191

x_{t+1} = (A - BF ) x_t + C \epsilon_{t+1}

186192

$$

187193194+

The firm chooses a decision rule for $u_t$ that maximizes

195+196+

$$

197+

E_0 \sum_{t=0}^\infty \beta^t \pi_t

198+

$$

199+200+

subject to a given $x_0$.

201+202+

This is a stochastic discounted LQ dynamic program.

203+188204

Here is code for computing an optimal decision rule and for analyzing

189205

its consequences.

190206

@@ -330,7 +346,7 @@ class SmoothingExample:

330346

Notice that the above code sets parameters at the following default

331347

values

332348333-

- discount factor β=0.96,

349+

- discount factor $\beta=0.96$,

334350

- inverse demand function: $a0=10, a1=1$

335351

- cost of production $c1=1, c2=1$

336352

- costs of holding inventories $d1=1, d2=1$

@@ -465,7 +481,7 @@ We introduce this $I_t$ **is hardwired to zero** specification in

465481

order to shed light on the role that inventories play by comparing outcomes

466482

with those under our two other versions of the problem.

467483468-

The bottom right panel displays an production path for the original

484+

The bottom right panel displays a production path for the original

469485

problem that we are interested in (the blue line) as well with an

470486

optimal production path for the model in which inventories are not

471487

useful (the green path) and also for the model in which, although

Read the original on github.com ↗