Dynamic Programming & the Bellman Equation

A plan that is optimal from today must stay optimal from every date it reaches. Richard Bellman turned that observation into an equation, and economics turned the equation into its standard tool for saving, stopping and investing over time.

Abstract

Bellman’s principle of optimality, set out at RAND in the early 1950s and in his 1957 book, says that what remains of an optimal plan must itself be optimal, which turns a choice among whole paths through time into a functional equation for the value function. Applied to consumption and saving, its first-order and envelope conditions yield the consumption Euler equation, and with power utility the household consumes a constant share of wealth, 3.92% a year for a discount factor of 0.96 and a 4% return when relative risk aversion is 2. Because the Bellman operator is a contraction (Blackwell, 1965), value-function iteration converges from any starting guess at the rate of the discount factor, and each iterate from zero is the solution with one more period to live. In stopping problems the equation produces a threshold: McCall’s (1970) reservation wage, Rust’s (1987) bus-engine replacement rule and the exercise boundary of an American put, which for a perpetual put Merton (1973) found at θ/(1+θ) of the strike, θ = 2r/σ². In continuous time it becomes the Hamilton–Jacobi–Bellman equation, from which Merton (1969, 1971) derived constant-proportion rules for both the portfolio and consumption. The curse of dimensionality and time-inconsistent preferences (Strotz, 1956; Laibson, 1997) mark its limits.

Richard Bellman spent the fall quarter of 1950 at the RAND Corporation, working on what he called multistage decision processes, and needed a name for them. In his autobiography, Eye of the Hurricane (1984), in a passage Stuart Dreyfus (2002) later reprinted, he explained the one he chose. “The 1950s were not good years for mathematical research,” he wrote. The Secretary of Defense, Charles Wilson, “had a pathological fear and hatred of the word, research,” and since RAND was employed by the Air Force, “I felt I had to do something to shield Wilson and the Air Force from the fact that I was really doing mathematics inside the RAND Corporation.”

He had wanted to describe planning, but “planning, is not a good word for various reasons,” so he settled on “programming,” and added “dynamic” because it had a precise meaning and because “it’s impossible to use the word, dynamic, in a pejorative sense.” It was, he wrote, “something not even a Congressman could object to.” The story has one difficulty. Wilson became Secretary of Defense on January 28, 1953, more than two years after the autumn Bellman describes, so the memory, set down three decades later, has compressed something.

Whatever the name’s origin, the method it named is the one modern economics uses whenever a decision today changes the situation in which tomorrow’s decision is made. A household that saves this year has more wealth next year, and an option holder who does not exercise today keeps the right to exercise tomorrow. Bellman’s contribution was to show that such problems, which look like a choice among entire paths through time, can be solved one date at a time, provided the value of arriving in each possible situation is known.

The principle of optimality

Bellman published the idea in the Proceedings of the National Academy of Sciences in 1952 and set it out fully in Dynamic Programming, published by Princeton University Press in 1957 as a RAND research study. Its foundation is a single sentence, which he called the principle of optimality: “An optimal policy has the property that whatever the initial state and initial decision are, the remaining decisions must constitute an optimal policy with regard to the state resulting from the first decision.”

The principle reduces a problem in many unknowns to a recursion. Describe the decision maker’s situation at each date by a state \(x\), such as wealth or a stock price, and let the decision be \(a\). The best attainable value from state \(x\), the value function, must equal the best available combination of what the decision yields now and the discounted value of the state it leads to, since whatever is done after that is, by the principle, itself optimal.

\[V(x) \;=\; \max_{a \in \Gamma(x)} \Big\{\, u(x,a) \;+\; \beta\, \mathbb{E}\big[\,V(x') \,\big|\, x, a\,\big] \Big\}\]

\(V(x)\)
the value function: the best expected discounted payoff attainable from state x
\(x'\)
next period’s state, which may be random and depends on the current state and decision
\(a\)
the decision taken this period
\(\Gamma(x)\)
the set of decisions feasible in state x, such as consumption no greater than wealth
\(u(x,a)\)
the payoff this period, such as the utility of consumption
\(\beta\)
the discount factor, between 0 and 1

The equation is a functional equation: the unknown is the whole function \(V\), which appears on both sides. Its solution delivers a second object of equal interest, the policy function \(a = g(x)\), which says what to do in every state. With a known final date, the recursion runs backward. The value at the last date is the payoff of acting optimally once; the value one date earlier follows from it, and so on to the present. The binomial option model values an American option this way, and the hedging demands of the intertemporal CAPM are computed by the same backward pass.

Economics took the method up within a few years. Martin Beckmann and Richard Muth applied a Bellman equation to inventory theory in a 1954 Cowles Commission paper. Paul Samuelson’s 1969 paper on lifetime portfolio choice carried the words “dynamic stochastic programming” in its title. Nancy Stokey and Robert Lucas, with Edward Prescott, gave the field its standard treatment in Recursive Methods in Economic Dynamics (1989), which established, for the problems economists meet, when a value function exists, when it is unique and what properties it inherits from the payoffs.

Eating a cake

The simplest economic application, often called the cake-eating problem, is a household with wealth \(W\) and nothing else. Each year it consumes \(c\), and what it does not consume earns a gross return \(R\). The state is wealth, the decision is consumption, and the Bellman equation reads

\[V(W) \;=\; \max_{0 < c < W}\; \Big\{\, u(c) \;+\; \beta\, V\big(R\,(W - c)\big) \Big\}, \qquad u(c) = \frac{c^{1-\gamma}}{1-\gamma}\]

\(W\)
wealth at the start of the year
\(c\)
consumption this year
\(R\)
the gross return on wealth saved, 1 plus the interest rate
\(\gamma\)
relative risk aversion, which here also governs the willingness to substitute consumption across years; \(\gamma = 1\) is logarithmic utility

Two conditions characterize the solution. The first-order condition sets the marginal utility of consuming a dollar now equal to the discounted marginal value of saving it, \(u'(c) = \beta R\, V'(W')\). The envelope condition, made rigorous for problems of this kind by Lawrence Benveniste and José Scheinkman (1979), says that the marginal value of wealth equals the marginal utility of consuming it, \(V'(W) = u'(c)\), because a dollar of extra wealth can be consumed at the margin with no change to the rest of the plan. Combining the two, one period apart, eliminates the unknown value function.

\[u'(c_t) \;=\; \beta R\, u'(c_{t+1}) \qquad\Longrightarrow\qquad \frac{c_{t+1}}{c_t} \;=\; (\beta R)^{1/\gamma}\]

This is the consumption Euler equation, the condition on which the life-cycle and permanent-income hypotheses are built and which the consumption CAPM tests against asset returns; those lessons take it from here. Its derivation from the Bellman equation shows where it comes from: it is the principle of optimality applied to a single dollar moved between adjacent years.

With power utility the problem has a closed form. Because doubling wealth doubles every feasible consumption path, the policy must be a constant share of wealth, \(c = \kappa W\), and substituting a guess \(V(W) = B\,W^{1-\gamma}/(1-\gamma)\) into the Bellman equation verifies it and determines both constants.

\[\kappa \;=\; 1 - \big(\beta R^{1-\gamma}\big)^{1/\gamma}, \qquad V(W) \;=\; \kappa^{-\gamma}\, \frac{W^{1-\gamma}}{1-\gamma}\]

A household with $1 million, a discount factor of 0.96 and a return of 4% shows what the formula implies.

  1. Logarithmic utility, \(\gamma = 1\) \[\kappa = 1 - \beta = 0.04 \;\Rightarrow\; c = \$40{,}000 \text{ whatever the return}\]
  2. Power utility, \(\gamma = 2\) \[\kappa = 1 - (0.96/1.04)^{1/2} = 1 - 0.96077 = 3.92\% \;\Rightarrow\; c = \$39{,}231\]
  3. Wealth a year later, \(\gamma = 2\) \[W' = 1.04 \times (\$1{,}000{,}000 - \$39{,}231) = \$999{,}200\]
  4. The Euler equation checks \[c_{t+1}/c_t = (0.96 \times 1.04)^{1/2} = 0.9992 = W'/W\]

The logarithmic case is worth noting. A higher return makes saving more rewarding, which argues for consuming less, and makes the household richer, which argues for consuming more; with \(\gamma = 1\) the two effects cancel exactly, and consumption is \((1-\beta)W\) at any interest rate. With \(\gamma > 1\) the wealth effect dominates and a higher return raises consumption. Here \(\beta R = 0.9984\), just below 1, and the household lets its consumption drift down by 0.08% a year.

Iterating to a fixed point

Most problems have no closed form, and the Bellman equation must be solved numerically. Write its right-hand side as an operator \(T\) that takes any candidate value function \(V\) and returns a new one, \((TV)(x) = \max_a \{u(x,a) + \beta\,\mathbb{E}[V(x')]\}\). The true value function is a fixed point, \(V = TV\). Value-function iteration starts from any guess \(V_0\) and applies \(T\) repeatedly.

The procedure works because \(T\) is a contraction. David Blackwell (1965) gave two conditions that suffice for bounded payoffs, both easy to check in economic problems. The operator must be monotone, so that a higher continuation value never lowers today’s value, and it must discount, so that adding a constant to the continuation value raises today’s value by only \(\beta\) times that constant. Under these conditions

\[\big\| TV - TW \big\| \;\le\; \beta\, \big\| V - W \big\|, \qquad \big\| V_n - V \big\| \;\le\; \beta^{\,n}\, \big\| V_0 - V \big\|\]

\(\| \cdot \|\)
the largest absolute difference between two functions over all states
\(V_n\)
the value function after n applications of the operator T

Banach’s fixed-point theorem then guarantees that the fixed point exists, that it is unique, and that iteration converges to it from any starting point at the geometric rate \(\beta\). The rate is also a cost. With \(\beta = 0.96\), reducing the initial error by a factor of a million takes \(\ln 10^{-6}/\ln 0.96 \approx 338\) iterations, and the more patient the decision maker, the slower the convergence.

The iterates have an economic meaning of their own. Starting from \(V_0 = 0\), the first iterate \(V_1\) is the value of consuming everything at once, the best a household can do with one year to live. \(V_2\) is the value with two years, and in general \(V_n\) solves the problem of a household with \(n\) years left. Value-function iteration from zero is backward induction on a lengthening horizon, and its convergence says that a long finite life and an infinite one call for nearly the same behavior. In the cake-eating problem the share consumed with \(n\) years left is \(\kappa / [1 - (1-\kappa)^n]\), which is 100% with one year, about half with two, and approaches \(\kappa\) as \(n\) grows.

Figure: Value-function iteration on the cake-eating problem. The household of the worked example, solved numerically from a starting guess of zero. The left panel draws the value function after each iteration, converging to the dashed fixed point; the right shows the share of wealth consumed at each iteration, which is the share a household would consume with that many years left, approaching the infinite-horizon rule.

(Power utility is unbounded, so Blackwell’s theorem does not apply to it directly. Under power utility the gap to the fixed point shrinks by \((\beta R^{1-\gamma})^{1/\gamma}\) per iteration rather than \(\beta\); the two coincide under logarithmic utility. The figure reports the factor that applies.)

When to stop

Many decisions consist of a single irreversible act whose only question is timing, such as accepting a job or exercising an option. In such an optimal stopping problem the decision maker in state \(x\) either stops and collects \(G(x)\) or continues, and the Bellman equation compares the two.

\[V(x) \;=\; \max\Big\{\, G(x) \,,\;\; \beta\, \mathbb{E}\big[\,V(x') \,\big|\, x\,\big] \Big\}\]

\(G(x)\)
the payoff from stopping in state x
\(\beta\, \mathbb{E}[V(x') \mid x]\)
the value of continuing: waiting one period and then behaving optimally

The solution typically divides the states into a region where stopping is optimal and a region where waiting is, separated by a threshold. John McCall’s (1970) model of job search is the economic prototype. A worker receives one wage offer a period from a known distribution and can accept it, keeping that wage for good, or reject it and draw again next period. McCall showed that “the optimal policy for the job searcher is to reject all offers below a single critical number,” now called the reservation wage. Waiting has value because a better offer may come, and the reservation wage is set where an offer in hand is worth exactly as much as the option to keep looking. The same comparison sets the investment trigger in real options, where McDonald and Siegel found that waiting could be optimal until a project was worth twice its cost.

The American put is the cleanest case in finance. Its holder can sell a share at the strike \(K\) on any date until expiration, so \(G(S) = K - S\) and, under the risk-neutral pricing of the binomial model, the continuation value is the discounted risk-neutral expectation of tomorrow’s put. Exercising early delivers the strike now, where it earns interest, and gives up the chance that the stock falls further. The trade-off produces an exercise boundary \(S^*(t)\): the put should be exercised the first time the stock falls to it. For a put that never expires, Robert Merton (1973) solved the problem in closed form.

\[S^{*}_{\infty} \;=\; \frac{\theta}{1+\theta}\,K, \qquad \theta = \frac{2r}{\sigma^{2}}\]

\(S^{*}_{\infty}\)
the stock price at or below which a perpetual put should be exercised
\(K\)
the strike price
\(r\)
the risk-free interest rate
\(\sigma\)
the volatility of the stock’s return

With \(r = 5\%\) and \(\sigma = 30\%\), \(\theta = 1.11\) and the perpetual put is exercised when the stock reaches 52.6% of the strike. Higher interest rates raise the boundary, since the strike collected early earns more; higher volatility lowers it, since a more volatile stock makes waiting worth more. A put with a finite life has no closed form, and its boundary, computed by backward induction, rises toward the strike as expiration approaches.

Figure: The exercise boundary of an American put. An American put with a strike of $100, valued by solving the stopping problem backward on a fine grid. On the left, the shaded region below the boundary is where exercising beats waiting; one simulated price path shows the rule at work. On the right, the put’s value today against the stock price: the American value meets the exercise value tangentially at the boundary and lies above the European value everywhere.

John Rust (1987) turned the logic around and used a stopping model to explain a real decision maker. Harold Zurcher, superintendent of maintenance at the Madison Metropolitan Bus Company in Wisconsin, decided each month whether to replace the engine of each bus, trading the cost of a new engine against rising maintenance costs and the risk of a breakdown. With ten years of monthly mileage and replacement data for 104 buses, Rust estimated the costs that would make Zurcher’s decisions the solution of a stochastic dynamic program, and tested whether his behavior was consistent with it. His method of solving the Bellman equation inside each step of a likelihood search, the nested fixed-point algorithm, is widely used to estimate dynamic models of choice.

Continuous time: Merton’s problem

In 1969 Robert Merton, then a graduate student at MIT, posed the lifetime problem of an investor who consumes continuously out of wealth and divides the rest, at every instant, between a riskless asset earning \(r\) and a stock following geometric Brownian motion with expected return \(\mu\) and volatility \(\sigma\). Wealth evolves as

\[dW \;=\; \big[\, rW + w\,(\mu - r)\,W - c \,\big]\,dt \;+\; w\,\sigma W\, dZ\]

where \(w\) is the share in the stock and \(dZ\) the increment of a Brownian motion. Merton solved it, as he put it in the 1971 sequel, with “the technique of stochastic dynamic programming.” Apply the Bellman equation over a short interval \(dt\), with discounting at the rate \(\rho\), and expand the value of next instant’s wealth using Itô’s lemma. The terms of order \(dt\) give the Hamilton–Jacobi–Bellman equation, the continuous-time Bellman equation.

\[\rho\, J(W) \;=\; \max_{c,\,w}\; \Big\{\, u(c) \;+\; J'(W)\big[\, rW + w(\mu - r)W - c \,\big] \;+\; \tfrac{1}{2}\, J''(W)\, w^{2}\sigma^{2}W^{2} \Big\}\]

\(J(W)\)
the value function of an investor with wealth W and an infinite horizon
\(\rho\)
the rate of time preference, the continuous-time counterpart of the discount factor
\(\mu - r\)
the stock’s expected return in excess of the riskless rate
\(w\)
the share of wealth held in the stock
\(c\)
the rate of consumption

The equation weighs the utility of consuming now against the expected drift in the value of wealth, \(J'\) times the expected change, and a penalty for its variance, \(J''\) times the variance, negative because \(J\) is concave. Maximizing term by term gives the two rules. Consumption satisfies \(u'(c) = J'(W)\), the envelope condition again. The stock share is \(w = -\,J'(\mu - r)/(J''\sigma^2 W)\), which with power utility, where \(-WJ''/J' = \gamma\), becomes the constant \((\mu - r)/(\gamma\sigma^2)\) derived in expected utility. Guessing \(J\) proportional to \(W^{1-\gamma}\) and substituting determines the rest.

\[\frac{c^{*}}{W} \;=\; \nu \;=\; \frac{1}{\gamma}\Big[\,\rho \;-\; (1-\gamma)\Big(r + \frac{(\mu - r)^2}{2\gamma\sigma^{2}}\Big)\Big]\]

Both rules are constant proportions of wealth, independent of how rich the investor is and of the date. An investor with \(\gamma = 3\), \(\rho = 3\%\), \(r = 2\%\), an expected excess return of 5% and volatility of 18% follows them as below.

  1. Stock share \[w^{*} = \frac{0.05}{3 \times 0.18^{2}} = 51.4\%\]
  2. The opportunity term \[r + \frac{(\mu - r)^2}{2\gamma\sigma^2} = 0.02 + \frac{0.0025}{6 \times 0.0324} = 0.0329\]
  3. Consumption rate \[\nu = \tfrac{1}{3}\big[\,0.03 + 2 \times 0.0329\,\big] = 3.19\% \text{ of wealth a year}\]

The opportunity term is the certainty-equivalent return on the optimal portfolio, \(r + w^{*}(\mu - r) - \tfrac{1}{2}\gamma w^{*2}\sigma^{2}\), and it enters consumption in the same way the return entered the cake-eating rule. With \(\gamma = 1\) the opportunity term drops out and \(\nu = \rho\), the continuous-time version of consuming \((1-\beta)W\): the logarithmic investor’s spending ignores investment opportunities entirely, and his portfolio is the growth-maximizing one of the Kelly criterion. Samuelson’s discrete-time paper, published in the same issue of the Review of Economics and Statistics, reached the same conclusion about the portfolio: the share does not depend on age.

Merton’s 1971 paper in the Journal of Economic Theory extended the solution to the family of utility functions with hyperbolic absolute risk aversion and proved a mutual-fund separation theorem, and his 1973 model let the investment opportunities themselves vary, which adds hedging demands to the portfolio and is the subject of the intertemporal CAPM. The constant proportions hold only under the assumptions that produced them, and the case for shares that change with age, which turns on labor income, is taken up in lifecycle portfolio choice.

What the method does not settle

The first limit is computational. A value function must be stored for every state, and the number of states grows exponentially with the number of variables that describe them: a grid of 100 points in each of five state variables has ten billion points. The name it still goes by, the curse of dimensionality, appears in the preface to Bellman’s 1957 book. Rust (1997) proved that randomized versions of value-function iteration break it for one subclass of problems, discrete decision processes, in which the choice is among a finite set of alternatives, but realistic household models with several assets, labor income, housing and taxes remain expensive, and are often solved only after the state has been simplified in ways that shape the answers.

The second limit is that the recursion presumes the decision maker will carry out tomorrow the plan chosen today. With exponential discounting the plan made at any date is the one every later self would choose. Robert Strotz (1956) showed that with other discount functions this fails, and that “the optimal plan of the present moment is generally one which will not be obeyed.” David Laibson (1997) built a model of saving on hyperbolic discounting, in which the household is a sequence of selves playing a game against one another and the principle of optimality no longer delivers a single Bellman equation. Whether actual households are better described by the time-consistent model or the inconsistent one is an empirical question the method itself cannot answer.

The third is the distance between a rule that is optimal and a rule that is followed. Rust’s bus engines and the tests of the Euler equation in the life-cycle literature ask whether behavior looks as if it solved a Bellman equation, and a model that fits can always be made to fit by its choice of preferences and beliefs. Dynamic programming states what a decision maker with given objectives and given beliefs should do; what objectives and beliefs people actually hold is a separate question, and the equation is only as informative as the answer to it.

Sources

  1. Bellman, R. (1952). On the Theory of Dynamic Programming. Proceedings of the National Academy of Sciences 38, 716–719.
  2. Beckmann, M., and R. Muth (1954). On the Solution to the “Fundamental Equation” of Inventory Theory. Cowles Commission Discussion Paper 2116.
  3. Strotz, R. H. (1956). Myopia and Inconsistency in Dynamic Utility Maximization. Review of Economic Studies 23(3), 165–180.
  4. Bellman, R. (1957). Dynamic Programming. Princeton University Press (a RAND Corporation research study).
  5. Blackwell, D. (1965). Discounted Dynamic Programming. Annals of Mathematical Statistics 36(1), 226–235.
  6. Samuelson, P. A. (1969). Lifetime Portfolio Selection by Dynamic Stochastic Programming. Review of Economics and Statistics 51(3), 239–246.
  7. Merton, R. C. (1969). Lifetime Portfolio Selection under Uncertainty: The Continuous-Time Case. Review of Economics and Statistics 51(3), 247–257.
  8. McCall, J. J. (1970). Economics of Information and Job Search. Quarterly Journal of Economics 84(1), 113–126.
  9. Merton, R. C. (1971). Optimum Consumption and Portfolio Rules in a Continuous-Time Model. Journal of Economic Theory 3(4), 373–413.
  10. Merton, R. C. (1973). Theory of Rational Option Pricing. Bell Journal of Economics and Management Science 4(1), 141–183.
  11. Merton, R. C. (1973). An Intertemporal Capital Asset Pricing Model. Econometrica 41(5), 867–887.
  12. Benveniste, L. M., and J. A. Scheinkman (1979). On the Differentiability of the Value Function in Dynamic Models of Economics. Econometrica 47(3), 727–732.
  13. Bellman, R. (1984). Eye of the Hurricane: An Autobiography. World Scientific.
  14. Rust, J. (1987). Optimal Replacement of GMC Bus Engines: An Empirical Model of Harold Zurcher. Econometrica 55(5), 999–1033.
  15. Stokey, N. L., and R. E. Lucas Jr., with E. C. Prescott (1989). Recursive Methods in Economic Dynamics. Harvard University Press.
  16. Rust, J. (1997). Using Randomization to Break the Curse of Dimensionality. Econometrica 65(3), 487–516.
  17. Laibson, D. (1997). Golden Eggs and Hyperbolic Discounting. Quarterly Journal of Economics 112(2), 443–478.
  18. Dreyfus, S. (2002). Richard Bellman on the Birth of Dynamic Programming. Operations Research 50(1), 48–51.