Reinforcement Learning: An Introduction IV: Policy Iteration for ε-Soft PoliciesTextbook
Motivation
Policy iteration alternates two steps: evaluate the current policy, then replace it by a policy that is greedy with respect to the evaluated action values. The policy improvement theorem guarantees that each greedy step does not make the policy worse, and that the process stops only at an optimal policy. When the action values are estimated from experience rather than computed from a model, as in Monte Carlo control, a greedy policy is a problem: it never tries the actions it does not currently prefer, so their values are never re-estimated. Sutton and Barto, Reinforcement Learning: An Introduction (2nd ed., 2018), §5.4, resolve this without the unrealistic assumption of exploring starts by moving the policy only toward a greedy one, to an ε-greedy policy that keeps every action's probability at least ε/|A|.
The question this mission formalizes is whether policy iteration still works under that restriction. The book's answer (pp. 101–102) is yes, in a precise sense: an ε-greedy step never makes an ε-soft policy worse, and it fails to make it strictly better only when the policy is already the best among all ε-soft policies. This is the dynamic-programming fact that justifies on-policy first-visit Monte Carlo control for ε-soft policies, and more broadly every ε-greedy on-policy control scheme that is analysed with exact action values.
Setting
A finite Markov decision process has a finite state set S, a finite nonempty action set A used in every state, a finite reward set R ⊂ ℝ and dynamics p(s′, r | s, a) ≥ 0 with . A policy π gives, for each state s, a probability distribution π(· | s) on A. With a discount rate , the state value is the expected discounted return , and the action value is
For ε > 0, a policy is ε-soft if for all s and a. A policy π′ is ε-greedy with respect to if at each state some maximizer of receives probability and every other action receives ; ties among maximizers are broken arbitrarily. A policy π is optimal among the ε-soft policies if it is ε-soft and for every ε-soft π″ and every state s.
The book's analysis uses a new environment with the same states, actions and rewards, in which with probability 1 − ε the chosen action is executed and with probability ε a uniformly random action replaces it:
Its optimal value function is written .
Formalization targets
Goal: ε-greedy improvement with the equality case
For , , an ε-soft policy π and any ε-greedy policy π′ with respect to ,
The goal is stated in terms of the original MDP and ε-soft policies only; the new environment appears only in the milestones.
Milestones
- Policy improvement theorem for stochastic policies (4.7)–(4.8), p. 78: for all s implies , strictly at every state where the hypothesis is strict.
- Eq. (5.2), pp. 101–102: .
- Characterization, p. 102: an ε-soft π is optimal among ε-soft policies if and only if .
- Uniqueness, p. 102: is the unique solution of the Bellman optimality equation with the altered transition probabilities , and that equation splits as .
- Fixed-point equation, p. 102: if , then .
Significance
The result is what makes ε-greedy on-policy control a form of generalized policy iteration: monotone improvement at every step, and a characterization of where the process can stop. It also locates precisely what is lost by exploring, namely that the fixed point is optimal among ε-soft policies, not among all policies. The value of the new environment is the benchmark against which ε-greedy methods converge when action values are exact.
The book presents the argument informally and states the stochastic policy improvement theorem without proof ("we will not go through the details", p. 79). A formalization supplies the missing proof of the stochastic case, the identification of the best ε-soft policy value with the optimal value of a modified MDP, and the uniqueness of that value. As far as a search of the platform shows, no statement about ε-soft or ε-greedy policies has been formalized there; existing finite-MDP results (Bellman optimality in the Foundations of Machine Learning and Bertsekas series) use different reward models and do not cover the modified environment.
Difficulty
The improvement half follows from (5.2) and the policy improvement theorem, but both need work in the return-based model: the theorem requires comparing infinite discounted sums under two different Markov chains, and (5.2) uses the identity , which is a theorem about returns, not a definition. The equality half is where the obvious argument fails. The deterministic-policy argument of Chapter 4 shows that an unimproved greedy policy satisfies the ordinary Bellman optimality equation; here the unimproved policy satisfies a different equation, and nothing in the original MDP identifies its solution with the best ε-soft value. That identification needs two further facts: every policy of the new environment corresponds to an ε-soft policy of the original one with the same values, and conversely (at ε = 1 only the uniform policy is ε-soft); and the altered optimality equation has exactly one solution.
Formalization scope
Everything is stated in the namespace SuttonBartoRL.EpsSoft on a finite MDP with four-argument dynamics, one finite nonempty action set for all states (so , the book's footnote 3, p. 48), and a finite reward set. The conventions are:
- is defined from expected discounted returns as with ; Bellman equations are theorems, never definitions. is the one-step lookahead (4.6) on this .
- is the supremum of the new environment's policy values over all stochastic policies, a bounded family for .
- ε ranges over (0, 1]: the book requires ε > 0, and for ε > 1 no ε-soft policy exists. The equality in (5.2) is stated without the book's intermediate division by 1 − ε, so the case ε = 1 is included.
- "Any ε-greedy policy" is encoded by quantifying over every choice of maximizer at every state.
- "Optimal among ε-soft policies" means ε-soft and pointwise at least as good as every ε-soft policy.
Defining as the solution of the Bellman expectation equation, or as the solution of the altered optimality equation, would make milestones 3–5 and the goal's equality half hold by definition; the formalization does neither. The goal is not the statement "" alone: the equality case is part of the book's claim and part of the goal.
The finite-MDP definitions duplicate those of other missions in this series and are expected to be merged later. Useful contributions include the Neumann-series identity , the Bellman expectation equation, the contraction property of Bellman operators, and the correspondence between policies of the new environment and ε-soft policies of the original one; these are reusable for the other finite-MDP missions of the series.
Selected references
- R. S. Sutton and A. G. Barto, Reinforcement Learning: An Introduction, 2nd ed., MIT Press, 2018, ISBN 9780262039246, §4.2 (pp. 76–79) and §5.4 (pp. 100–103). http://incompleteideas.net/book/the-book-2nd.html
- R. A. Howard, Dynamic Programming and Markov Processes, MIT Press, 1960 (policy iteration).
- M. L. Puterman, Markov Decision Processes: Discrete Stochastic Dynamic Programming, Wiley, 1994, doi:10.1002/9780470316887.