Bellman Equation
The value of a state equals the immediate reward plus the discounted value of what follows.
The idea
The recursion at the heart of RL: V^π(s) = Σ π(a|s) Σ P(s′|s,a) [r + γ V^π(s′)]. It splits the long-term return into one step plus the (discounted) value of the next state, turning an infinite sum into a self-consistency condition that can be solved or iterated.
V^π(s) = Σₐ π(a|s) Σₛ′ P(s′|s,a)[r + γ V^π(s′)]
Watch it run
This is a real computation, not a drawing. Pause, step, change the settings, or try new random data.
- positive value
- negative value
- best action
Every state starts with value zero. A state's value is the total future reward expected from it.
- sweep:
- 0
Each cell shows its estimated value; arrows show the action the policy would take.
Step by step
- 1Pick a state s.
- 2Average over the actions the policy might take.
- 3For each, add the reward and the discounted value of the next state.
- 4The result must equal V(s); iterate until it does.
Where it is used
The basis of every value-based RL method.
Watch out for
Requires the Markov property: the future must depend only on the current state.