The Bellman equations solve the policy evaluation problem. Given a policy π, how much reward does it collect?
We assume finite state, action spaces, and an infinite horizon with discounted rewards.
A Markov Decision Process (MDP) is a tuple (S,A,P,R,γ) where
S: finite set of states A: finite set of actions P:S×A→Δ(S): transition function, P(s′∣s,a) R:S×A→[0,1]: reward for taking action a in state s γ∈[0,1): discount factor
The objective is the expected discounted total reward E[∑k=0∞γkR(Sk,Ak)]
A stationary policy, π:S→Δ(A) gives a distribution over actions in every state,
and we write a∼π(⋅∣s).
A deterministic policy is the special case where each π(⋅∣s) is a point mass, i.e. just a map π:S→A.
Uner a fixed stationary policy, π, the MDP collapses into a Markov Reward Process which is just a DTMC (Discrete Time Markov Chain) with a reward attached to each state.
Its transition matrix averages the action-wise transitions over the policy:
The value function, Vπ:S→R is the expected discounted reward when we start in s and follow π from then on:
Vπ(s)=E[k=0∑∞γkR(Sk,Ak)S0=s,Ak∼π(⋅∣Sk)]
Since R∈[0,1], each term is at most γk, so 0≤Vπ(s)≤1−γ1 and everything is well defined. The terms are also non-negative, so the expectation and the infinite sum can be swapped by Tonelli's theorem, which we do below without comment.
The Q-function, Qπ:S×A→R is the same quantity, except that we choose the first action ourselves and only follow π after that:
Qπ(s,a)=E[k=0∑∞γkR(Sk,Ak)S0=s,A0=a,Ak∼π(⋅∣Sk) for k≥1]
Computing Vπ or Qπ for a given π is the policy evaluation problem.
Eq.7 holds because of the Markov property and the stationarity of π. Once we get to s′, the rest of the trajectory looks exactly like a start from s′, so its expected return is Vπ(s′).
Substituting each identity into the other gives the Bellman expectation equations: