Optimal Policies and Optimal Value Functions
Policy evaluation asks how well a given policy behaves. Control asks which policy achieves the greatest expected return.
What does optimal mean?
Section titled “What does optimal mean?”A policy is at least as good as if for every state . Two arbitrary policies need not be ordered this way: one can be better in one state and worse in another.
For a finite discounted MDP with bounded rewards, there exists an optimal policy that achieves the best possible value in every state. There may be several optimal policies, but they share the optimal value functions:
In , the first action is fixed to ; optimal behavior begins afterward. Optimality concerns expected return, not a guarantee that every random trajectory earns the largest reward.
Bellman optimality for state value
Section titled “Bellman optimality for state value”Instead of averaging over a given policy’s action choices, choose the action with the highest expected return:
The maximum is over actions. The environment’s possible outcomes are still averaged. The agent cannot choose a lucky outcome directly.
In the gridworld, right and down at Start both give immediate reward −1. Right reaches Hall, from which the next move can earn +5. Down requires a longer route. Looking at the future makes the difference.
Bellman optimality for action value
Section titled “Bellman optimality for action value”After taking action , choose the best action at the next state:
The two optimal value functions satisfy:
As before, terminal future value is zero. The pattern “reward now plus discounted best next value” will return later in Q-learning, where experience supplies samples instead of a full model sum.
Obtain an optimal policy
Section titled “Obtain an optimal policy”If is known, choose any maximizing action:
The membership symbol reminds us that ties can give several valid choices. An optimal policy can choose one consistently or randomize among maximizing actions.
If only is known, choosing an action requires a one-step lookahead using the transition and reward model:
Greedy action selection with the true needs no explicit model at decision time. Learning those values is still a separate problem.
A repeating route: value is not proof of optimality
Section titled “A repeating route: value is not proof of optimality”Consider a different, continuing gridworld with a special transition from to that pays +10. Suppose a chosen policy then takes four zero-reward moves back to and repeats. Its reward sequence is .
With , the value of this route is:
Equivalently, . This calculation evaluates the repeating route. Calling it would additionally require checking that no alternative route or action has greater value under the complete environment rules.
This continuing example is separate from the chapter’s Start–Hall–Goal gridworld, which ends on reaching Goal.
From evaluation to improvement
Section titled “From evaluation to improvement”In a finite discounted MDP, exact policy iteration alternates between evaluating a policy and choosing actions greedily with respect to its values. Retaining the current action when it already maximizes value avoids unnecessary switching between tied actions.
flowchart TD
accTitle: Policy iteration
accDescr: Evaluate a policy, improve it while retaining maximizing actions on ties, and repeat until the policy stops changing.
initial["Choose an initial policy"] --> evaluate["Evaluate the policy"]
evaluate --> improve["Choose greedy actions; retain current action on ties"]
improve --> stable{"Is the policy unchanged?"}
stable -->|"No"| evaluate
stable -->|"Yes"| optimal["Optimal policy"]
Dynamic programming develops policy iteration and value iteration. This section defines the optimal values those methods seek.
Reference
Section titled “Reference”Sutton, R. S. & Barto, A. G. Reinforcement Learning: An Introduction, 2nd ed., chapter 3, section 3.6. The explanations and small worked examples here are written for these notes.
Previous: 3.5 Policies and Value Functions · Next: 3.7 Optimality and Approximation