Dynamic Programming in RL

1 min read

Dynamic programming solves MDPs exactly when the model (PP, RR) is known. Foundation for understanding all RL algorithms.

Policy Evaluation — compute VπV^\pi for a given policy: Iterate: Vk+1(s)=aπ(as)[R(s,a)+γsP(ss,a)Vk(s)]V_{k+1}(s) = \sum_a \pi(a|s)[R(s,a) + \gamma\sum_{s'}P(s'|s,a)V_k(s')] Converges to VπV^\pi as kk \to \infty.

Policy Improvement — make the policy greedy w.r.t. current value: π(s)=argmaxa[R(s,a)+γsP(ss,a)Vπ(s)]\pi'(s) = \arg\max_a [R(s,a) + \gamma\sum_{s'}P(s'|s,a)V^\pi(s')] Guaranteed to be at least as good as π\pi (policy improvement theorem).

Policy Iteration:

  1. Evaluate current policy (policy evaluation)
  2. Improve policy greedily (policy improvement)
  3. Repeat until convergence Always converges to optimal policy in finite steps.

Value Iteration: Combine evaluation and improvement in one step: Vk+1(s)=maxa[R(s,a)+γsP(ss,a)Vk(s)]V_{k+1}(s) = \max_a [R(s,a) + \gamma\sum_{s'}P(s'|s,a)V_k(s')] This is iterating the Bellman optimality equation. Converges to VV^*.

Limitation: requires full knowledge of P(ss,a)P(s'|s,a) and R(s,a)R(s,a), and iterates over all states — only works for small, discrete MDPs. Model-free methods (Q-Learning, Miscoral Difference Learning) remove these requirements.

See also: Bellman Equations, Value Functions, Markov Decision Process

Linked from