Contents · Reinforcement Learning Theory
Part 0 · MDPs
- MDPs, Returns, and Value Functions
Part 1 · Bellman & Value Iteration
Part 2 · Policy Gradients
Part 3 · Trust Regions
Part 4 · Actor-Critic
Part 0 · MDPs
MDPs, Returns, and Value Functions
A physics simulator already gives you the hard part of a decision problem: a step function that maps a state and an action to a next state. Add a scalar reward on each step and you have a Markov decision process. The first question is not how to act well but how to grade a fixed way of acting: given a policy, how good is each state? That grade is the value function, and computing it is policy evaluation. Choosing a better policy comes later; here we only measure.
The Markov decision process
An MDP is a tuple . The states and actions are the configurations and controls. The transition kernel
is the simulator's step, promoted to a distribution to allow stochastic dynamics. The reward is the scalar earned on that step, and discounts the future. The defining assumption is Markov: depends on the past only through the current , which is exactly what a state-based simulator guarantees.
A policy is a distribution over actions in each state. Fix one and the MDP collapses to a Markov reward process: the dynamics and the expected reward are both determined.
Return and value functions
The agent cares about the return, the discounted sum of future reward from time ,
The factor makes reward steps away worth times as much, and keeps the sum finite whenever rewards are bounded. The state-value function is the expected return from a state under ,
and the action-value function conditions on the first action as well,
The two are tied by the policy: averaging over the action the policy would take recovers ,
answers "how good is this state if I keep acting like ?", not "how good could this state be?". Those are different questions, and only the first is on the table until we start improving .
The Bellman expectation equation
Split the return into the immediate reward and the discounted return from the next state, . Taking expectations under turns this recursion into a linear equation in :
This is the Bellman expectation equation.1 It is not a maximization: there is no over actions, only an average over the actions the fixed policy actually takes and over the successors the dynamics actually produce. The action-value form is the same statement one step in,
Policy evaluation
Write the right-hand side as an operator acting on a value estimate ,
is its fixed point, . Because , the operator is a contraction in the max norm,
so the iteration from any starting converges to the unique at rate . That iteration is iterative policy evaluation: repeatedly apply the Bellman expectation update until stops moving.
Worked example: a three-state chain
Take three states with terminal, so always, and . Fold a fixed policy into the dynamics so each state has a known transition and reward:
Start from and apply . The first sweep uses only immediate rewards, since every :
The second sweep feeds back in, so value now flows one hop:
has moved and has settled , both heading for the exact fixed point. Solving directly gives
so , hence and . Two sweeps already land in the right neighborhood, and the contraction closes the rest of the gap geometrically.
Evaluation on a grid
The same update runs on a 2D gridworld MDP: every step costs , entering the goal pays , and the goal is terminal. Two fixed policies are on offer, a greedy walk toward the goal and the uniform-random walk. Neither is being improved. Iterative policy evaluation just applies until convergence and reports how good each cell is under that one policy.
- max change |ΔV|
- 0.000
- far corner V
- -2.25
The greedy policy walks straight to the goal, so value stays high and drops off slowly. Drag k back to 0 to watch V spread out from the goal one sweep at a time.
Read the greedy field against the random one and the point is immediate: the value of a state is a property of the policy, not of the state alone. The random walk reaches the same goal but pays the step cost far longer, so its is uniformly lower. Deciding which policy is better, and how to construct the best one, is the optimization problem the Bellman optimality equation takes up next.
Footnotes
-
Sutton & Barto, Reinforcement Learning: An Introduction (2018). ↩