Value iteration
Optimal Value Function
Expected sum of discounted rewards when starting from state and acting optimally.
From (4,2), the agent must exit and receive −1; the true terminal state reached afterward has value 0.
Let’s assume:
Actions are deterministically successful.
Let’s assume:
Actions successful w/probability 0.8.
optimal value for state when
optimal value for state when
optimal value for state when
Bellman Update
Algorithm:
Start with for all .
For :
For all states :
This is called a value update or Bellman update/back-up.
max returns the best value; argmax returns the action that achieves it. Since the remaining steps use optimal values, choosing this action in each state gives the optimal policy for the remaining horizon.
Value Iteration Convergence
Theorem. For a finite MDP with bounded rewards and , value iteration converges to the optimal value function for the discounted infinite-horizon problem, which satisfies the Bellman optimality equation:
T is the transition probability used in every update. At convergence, both and approach , so the update becomes the Bellman optimality equation.
The Bellman update contracts the maximum value error by a factor of at most each iteration.
Convergence: Intuition
As in the slide, assume and . Here, H is the last included reward index.
This bound holds for every policy, so it also bounds the difference between the optimal values:
The error is squeezed to 0, so the finite-horizon optimal value converges to .
If rewards can be negative, use the maximum absolute reward and bound the error from both sides.
Convergence and Contractions
For the same finite MDP with bounded rewards, take . The idea is that each update brings value estimates closer together, until they reach the same answer.
-
Definition: max-norm
Think of U as a table with one value per state. Take the absolute value of every entry, then pick the largest. If the entries are 1, −3, and 2, the max-norm is 3.
For , compare the two tables state by state and take the largest absolute difference. It measures their biggest disagreement.
-
Definition: An update operation is a γ-contraction in max-norm if and only if
Start with any two value tables, Uᵢ and Vᵢ, and apply the same update to both. Their biggest disagreement afterward is at most γ times what it was before. The index i counts update rounds.
With γ = 0.9, a disagreement of 10 becomes at most 9 after one update, then at most 8.1 after another. “For all” means this must hold for every pair of tables; “if and only if” says this inequality is exactly the definition.
-
Theorem: A contraction converges to a unique fixed point, no matter initialization.
A fixed point is a value table that stays unchanged when the update is applied again. “Converges” means the tables approach it as updates continue. You can initialize the values to 0, 10, or any other finite values and still approach the same table.
There cannot be two different fixed points: the update would have to leave both unchanged while also shrinking the distance between them. Both conditions can hold only when that distance is zero.
-
Fact: the value iteration update is a γ-contraction in max-norm
The Bellman update has exactly this shrinking property. Both tables use the same rewards, so their differences come from the future-value estimates. Taking a probability-weighted average and choosing the best action cannot enlarge the biggest disagreement; multiplying the future value by γ shrinks its bound.
-
Corollary: value iteration converges to a unique fixed point
Combine the theorem with the fact: value iteration is a contraction, so it approaches one fixed point from any finite initialization. That fixed point satisfies the Bellman optimality equation and is the optimal value function V*. The value function is unique; equally good actions can still give multiple optimal policies.
-
Additional fact:
The left side is something we can measure: every state changed by less than ε between the last two rounds. The right side bounds something we do not yet know: the biggest difference between the current table and the optimal table.
Later updates can still change the values, but each change is at most γ times the previous one. Adding all those possible future changes gives the geometric-series factor γ/(1 − γ). The factor 2 makes the slide’s upper bound more conservative.
For γ = 0.9 and ε = 0.001, the slide guarantees an error below 0.018. This gives a stopping rule. As γ gets closer to 1, later changes fade more slowly, so the same ε gives a larger error bound.
Example: Gridworld
The speed of convergence often depends on the discount factor: as it gets closer to 0, value iteration generally converges faster.
Run value iteration until convergence, then extract the policy:
An optimal policy can be chosen stationary: the selected action at a state is the same at all times.
Exercise 1: Effect of Discount and Noise
| Behavior | γ | Noise |
|---|---|---|
| (a) Prefer the close exit (+1), risking the cliff (−10) | 0.1 | 0 |
| (b) Prefer the close exit (+1), but avoiding the cliff (−10) | 0.1 | 0.5 |
| (c) Prefer the distant exit (+10), risking the cliff (−10) | 0.99 | 0 |
| (d) Prefer the distant exit (+10), avoiding the cliff (−10) | 0.99 | 0.5 |
Q-Values
expected utility starting in s, taking action a, and (thereafter) acting optimally.
Bellman Equation:
The first action a is fixed. After reaching s′, choose the action a′ with the highest Q-value. Average the immediate reward plus the discounted future value over all possible next states.
Q-Value Iteration:
The Bellman equation describes the converged Q-values. Q-value iteration computes them: update every state-action pair using the previous round’s Q-values on the right-hand side, and repeat until convergence.
Example: Gridworld
Noise = 0.2, Discount = 0.9, Living reward = 0.
The top, right, bottom, and left triangles show the Q-values for moving up, right, down, and left. At (3,2), their values are approximately 0.57, −0.60, 0.30, and 0.53. Moving up has the highest Q-value.