Skip to content
StackDecode
AI & ML Atlas
Reinforcement LearningalgorithmInteractive simulation

Dynamic Programming

Solves a known Markov decision process by repeatedly applying Bellman updates.

The idea

If you know the transition and reward model exactly, you can compute optimal values without any trial and error. Dynamic programming sweeps over all states, replacing each value with the Bellman backup of its neighbours' values, until nothing changes. Policy iteration and value iteration are the two classic versions.

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/10

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

Step by step

  1. 1Initialise the values.
  2. 2Sweep all states, updating each with the Bellman equation.
  3. 3Repeat until the values stop changing.
  4. 4Extract the greedy policy.

Where it is used

Planning with a known model, small MDPs, and as a conceptual base for RL.

Watch out for

Needs the full model and a sweep over every state, which is infeasible for large problems.

Related