Skip to content
StackDecode
AI & ML Atlas
Reinforcement LearningconceptInteractive simulation

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.

GOAL +1PIT −1start000000000000000000
  • 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
1/28

Each cell shows its estimated value; arrows show the action the policy would take.

Step by step

  1. 1Pick a state s.
  2. 2Average over the actions the policy might take.
  3. 3For each, add the reward and the discounted value of the next state.
  4. 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.

Related