Value iteration
Decisions under uncertainty · 1957 · After Markov decision processes
Value iteration solves a known MDP by repeatedly improving a guess of how good every state is, until the guess stops changing.
Decisions under uncertainty
Value Iteration
If you knew how good every square was, the best move would be obvious: step towards the best expected square. But how good a square is depends on the moves you'll make from it. Value iteration breaks the loop by guessing, then fixing the guess, over and over.
Same 4×3 gridworld as Markov decision processes. Here T and R are known, so the robot never moves: it computes.
1 · The Bellman equation
A square is worth its best move
The equation is circular: V* appears on both sides. Value iteration doesn't solve it directly. It plugs in a guess on the right, computes a better guess on the left, and repeats. The quantity inside the max, before choosing, is the Q-value Q*(s,a): how good it is to take action a in s and act well afterwards.
2 · Run it
Watch value flow out from the exits
Lab 1 · Sweep by sweep
numbers are Vk; arrows are the best action under the current valuesLargest change per sweep (log scale)
With the textbook settings (γ = 1, noise 0.2, r = −0.04) the values settle to 0.812, 0.868, 0.918 along the top row, 0.762 and 0.660 in the middle, and 0.705, 0.655, 0.611, 0.388 along the bottom: the same numbers the standard AI textbook prints for this grid.
3 · Rewards shape behaviour
Change one number, get a different personality
The living reward is the cost of each step. Changing it changes what “best” means. Try each and watch the arrows (with γ = 1 and noise 0.2):
When living is painful, the robot jumps off the board even through the −1 exit. When living costs almost nothing, it walks into a wall rather than risk slipping into −1, because bumping is free and safe. With a positive living reward and no discount, it never leaves, and the values grow without limit: exactly the case discounting exists to fix.
4 · Why it settles
Each sweep shrinks the error by at least γ
With γ < 1, one sweep brings every square's value at least a factor γ closer to the true V* (the update is a contraction). So the error falls geometrically, a straight line on the log chart above, and the answer is unique whatever the starting guess. With γ = 1 it still converges here because every policy that matters eventually exits, but slower, and not at all when living pays.
The policy often stops changing long before the values do. That observation is the idea behind policy iteration.
5 · Where it reaches its limits
Every state, every sweep
Value iteration touches every state and every action in every sweep, and it needs T. Eleven squares is nothing; a Go board has about 2×10170 legal positions. Large problems swap the table for a network and the full sweep for search from the current state, like Monte Carlo tree search, and swap the known T for a learned world model or for learning from experience with Q-learning.
Next: Policy iteration