Stochastic Shortest Path and Total-Cost Dynamic Programming
Anchor (Master): Bertsekas 2017 Dynamic Programming and Optimal Control 4e (Athena Scientific) Vol. 2 Ch. 3 (the complete stochastic-shortest-path theory: proper/improper policies, the two SSP assumptions, the weighted-sup-norm contraction of for proper and of , uniqueness of , convergence of value and policy iteration, Gauss-Seidel and asynchronous variants, and SSP as the unifying model recovering discounted DP and deterministic shortest paths); Bertsekas & Tsitsiklis 1996 Neuro-Dynamic Programming (Athena Scientific) Ch. 2 (the SSP framework as the substrate for real-time and approximate DP) and Bertsekas & Tsitsiklis 1991 Analysis of Stochastic Shortest Path Problems (Math. Oper. Res.)
Intuition Beginner
Some decision problems do not run forever and do not fade out by discounting; instead they aim at a destination. A robot wants to reach a charging dock, a board game wants to reach a finishing square, a project wants to reach completion. Once you arrive, the problem is over and nothing more is charged. Every step before arrival has a cost, and the chance of where you land next depends on what you do. The question is how to act so that the total cost of getting to the destination is as small as possible.
Because there is a real ending — the destination — you do not need to shrink future costs to keep the total finite. The total stays finite for another reason: a good plan actually reaches the destination, and once there, the bill stops. This is the stochastic shortest path idea. The destination is a special situation that costs nothing and that you never leave. A plan that is sure to reach it eventually pays a finite total; a plan that might wander away from the destination forever can pile up cost without end.
This splits all plans into two kinds. A proper plan is one that, no matter where you start, will reach the destination with full certainty given enough steps. An improper plan can get stuck circling among the other situations, never arriving. Proper plans are the well-behaved ones, and the whole method works when at least one proper plan exists and every improper plan is genuinely bad — costing an unbounded amount from somewhere.
The reward for setting things up this way is that the same repeat-until-settled method from earlier still finds the answer. The value of each situation is the cheapest expected total cost to reach the destination from there, and it satisfies one self-referential equation: value here equals best immediate cost plus the average value of where you land next.
Visual Beginner
Picture a small map of situations with one marked as the destination. From each non-destination situation, each action is a fan of arrows to possible next situations, each arrow carrying a chance and the situation carrying a one-step cost. Arrows can point toward the destination or away from it. A plan is proper when, following its chosen arrows, every situation has a path of nonzero chance that eventually lands on the destination, so you are sure to arrive in the long run.
The contrast in the side panel is the heart of it. A proper plan always drains into the destination, so its total cost is a finite number for every starting situation. An improper plan can trap you in a loop that never reaches the destination; if that loop carries any positive cost, the total grows without bound.
| plan type | reaches destination? | total cost |
|---|---|---|
| proper | yes, with certainty | finite from every start |
| improper | not from some start | can be infinite |
Worked example Beginner
A delivery bot is at situation or , and wants to reach the depot , which costs nothing and is the end. From the only action is drive: cost , and it reaches with chance or slips to with chance . From the only action is drive: cost , and it reaches with chance . There is no discounting; we want the cheapest expected total cost to reach . This plan is proper: from either start the bot is sure to arrive.
Write and for the expected total cost to reach . At the depot the value is . Let us find the values by repeated updates, starting both at .
Sweep 1. From : cost plus the average of next values, , total . From : cost plus , total . New table: , .
Sweep 2. From : . From : . New table: , .
Sweep 3. From : . From : . The table did not change, so we have the answer: , .
What this tells us: with no discounting, the values still settle to finite numbers because the plan is sure to reach the depot, where the bill stops. Starting at costs ; starting at costs , the to drive plus the half-chance of a detour through .
Check your understanding Beginner
Formal definition Intermediate+
A stochastic shortest path (SSP) problem is a finite-state controlled Markov chain with states together with a cost-free absorbing terminal state . For each non-terminal state there is a nonempty admissible-control set , transition probabilities (including to the terminal state) summing to one over , and a bounded one-stage expected cost ; the terminal state satisfies and . There is no discounting: . This is the undiscounted, terminating counterpart of the discounted MDP 44.08.03. A stationary policy is a map with , and its total expected cost from is
with ; the limit may be .
Let be the substochastic matrix of transitions among the non-terminal states under (mass leaks to ), and . A stationary policy is proper if, starting from every state, the terminal state is reached with probability one under ; equivalently there exist and with for all , equivalently the spectral radius of is strictly below one, so is invertible and converges. A policy that is not proper is improper. For proper , is finite.
On the space of functions on the non-terminal states (with fixed), define the policy operator and the Bellman operator by
the terminal term omitted. The optimality (Bellman) equation is and policy evaluation is . A policy is greedy for if . The two standing SSP assumptions are: (3.1) at least one proper policy exists; (3.2) every improper policy has for some . The weighted sup-norm with weights is . The symbols , , , , (substochastic policy matrix), (weighted sup-norm), and the terminal state are recorded in _meta/NOTATION.md.
Counterexamples to common slips Intermediate+
"With no discount factor the Bellman operator cannot be a contraction in any sup-norm." In the plain sup-norm it generally is not — a proper policy's substochastic can have row sums equal to one for states far from the terminal. But the SSP assumptions deliver a positive weight vector and a modulus making a contraction in the weighted sup-norm . The weighting is the whole point; without it the contraction fails.
"Bellman's equation might have several solutions once ." Under the two assumptions has a unique fixed point among functions on the non-terminal states (with ), and it is . The terminal-state normalization removes the additive-constant ambiguity that plagues the undiscounted average-cost problem; here the absorbing state pins the level.
"Improper policies are merely suboptimal, so they can be ignored." Assumption (3.2) is what rules them out, and it is a genuine hypothesis: if some improper policy had finite cost everywhere, could fail to satisfy the contraction-based uniqueness, value iteration could converge to the wrong limit, and policy iteration could stall at an improper policy. The assumption forces every improper policy to be visibly infinite-cost somewhere.
"A greedy policy for the optimal cost could be improper." Under the assumptions, any policy greedy for is proper and optimal. Were a greedy policy improper, assumption (3.2) would give it infinite cost from some state, contradicting obtained from greediness; properness of optimal policies is a consequence, not a separate hypothesis.
Key theorem with proof Intermediate+
The signature result is that, under the two SSP assumptions, the undiscounted Bellman operator is a contraction in a suitable weighted sup-norm, recovering for the total-cost problem the entire fixed-point apparatus — existence, uniqueness, value-iteration convergence, greedy optimality — that the discount factor supplied automatically in the discounted case 44.08.02. The discount modulus is replaced by a constructed modulus and a constructed weight vector .
Theorem (SSP weighted-sup-norm contraction and the total-cost optimality equation). Let an SSP satisfy assumptions (3.1) and (3.2). Then there exist a vector with and a scalar such that for every proper and for ,
Consequently has a unique fixed point , which equals the optimal cost; value iteration from any converges to (); each proper has the unique fixed point ; and a stationary policy is optimal if and only if it is greedy for (), in which case is proper.
Proof. First construct . Modify the SSP by charging a cost of at every non-terminal state under every control: the modified problem has the same proper policies, and for a proper the modified total cost is the expected number of steps to absorption, , finite by properness. Let be the optimal cost of the modified problem (minimum expected steps to reach ); under the assumptions is finite and satisfies , so for every admissible . Set . Then for each and each control ,
Now bound . For and any , pick attaining ; then
using and the bound on . The symmetric choice gives the reverse, so , i.e. ; the maximum over is the contraction bound for . The single-control version gives it for each proper (whose own substochastic matrix obeys the same ).
Because is complete (all norms on are equivalent, so completeness is the metric/Banach substrate of 02.01.05) and , the Banach fixed-point theorem gives a unique fixed point with the geometric estimate , and a unique for each proper ; solving the linear fixed point, gives .
That is the optimal cost and is attained by a greedy proper policy: let be greedy for , so . The contraction bound applied to (its substochastic matrix obeys , forcing strictly positive leakage to from the recurrent classes, hence proper) makes the unique fixed point of , so . For any proper , monotonicity of and iterated give . For any improper , assumption (3.2) gives for some , and pointwise holds because the per-state cost is nonneg-dominated by the proper optimum where finite. Hence , while shows the infimum is attained; thus . Finally optimal () gives, applying to its fixed point, , so is greedy; the converse was shown.
Bridge. This theorem is the foundational reason undiscounted total-cost control is as tractable as the discounted case: where discounting handed over a contraction modulus for free, the SSP assumptions manufacture one — the constructed weight vector (minimum expected steps to the terminal state) and modulus play the role the discount played in 44.08.02, and this is exactly the same Banach fixed-point machinery 02.01.05 read in a weighted norm. The central insight is that properness is a spectral condition — the substochastic has spectral radius below one — so inverts and the expected-step function is finite and positive, and that single positive vector simultaneously controls and every proper . The construction generalises the discounted contraction (which is the SSP weighting with the uniform weight ) and is dual, through the substochastic resolvent , to the discounted resolvent of the Markov-chain evaluation step 44.08.03. Putting these together, value iteration, policy iteration over proper policies, and the asynchronous variants are three algorithms for the one fixed point , and the bridge is that adding a uniform termination probability to any discounted MDP turns it into an SSP, so the discounted theory is a special case; this builds toward real-time and approximate dynamic programming, and appears again in the neuro-dynamic-programming treatment of reinforcement learning, where SSP is the default episodic model.
Exercises Intermediate+
Advanced results Master
The SSP theory extends in four directions: policy iteration restricted to proper policies with its monotone improvement and finite termination, the Gauss-Seidel and asynchronous value-iteration variants convergent under the same assumptions, real-time dynamic programming over simulated trajectories, and the unifying status of SSP as the model from which discounted DP, deterministic shortest paths, and first-passage problems all descend.
Theorem 1 (policy iteration over proper policies: monotone improvement and finite termination). Starting from any proper policy (one exists by assumption 3.1), policy iteration alternates exact evaluation — solve , i.e. the linear system , well-posed because — with improvement, greedy for . Each is again proper, pointwise, with strict decrease at some state unless is optimal. With finitely many states and controls there are finitely many proper policies and the cost strictly decreases until optimality, so policy iteration terminates with an optimal proper policy in finitely many iterations; it is the Newton method for and converges at least as fast as value iteration [Bertsekas Vol. 2 Ch. 3].
Theorem 2 (Gauss-Seidel and asynchronous value iteration). Because is a weighted-sup-norm contraction with a monotone, componentwise structure, value iteration converges even when states are updated one at a time using the most recent values (Gauss-Seidel) or in an arbitrary order with possibly outdated values (asynchronous / chaotic iteration), provided every state is updated infinitely often. The asynchronous convergence follows from the Bertsekas asynchronous-convergence theorem: a sequence of nested boxes shrinking to , each mapped into the next by componentwise, is exactly the structure a weighted-sup-norm contraction provides, so any update schedule with infinitely-often coverage drives the iterate into every box [Bertsekas Tsitsiklis Neuro-Dynamic Programming Ch. 2].
Theorem 3 (real-time dynamic programming). Real-time dynamic programming (RTDP) interleaves control with computation: at each visited state it performs one Bellman backup , applies the greedy action, and moves to the simulated successor, updating only states along the trajectory. Under the SSP assumptions, with an admissible (lower-bounding) initial and a proper greedy policy maintained, the values of all relevant states converge to and the generated trajectories reach the terminal state; RTDP focuses computation on states that matter for the start state, the basis of the LRTA* and labeled-RTDP heuristic-search algorithms [Bertsekas Tsitsiklis Neuro-Dynamic Programming Ch. 2].
Theorem 4 (SSP as the unifying total-cost model). The SSP problem specializes to the principal finite-state DP models. The discounted MDP with discount 44.08.03 is the SSP obtained by adding, from every state, a transition to the terminal state with probability and scaling the surviving transitions by : every policy is then automatically proper (geometric termination), the constant weight gives modulus , and the SSP optimality equation reduces to the discounted Bellman equation. The deterministic shortest path problem is the SSP in which each control sends the state to a unique successor with probability one and is the arc length; properness is the existence of a path to the destination, assumption (3.2) is the absence of negative-cost cycles, and value/policy iteration reduce to the Bellman-Ford and label-correcting algorithms. First-passage problems — minimizing expected cost until a target set is first reached — are SSPs with the target set lumped into the terminal state. Thus the weighted-contraction theory subsumes discounting, classical shortest paths, and first-passage as one framework [Bertsekas Vol. 2 Ch. 3].
Synthesis. The foundational reason the undiscounted total-cost problem is solvable is that properness manufactures a contraction where discounting once supplied one for free: the SSP assumptions produce a positive weight vector (minimum expected steps to the terminal state) and a modulus , and this is exactly the discounted contraction of 44.08.02 read in a weighted norm, the discount case being the uniform-weight specialization. The central insight is that properness is the spectral condition , so the substochastic resolvent converges and policy evaluation is the finite linear solve ; this is dual to the discounted resolvent of the Markov-chain evaluation step 44.08.03, the discount reappearing as a uniform survival probability. Putting these together, value iteration ( geometric rate), policy iteration over proper policies (the finitely-terminating Newton step), and the asynchronous and real-time variants are algorithms for the one fixed point vanishing at the terminal state, and the two assumptions are what make that fixed point unique — without (3.2) a zero-cost improper loop reintroduces spurious solutions. This is exactly the model that unifies discounted DP, deterministic shortest paths, and first-passage problems, and it builds toward approximate and neuro-dynamic programming, where SSP is the default episodic substrate and the effective horizon measures the difficulty the discounted measured before.
Full proof set Master
Proposition 1 (proper policy: spectral characterization and finite evaluation). A stationary policy is proper if and only if , in which case is invertible, , and is finite.
Proof. If is proper, there are and with for all ; the row sums of (probability of remaining non-terminal after steps) are , so , giving , hence . Conversely if then , so the probability of being non-terminal at step tends to for every start, i.e. absorption is certain and is proper. With , no eigenvalue of equals , so is invertible; gives . Solving yields the finite .
Proposition 2 (existence of the contraction weight). Under assumptions (3.1)-(3.2) there exist and with for all and all .
Proof. Charge a unit cost at every non-terminal state under every control; under (3.1)-(3.2) the modified SSP has a finite optimal cost (a proper policy gives finite expected steps; every improper policy is infinite-cost, so the optimum is proper), satisfying . Hence for every . Set and ; since , , and .
Proposition 3 (weighted-sup-norm contraction of and proper ). With as in Proposition 2, and, for every proper , .
Proof. For fixed, choose attaining . Then . Bounding and using Proposition 2, this is . The symmetric choice of the minimizer for gives the reverse inequality, so , i.e. for every ; the maximum over is the claim for . For a proper , the same chain with the single control in place of the minimum gives the bound for .
Proposition 4 (existence, uniqueness, value-iteration convergence). has a unique fixed point , and for any , .
Proof. is a complete metric space (finite-dimensional, all norms equivalent; 02.01.05). By Proposition 3, is a -contraction with , so the Banach fixed-point theorem gives a unique and the geometric estimate ; forces convergence.
Proposition 5 (identification and greedy-optimality criterion). The fixed point equals the optimal cost , attained by any proper policy greedy for ; and a stationary policy is optimal () if and only if .
Proof. Let be greedy for : . The contraction bound (Proposition 3, single control) shows the substochastic obeys ; summing against forces , so is proper (Proposition 1) and by uniqueness of the proper fixed point. For any proper , monotonicity of (, since ) and give, by iteration, . For any improper , assumption (3.2) gives for some , so pointwise fails nowhere. Hence , while attains it; so . For the criterion: if , then is the fixed point of , so is proper (as for ) and , optimal. Conversely if , applying to its fixed point, , so is greedy.
Proposition 6 (policy improvement and finite termination over proper policies). If is proper and is greedy for , then is proper and , with strict inequality somewhere unless is optimal; for finite policy iteration terminates at an optimal proper policy in finitely many iterations.
Proof. Greediness gives . Iterating the monotone , is nonincreasing and bounded above by the finite . Since stays bounded above for all , the partial sums converge, forcing , hence and proper (Proposition 1). Then contracts and , so . If everywhere, , so by Proposition 4; thus strict improvement somewhere unless is optimal. For finite the costs strictly decrease componentwise until optimality, no proper policy repeats, and there are at most of them, so a with , optimal by Proposition 5, is reached in finitely many steps.
Connections Master
The infinite-horizon discounted dynamic programming of
44.08.02is the special case of this unit obtained by adding a uniform termination probability to every state: every policy then becomes proper through geometric absorption, the constant weight yields contraction modulus , and the SSP optimality equation collapses to the discounted Bellman equation. The discounted theory's free contraction is recovered here as the uniform-weight instance of the constructed weighted-sup-norm contraction; conversely SSP is what the discounted method becomes when the discount is replaced by a genuine absorbing terminal state and a manufactured weight vector restores the contraction.The Markov decision process of
44.08.03supplies the controlled-transition substrate that SSP specializes to the undiscounted, terminating case: an SSP is an MDP with , a cost-free absorbing state, and the proper/improper dichotomy replacing the automatic well-posedness that discounting provided. Fixing a proper stationary policy collapses the SSP to a substochastic Markov chain on the non-terminal states whose resolvent is the discounted-resolvent analogue with survival probability one, and the policy-evaluation linear solve is the SSP counterpart of the discounted .The Banach fixed-point theorem
02.01.05is again the existence-uniqueness-and-rate engine, but read in a weighted sup-norm on rather than the plain one: the constructed weight and modulus instantiate the abstract contraction on the finite-dimensional complete space of total-cost functions vanishing at the terminal state. The same fixed-point principle that powers SSP also drives the fixed-point iterations and contraction-based convergence of numerical analysis43.02.02, so the stochastic shortest path problem is the terminating-control reading of one of analysis's most reused theorems, distinguished only by the weighting that rescues the contraction when discounting is absent.The Hamilton-Jacobi-Bellman equation appearing in the linear-quadratic regulator
44.07.02is the continuous-time, undiscounted-cost shadow of the SSP optimality equation: where the discrete SSP minimizes total cost until absorption and yields , the continuous problem yields a first-order partial differential equation for the cost-to-go to a target set, with properness corresponding to controllability to the target and the SSP weight vector to a Lyapunov function certifying finite-time-ish reachability. The discrete weighted contraction is the well-posedness mechanism the continuous HJB problem must replace with verification or viscosity-solution arguments.
Historical & philosophical context Master
The stochastic shortest path problem grew out of two strands of Richard Bellman's 1950s dynamic-programming program: the deterministic shortest-path and routing problems solved by the Bellman-Ford label-correcting recursion, and the undiscounted total-cost control of terminating Markov chains. The rigorous modern treatment, isolating the proper/improper dichotomy and proving existence and uniqueness of the optimal cost together with the weighted-sup-norm contraction, is due to Dimitri Bertsekas and John Tsitsiklis in their 1991 paper An Analysis of Stochastic Shortest Path Problems [Bertsekas Tsitsiklis 1991], which established that under the two assumptions the Bellman operator is a contraction in a weighted norm and that value and policy iteration converge, with the unique solution of Bellman's equation among functions vanishing at the terminal state.
The systematic textbook development — the proper/improper classification, the assumptions, the weighted-contraction construction, value and policy iteration, Gauss-Seidel and asynchronous variants, and the demonstration that discounted DP, deterministic shortest paths, and first-passage problems are SSP special cases — is given by Bertsekas in Dynamic Programming and Optimal Control Volume 2 Chapter 3 [Bertsekas Vol. 2 Ch. 3], the anchor for this unit. The SSP framework became the canonical episodic model for approximate and neuro-dynamic programming in Bertsekas and Tsitsiklis's 1996 monograph Neuro-Dynamic Programming [Bertsekas Tsitsiklis Neuro-Dynamic Programming Ch. 2], where real-time dynamic programming and simulation-based methods are built on the same assumptions, and it underlies the heuristic-search RTDP and LRTA* algorithms developed in the artificial-intelligence literature by Andrew Barto, Steven Bradtke, and Satinder Singh.
Bibliography Master
@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{bertsekastsitsiklis1996ndp,
author = {Bertsekas, Dimitri P. and Tsitsiklis, John N.},
title = {Neuro-Dynamic Programming},
publisher = {Athena Scientific},
year = {1996}
}
@article{bertsekastsitsiklis1991ssp,
author = {Bertsekas, Dimitri P. and Tsitsiklis, John N.},
title = {An Analysis of Stochastic Shortest Path Problems},
journal = {Mathematics of Operations Research},
volume = {16},
number = {3},
year = {1991},
pages = {580--595}
}
@article{bartobradtkesingh1995rtdp,
author = {Barto, Andrew G. and Bradtke, Steven J. and Singh, Satinder P.},
title = {Learning to Act Using Real-Time Dynamic Programming},
journal = {Artificial Intelligence},
volume = {72},
number = {1--2},
year = {1995},
pages = {81--138}
}
@book{puterman1994mdp,
author = {Puterman, Martin L.},
title = {Markov Decision Processes: Discrete Stochastic Dynamic Programming},
publisher = {John Wiley \& Sons},
year = {1994}
}