44.08.03 · optimization-control / 08-dynamic-programming

Markov Decision Processes and Stochastic Dynamic Programming

shipped3 tiersLean: none

Anchor (Master): Puterman 1994 Markov Decision Processes (Wiley) Ch. 5-6 (policy classes and history-dependence, the optimality of stationary deterministic policies, value/policy iteration, the linear-programming formulation, and modified policy iteration); Bertsekas 2017 Dynamic Programming and Optimal Control 4e (Athena Scientific) Vol. 2 Ch. 1-2 (operator-theoretic discounted MDPs and approximate DP); Sutton & Barto 2018 Reinforcement Learning 2e (MIT Press) Ch. 3-6 (the bridge to temporal-difference learning and Q-learning as stochastic approximation to the Bellman operators)

Intuition Beginner

The previous unit on endless decision problems assumed the world reacts to you in a fixed, known way: pick an action and you land in a definite next situation. Reality is rarely that obedient. A delivery drone that turns left might drift in the wind; a patient given a drug might or might not improve; a robot vacuum that bumps a wall might reroute or get stuck. The action you choose tilts the odds of what happens next, but it does not decide the outcome. A Markov decision process is the model for exactly this: deciding under chance.

The ingredients are a list of situations (states), a menu of choices in each situation (actions), a rule of chance saying how likely each next state is once you act, and a reward or cost for each choice. The chance rule has the memoryless feature from the earlier chains unit: where you go next depends only on where you are now and what you do now, not on the whole road behind you. That single property is what keeps the model honest and computable.

What you are looking for is a policy: a rule that tells you which action to take in each state. Because the setup looks the same forever and the future is discounted, the best policy is one fixed rule used every time, and it can be a plain rule with no dice of its own. The value of a state is the best expected discounted reward you can collect starting there.

The payoff mirrors the deterministic case. The value of a state equals the best, over actions, of the immediate reward plus the discounted average value of where you might land. You still find the values by repeating one update until they stop moving, and you still read the best policy off the settled values.

Visual Beginner

Picture a single state with two available actions. Each action is a fan of arrows: one arrow per possible next state, each arrow labeled with its chance, and the chances out of one action add to one. To score an action you add its immediate reward to the discounted average value over its fan, weighting each landing spot by its chance. You compare the two action scores and keep the better one. That better score becomes the state's updated value, and the action that won becomes the recommended choice there.

The only change from the deterministic version is the chance-weighted average inside each action's score. A deterministic problem is the special case where each action's fan has a single arrow of chance one. The discount factor, a number between and , shrinks the future the same way as before, so the values still settle, and faster when the discount is smaller.

ingredient what it is everyday picture
state the current situation which room the robot is in
action a choice available now which door to try
transition chance odds of each next state the door sometimes sticks
reward payoff for the choice time saved or battery spent

Worked example Beginner

A small machine is working or broken each day. When working, you may run it (reward today) or service it (reward today). Running a working machine leaves it working with chance and breaks it with chance . Servicing a working machine keeps it working for sure. When broken, the only choice is repair (reward ), which returns it to working for sure the next day. The discount factor is , and we collect rewards, so we want the largest long-run discounted total.

We find the values by repeated updates, starting both at . Write and .

Sweep 1. From work, score "run": . Score "service": . Keep the larger, . From broke, "repair": . New table: , .

Sweep 2. From work, "run": . "Service": . Keep . From broke, "repair": . New table: , .

Sweep 3. From work, "run": . "Service": . Keep . From broke, "repair": .

The "work" value is climbing toward a settled number near , and "run" beats "service" every sweep. What this tells us: even though running risks a breakdown, its higher reward and the chance-weighted look-ahead make it the better choice while working; the same one-step rule, now averaging over chance, drives the table to the optimal values, and "run when working, repair when broken" is the best forever-policy read off from them.

Check your understanding Beginner

Formal definition Intermediate+

A Markov decision process (MDP) is a tuple : a state space , an action space , a nonempty set of admissible actions for each , a transition kernel that assigns to each state-action pair with a probability distribution over — the controlled-Markov structure generalizing the transition matrix of 37.05.01, here indexed by the chosen action — a bounded reward with , and a discount factor . The state space is taken finite or, more generally, a Polish (complete separable metric) space with a measurable kernel and compact-valued; in the master tier the finite case carries the structure unobscured. The process evolves as , and we maximize the expected total discounted reward (signs flip the cost convention of 44.08.02).

A decision rule at time may depend on the full history and may randomize; the policy classes nest as , namely stationary deterministic, Markov deterministic, Markov randomized, and history-dependent randomized. A stationary deterministic policy is a single map with used at every stage. For a policy the value function and, for stationary deterministic , the action-value function are

both finite because gives . The optimal value is over .

On the Banach space of bounded functions with sup-norm 02.01.05, define the policy operator and the optimality (Bellman) operator by

The Bellman expectation equation is the fixed-point relation ; the Bellman optimality equation is . A stationary deterministic policy is greedy with respect to if , i.e. attains the supremum defining for every . The symbols (optimality operator), (policy operator), (optimal value), (policy value), (action-value), (admissible actions), (transition kernel), and (discount factor) are recorded in _meta/NOTATION.md.

Counterexamples to common slips Intermediate+

  • "An optimal policy might need to randomize or remember history." For the discounted criterion with and an attained supremum, a stationary deterministic policy greedy for is optimal over the whole history-dependent randomized class. Randomization and memory buy nothing here; they matter for constrained MDPs, partial observability, or the average-cost multichain case, none of which is the present setting.

  • "The action-value and the state-value are independent objects to be solved separately." They are tied by and ; the optimal pair satisfies . Solving one yields the other by a single Bellman backup.

  • "The optimality operator is not a contraction because of the supremum over actions." The supremum is taken after the -discounted future-value term, and ; the factor passes through, so is an -contraction exactly as the policy operators are. The supremum cannot inflate the modulus.

  • "With an infinite or continuous action set the optimal action always exists." Existence of an optimal stationary deterministic policy needs the supremum in to be attained. Compactness of plus upper-semicontinuity of delivers attainment by a measurable selection; without such a hypothesis only -optimal stationary policies are guaranteed.

Key theorem with proof Intermediate+

The signature result specializes the abstract Bellman contraction of 44.08.02 to the MDP optimality operator and adds what is new to the stochastic-control setting: that the optimum is achieved by a single stationary deterministic policy. The contraction itself is inherited; the new content is attainment of the supremum and the resulting greedy-optimality dictionary between and the optimal decision rule.

Theorem (MDP optimality equation and optimal stationary deterministic policy). Let be an MDP with , , and either finite or compact with upper-semicontinuous for every . Then is a sup-norm contraction of modulus on ; its unique fixed point is the optimal value , which therefore satisfies the Bellman optimality equation ; value iteration converges geometrically, ; the supremum in is attained, and any stationary deterministic greedy for () is optimal over all history-dependent randomized policies, with .

Proof. Fix and . For each admissible ,

since is a probability distribution. Hence the bracketed action score for exceeds that for by at most , uniformly in ; taking suprema and using gives for every , the contraction bound. The same estimate with the single action in place of the supremum gives it for each .

Because is complete and , the Banach fixed-point theorem 02.01.05 supplies a unique fixed point together with the geometric estimate ; each likewise has a unique fixed point, which is (the discounted policy value solves , the matrix form for finite models). The abstract contraction-and-monotonicity machinery is taken from 44.08.02; what remains is to identify with and to produce the optimal policy.

Attainment: under either hypothesis the function attains its supremum on — immediately for finite , and by upper-semicontinuity on the compact otherwise — and a measurable maximizing selection exists (Kuratowski–Ryll-Nardzewski in the Polish case). Thus , so is the fixed point of , whence by uniqueness.

Optimality and identification: monotonicity of (inherited from the increasing, -weighted integrand of 44.08.02) gives, for any history-dependent randomized with one-step decision rule , the bound is not needed; instead use that for every policy the value satisfies pointwise via the dynamic-programming inequality, so iterating the monotone yields , giving and hence . Conversely . The two inequalities force , attained by the stationary deterministic . Finally a stationary deterministic is optimal iff iff (applying to its own fixed point) , i.e. iff is greedy for .

Bridge. This theorem is the foundational reason stochastic sequential decision-making reduces to one equation: the -contraction collapses the supremum over all history-dependent randomized policies into the unique fixed point , and the greedy selection both certifies optimality and reads off the optimal stationary deterministic rule. This is exactly the abstract Bellman contraction of 44.08.02 with the transition law replaced by the action-indexed kernel of 37.05.01; the only genuinely new ingredient is the measurable selection that attains the supremum, the central insight being that discounting alone fixes well-posedness while compactness fixes existence of the maximizer. The framework generalises the deterministic infinite-horizon problem and builds toward the reinforcement-learning algorithms that estimate from samples, where the same operator reappears as the target of a stochastic approximation. Putting these together, value iteration, policy iteration, and the linear-programming formulation are three routes to the one fixed point, and the bridge is that packages the optimality equation in the action-value form that model-free learning later samples; this appears again in temporal-difference and Q-learning as the operator whose expectation the updates track.

Exercises Intermediate+

Advanced results Master

The discounted MDP theory extends in four directions: policy iteration as a Newton-type method with finite termination for finite models, the action-value (Q) formulation that the model-free algorithms target, the primal-dual linear-programming formulation with its occupation-measure dual, and the bridge to reinforcement learning where the Bellman operators become the means of stochastic-approximation iterations.

Theorem 1 (policy iteration: monotone improvement and finite termination). Policy iteration over stationary deterministic policies alternates exact evaluation — solve , equivalently the linear system for finite models, where is invertible because — with improvement — set . Then pointwise with strict increase at some state unless is optimal. For finite and there are finitely many stationary deterministic policies and the value strictly increases until optimality, so the algorithm terminates at an optimal policy in finitely many iterations; it is the Newton step for the equation and converges at least as fast as value iteration, typically far faster [Puterman Ch. 6].

Theorem 2 (the action-value optimality equation and Q-iteration). The optimal action-value satisfies and the self-referential Bellman optimality equation in -form,

The operator is an -contraction on , so is its unique fixed point and -value iteration converges geometrically; the greedy policy is optimal. The advantage of the -form is that the greedy policy is read off without the model, since needs no transition kernel — the structural reason model-free control is possible [Sutton Barto Ch. 4-6].

Theorem 3 (linear-programming formulation and the occupation-measure dual). For a finite discounted MDP, is the unique optimal solution of the primal LP subject to for all , for any . Its dual is subject to and , where the variable is the discounted state-action occupation measure induced by a policy. Complementary slackness ties the dual support to the greedy actions, so an optimal stationary deterministic policy is recovered as ; this exhibits the MDP as a polyhedral optimization problem and connects it to the theorems-of-alternative / duality theory of 44.04.01 [Puterman Ch. 6].

Theorem 4 (reinforcement learning as stochastic approximation to the Bellman operators). When the kernel and reward are unknown but samples are available, the exact backups of value and Q-iteration are replaced by sampled updates. Temporal-difference learning updates , a stochastic approximation whose mean field is ; Q-learning updates , whose mean field is . Under the Robbins–Monro step-size conditions , and sufficient exploration, these iterates converge to and respectively, the contraction modulus and the effective horizon governing the convergence rate and the sample complexity [Bertsekas Vol. 2 Ch. 2].

Synthesis. The foundational reason a Markov decision process is solvable is the same fact that powered the deterministic case: the discount factor is at once what renders the infinite reward sum finite and the contraction modulus that makes the optimality operator have a unique fixed point — these are one fact, not two. The central insight is the interchange this licenses, that a supremum over all history-dependent randomized policies becomes the search for , and the optimal stationary deterministic policy is the greedy selection ; the only ingredient genuinely new to the stochastic setting is the measurable selection that attains that supremum. This is exactly the abstract Bellman contraction of 44.08.02 specialized to the action-indexed transition kernel of 37.05.01, so the present unit is what infinite-horizon discounted control becomes when the disturbance law is promoted to a controlled-Markov kernel. Value iteration (geometric rate ), policy iteration (the Newton step, finitely terminating for finite models), and the linear program ( with its occupation-measure dual) are three algorithms for the one fixed point, and the action-value reformulation is dual to in the sense that the greedy policy reads off from without the model.

Putting these together, the same algebraic move — collapsing a sum over all futures into a one-step optimization against a stored value summary — generalises from exact dynamic programming to sampled, model-free learning, where temporal-difference and Q-learning are stochastic approximations whose mean dynamics are precisely the Bellman operators developed here; the bridge from planning to learning is that one operator, estimated rather than computed.

Full proof set Master

Proposition 1 (contraction of and ). On , and for all and all stationary deterministic .

Proof. For fixed with , , the last step because pointwise and . So the action score for differs from that for by at most , uniformly in . For the single action gives the bound directly. For , the supremum is -Lipschitz: from for all (with ) one gets , and swapping gives for all . The supremum over is the claim.

Proposition 2 (existence, uniqueness, value-iteration convergence). has a unique fixed point , and for any , . Each has a unique fixed point .

Proof. with the sup-norm is a complete metric space under 02.01.05. By Proposition 1, is an -contraction with . The Banach fixed-point theorem gives a unique fixed point and the geometric estimate ; forces convergence. The same theorem applied to gives a unique .

Proposition 3 (monotonicity and dominates every policy value). and each are monotone: and . For every history-dependent randomized policy , .

Proof. Monotonicity: if then for each since and ; adding and taking the supremum over (or the single action ) preserves the order, giving and . For the domination, fix with first decision rule . The dynamic-programming inequality for the discounted value gives , because the time-shifted continuation value of from any next state is at most and the one-step reward-plus-discounted-continuation is bounded above by the supremum over actions. Iterating the monotone , , so .

Proposition 4 (existence of an optimal stationary deterministic policy; identification ). Under finite , or compact with upper-semicontinuous, the supremum in is attained by a measurable selection , and .

Proof. The map attains its supremum on : immediately when is finite, and by upper-semicontinuity on compact otherwise. A measurable maximizing selection exists by the Kuratowski–Ryll-Nardzewski selection theorem (immediate in the finite case). Then , so is the fixed point of , whence by uniqueness (Proposition 2). Proposition 3 gives , and holds because is itself a policy; combining, , so all are equal and the optimum is attained by the stationary deterministic .

Proposition 5 (greedy-optimality criterion). A stationary deterministic policy is optimal () if and only if , i.e. is greedy for .

Proof. If then is a fixed point of , so by uniqueness (Proposition 2 for ): is optimal. Conversely, if , then applying to its fixed point , , so is greedy for .

Proposition 6 (policy improvement and finite termination of policy iteration for finite MDPs). If is greedy for then , with strict inequality somewhere unless is optimal; for finite policy iteration terminates at an optimal policy in finitely many iterations.

Proof. (supremum the particular action , and is policy evaluation). Applying the monotone repeatedly, , a nondecreasing sequence; by Proposition 2 for it converges to , so . If everywhere then , so by uniqueness; hence strict improvement holds somewhere unless is optimal. For finite the values strictly increase (in the componentwise order) until optimality, so no policy repeats; there are at most stationary deterministic policies, so after finitely many steps a with is reached, optimal by Proposition 5.

Connections Master

  • The infinite-horizon discounted dynamic programming of 44.08.02 is the abstract parent of this unit: its Bellman operator on the sup-norm space , the -contraction estimate, value iteration, policy iteration, and the linear-programming route are reused verbatim, with the disturbance-driven system replaced by the action-indexed transition kernel . The genuinely new theorem here is the attainment-and-selection result that produces an optimal stationary deterministic policy from the fixed point; the contraction machinery is inherited, so this unit specializes rather than re-proves the abstract theory.

  • The Markov chain and transition-matrix theory of 37.05.01 supplies the stochastic substrate: fixing a stationary deterministic policy collapses the MDP to an ordinary time-homogeneous Markov chain with transition matrix , so policy evaluation is a discounted potential of that chain and the recurrence/communication structure of governs which states the policy actually visits. The Chapman–Kolmogorov semigroup law for underlies the convergence of the evaluation step.

  • The Banach fixed-point theorem 02.01.05 is the existence-uniqueness-and-rate engine for both the optimality operator and every policy operator , with the discount factor furnishing the contraction modulus on . The same fixed-point principle that solves the MDP also drives Picard–Lindelöf existence for ODEs and the fixed-point iterations of numerical analysis 43.02.02, so stochastic dynamic programming is the decision-theoretic reading of one of analysis's most reused theorems.

  • The linear-programming duality and theorems-of-alternative of 44.04.01 underwrite the LP formulation of the MDP: the primal over has a dual over discounted state-action occupation measures, and complementary slackness recovers the optimal greedy policy from the dual support. The MDP is thereby a polyhedral optimization problem, and the simplex or interior-point machinery of linear programming becomes a third exact solver alongside value and policy iteration.

Historical & philosophical context Master

The Markov decision process emerged from the confluence of Richard Bellman's dynamic-programming program of the 1950s with the theory of controlled Markov chains. Bellman's principle of optimality and the functional equation that bears his name provided the recursive backbone, while the explicit formulation of the sequential decision model with transition probabilities and the policy-iteration algorithm is due to Ronald Howard, whose 1960 monograph Dynamic Programming and Markov Processes [Howard 1960] introduced policy iteration as a method distinct from successive approximation and named the objects that became the standard MDP vocabulary. David Blackwell's 1965 analysis [Blackwell 1965] placed discounted dynamic programming on rigorous measure-theoretic footing and proved the optimality of stationary policies, the existence result that this unit's central theorem specializes.

The systematic operator treatment — the optimality operator and policy operators as sup-norm contractions, value-iteration error bounds, modified policy iteration, and approximate dynamic programming — is developed by Dimitri Bertsekas in Dynamic Programming and Optimal Control Volume 2 [Bertsekas Vol. 2 Ch. 1], while the comprehensive reference on the discrete stochastic theory, including the policy-class hierarchy, the linear-programming formulation, and the average-reward extension, is Martin Puterman's 1994 monograph [Puterman Ch. 6]. The same contraction framework became the theoretical foundation of reinforcement learning: temporal-difference learning, introduced by Richard Sutton, and Q-learning, introduced by Christopher Watkins in 1989 with its convergence established by Watkins and Peter Dayan in 1992 [Sutton Barto Ch. 6], are stochastic approximations to the value and action-value Bellman operators, learning and from sampled transitions when the model is unknown.

Bibliography Master

@book{puterman1994mdp,
  author    = {Puterman, Martin L.},
  title     = {Markov Decision Processes: Discrete Stochastic Dynamic Programming},
  publisher = {John Wiley \& Sons},
  year      = {1994}
}

@book{bertsekas2012dpvol2,
  author    = {Bertsekas, Dimitri P.},
  title     = {Dynamic Programming and Optimal Control, Volume 2: Approximate Dynamic Programming},
  edition   = {4},
  publisher = {Athena Scientific},
  year      = {2012}
}

@book{suttonbarto2018,
  author    = {Sutton, Richard S. and Barto, Andrew G.},
  title     = {Reinforcement Learning: An Introduction},
  edition   = {2},
  publisher = {MIT Press},
  year      = {2018}
}

@book{howard1960dp,
  author    = {Howard, Ronald A.},
  title     = {Dynamic Programming and Markov Processes},
  publisher = {MIT Press},
  year      = {1960}
}

@article{blackwell1965discounted,
  author  = {Blackwell, David},
  title   = {Discounted Dynamic Programming},
  journal = {The Annals of Mathematical Statistics},
  volume  = {36},
  number  = {1},
  year    = {1965},
  pages   = {226--235}
}

@article{watkinsdayan1992,
  author  = {Watkins, Christopher J. C. H. and Dayan, Peter},
  title   = {Q-learning},
  journal = {Machine Learning},
  volume  = {8},
  number  = {3--4},
  year    = {1992},
  pages   = {279--292}
}