Policies & Why Simple Ones Suffice
Why a deterministic, stationary, Markov policy is optimal in discounted MDPs.
A policy could consult the entire past, flip coins and change with the clock. In a finite discounted MDP none of that helps: one deterministic rule that looks only at the current state is optimal from every starting state at once. This lesson proves it in two steps, then maps exactly where the guarantee breaks: finite horizons, constraints, hidden state and games.
What you’ll learn
- Define the policy classes and say what each may depend on.
- Prove that a Markov randomized policy matches the state–action marginals of any history-dependent policy.
- Prove that a finite discounted MDP has a stationary deterministic policy that is optimal from every state simultaneously.
- Identify when randomization or time dependence is truly necessary: finite horizons, constrained MDPs, partial observability, games and nonlinear objectives.
A hierarchy of policies
A policy is optimal if for every policy and every state . Two things here are far from obvious: that a single policy can be best from all states at once, rather than one policy for each starting state, and that the search can be restricted to the policies of the smallest class. Both hold for finite discounted MDPs, and the proof takes two steps.
Think first Why might a history-dependent policy seem able to beat every Markov one, and why can it not in an MDP?
It can condition on everything that has happened: how it got here, what it tried, how much reward it has collected. But in an MDP the future depends only on the current state and action, so none of that predicts anything. The past can only help if the objective depends on it, as with constraints on accumulated cost, nonlinear utilities of the return, or a hidden state that the past helps to infer.
Markov policies match any history-dependent policy
At both policies start from , and reproduces 's action frequencies by definition, so the joint laws of agree:
Whatever the policy, the next state depends on the past only through , so the law of is a function of the joint law of . If the joint laws agree at , the state marginals agree at :
Then the joint laws agree at , because was built to reproduce 's action frequencies in each state. Expected rewards depend only on these marginals.
The matching policy is Markov but generally nonstationary, and it depends on . For discounted values a stationary policy suffices: weighting the marginals by gives the discounted state–action occupancy measure, and reproduces it exactly, as Occupancy Measures & the Dual View proves. Notice what is not matched: the joint law across time steps, and with it the distribution of the return.
A history-dependent policy and the Markov policy built from its marginals start from the same . Which quantity can differ between them?
- The probability of being in state at time
- The expected discounted return
- The expected reward at time 10
- The variance of the return
Show the answer
D. The variance of the return
The theorem matches every one-time marginal of , hence every expectation of a sum of per-step terms. It says nothing about correlations across time. A history-dependent policy can, for instance, play safe after a lucky start and gamble after an unlucky one, which changes the spread of the return without changing its mean.
Stationary deterministic policies are optimal
A unique fixed point. is a -contraction in the max norm, because . By Banach's fixed point theorem it has a unique fixed point , and from any start (details in Bellman Operators & Contraction).
No policy beats . By marginal equivalence it is enough to consider Markov policies . Their -step values compose the policy operators , each of which is monotone and satisfies . By induction, starting from :
Since rewards are bounded and , , so in every state, for every policy.
A greedy policy attains . Let be stationary, deterministic and greedy for , so that . The operator is itself a -contraction whose unique fixed point is , hence . Together with the previous part, .
Two features of the proof deserve notice. Optimality from every state simultaneously comes for free, because the greedy choice is made separately in each state against the same . And determinism comes from the max: a randomized decision rule averages over actions, and an average never beats the best action. For infinite state or action spaces the same conclusions need extra conditions, such as compact action sets with continuous rewards and transitions (Puterman, 1994, §6.2; Blackwell, 1965, treats general state spaces). Without them a maximum over actions may not be attained, and then only -optimal policies exist: with actions paying , there is no best action.
When simple policies are not enough
Each hypothesis of the theorem can be dropped, and each time something breaks.
| Setting | What optimal policies may need | Smallest example |
|---|---|---|
| Finite horizon | Time dependence: Markov but nonstationary rules | The two-state MDP without discounting, in with steps left: staying earns , going earns . Stay when , either when , go when |
| Constraints on expected costs (constrained MDPs) | Randomization, among stationary policies | One state: fast pays 3 at cost 1, safe pays 1 at cost 0, average cost at most 0.25. Playing fast 25% of the time earns 1.5 per step; the best deterministic stationary policy earns 1 |
| Partial observability, memoryless policies | Randomization | The two rooms that look the same (The Markov Property & Agent State): deterministic memoryless policies average , the 50/50 policy 0 |
| Two-player zero-sum games | Randomization | Matching pennies: every deterministic strategy loses 1 per round to a best response, while the 50/50 mix guarantees 0 |
| Nonlinear objectives (risk, multi-objective utilities) | Memory of the past, for instance of the return collected so far | Maximizing the probability that the total reward exceeds a threshold: the right action depends on how much has already been collected |
The constrained case shows exactly where randomization comes from. In the occupancy-measure linear program (Occupancy Measures & the Dual View) each expected-cost constraint adds one row. With cost constraints a vertex of the feasible set has no more than nonzero coordinates; every visited state needs one of them, which leaves at most to spare, so some optimal stationary policy mixes actions in no more than states (Altman, 1999). Randomization is not the only way out: a deterministic policy that switches between fast and safe on a suitable schedule can come arbitrarily close to the same discounted cost and reward. "Randomization is necessary" is a statement about stationary policies. In zero-sum stochastic games, Shapley (1953) proved that both players have optimal stationary strategies, randomized in general.
Key takeaways
- Policy classes nest: history-dependent ⊇ Markov ⊇ stationary ⊇ stationary deterministic, and only the last is finite, with members.
- Every history-dependent policy's state–action marginals, and so all its expected per-step rewards, are matched by a Markov randomized policy; the distribution of the return is not matched.
- In a finite discounted MDP, is the unique fixed point of , no policy exceeds it, and any stationary deterministic greedy policy attains it from every state at once.
- Finite horizons need time-dependent rules; constrained MDPs, memoryless policies under partial observability and zero-sum games need randomization; nonlinear objectives can need memory of the past.
Check yourself
In the interactive lesson these are scored with your confidence, and what you miss comes back for review.
An MDP has 3 states and 4 actions in each. How many stationary deterministic policies does it have?
- 12
- 64
- 81
- 7
Show the answer
B. 64
Each of the 3 states independently picks one of 4 actions: . In general , finite but exponential in the number of states, which is why algorithms never enumerate it.
Why is a stationary deterministic policy that is greedy with respect to optimal?
- Because , and is the unique fixed point of the contraction , so
- Because greedy policies maximize the immediate reward
- Because is the value of every policy
- Because deterministic policies have no variance
Show the answer
A. Because , and is the unique fixed point of the contraction , so
Greediness means and agree at , so is a fixed point of ; since that fixed point is unique, it is . The other half of the proof, for every policy, comes from monotonicity of the operators.
In the undiscounted two-state MDP (in , stay pays 1, and go pays 0 and moves to , where stay pays 2), exactly 2 steps remain and the agent is in . Which first action is optimal?
- Stay
- Go
- Both: each earns 2
- Neither: the agent must randomize
Show the answer
C. Both: each earns 2
Staying twice earns , and going then staying earns . With 3 steps left, going wins ( against 3); with 1 step left, staying wins. The optimal rule depends on the number of steps remaining: finite horizons call for nonstationary policies.
In a one-state constrained problem, fast pays 3 at cost 1 and safe pays 1 at cost 0, and the average cost must be at most 0.25. Why is no stationary deterministic policy optimal?
- Deterministic policies are never optimal in constrained problems
- Safe violates the constraint
- The constraint makes the problem infeasible
- Fast alone violates the budget and safe alone leaves it unused; only mixing uses the budget exactly, earning instead of 1
Show the answer
D. Fast alone violates the budget and safe alone leaves it unused; only mixing uses the budget exactly, earning instead of 1
The reward and the cost are both linear in the probability of playing fast: reward , cost . Maximizing subject to gives , strictly inside the set of mixtures. A constraint cuts the policy polytope, and the optimum moves off its vertices.
Further reading
- M. L. Puterman, Markov Decision Processes: Discrete Stochastic Dynamic Programming, ch. 5–6 (Wiley, 1994).
- D. Blackwell, "Discounted dynamic programming," Annals of Mathematical Statistics 36(1), 226–235 (1965).
- E. Altman, Constrained Markov Decision Processes (Chapman & Hall/CRC, 1999).
- L. S. Shapley, "Stochastic games," Proceedings of the National Academy of Sciences 39(10), 1095–1100 (1953).
- S. P. Singh, T. Jaakkola & M. I. Jordan, "Learning without state-estimation in partially observable Markovian decision processes," ICML, 284–292 (1994).