Markov Decision Processes
GATE Relevance: High
Prerequisites
🎯 Learning Objectives
- Define MDP components: states, actions, transitions, rewards
- Understand the discount factor and its role
- State and interpret the Bellman equation
- Apply value iteration and policy iteration
- Distinguish MDPs from HMMs and bandits
1. MDP Definition
Markov Decision Process
An MDP is a tuple (S, A, T, R, γ):
- S: Finite set of states
- A: Finite set of actions
- T(s, a, s'): Transition probability P(s' | s, a)
- R(s, a, s'): Reward for transitioning from s to s' via action a
- γ ∈ [0, 1): Discount factor — how much future rewards are worth
Markov Property
The next state depends only on the current state and action, not on the history: P(st+1 | st, at, st-1, at-1, …) = P(st+1 | st, at).
2. Policy and Value Functions
Policy
A policy π: S → A maps each state to an action. An optimal policy π* maximizes expected cumulative discounted reward.
State-Value Function
Vπ(s) = E[∑t=0∞ γt Rt | s0 = s, π]
Bellman Equation for Vπ
Vπ(s) = ∑s' T(s, π(s), s') [R(s, π(s), s') + γ Vπ(s')]
Bellman Optimality Equation GATE Key Formula
V*(s) = maxa ∑s' T(s, a, s') [R(s, a, s') + γ V*(s')]
3. Value Iteration
Value Iteration Algorithm
- Initialize V0(s) = 0 for all s
- Repeat until convergence:
Vk+1(s) = maxa ∑s' T(s, a, s') [R(s, a, s') + γ Vk(s')] - Extract policy: π*(s) = argmaxa ∑s' T(s, a, s') [R(s, a, s') + γ V*(s')]
Example — 2-State MDP GATE Style
States: {A, B}. Action "go": from A → B with prob 0.8, stay A with 0.2. R=+5 for reaching B. γ = 0.9.
Iteration 0: V(A) = 0, V(B) = 0
Iteration 1: V(A) = 0.8 × [5 + 0.9 × 0] + 0.2 × [0 + 0.9 × 0] = 4.0
Iteration 2: V(A) = 0.8 × [5 + 0.9 × V(B)] + 0.2 × [0 + 0.9 × 4.0] = 4.0 + 0.72 = 4.72
Values converge as iterations increase.
4. Policy Iteration
Policy Iteration Algorithm
- Initialize with arbitrary policy π0
- Policy Evaluation: Solve Vπ(s) = ∑s' T(s, π(s), s')[R + γ Vπ(s')] (system of linear equations)
- Policy Improvement: π'(s) = argmaxa ∑s' T(s,a,s')[R + γ Vπ(s')]
- If π' = π, stop (optimal). Else set π = π' and go to step 2.
Value Iteration vs Policy Iteration
| Aspect | Value Iteration | Policy Iteration |
|---|---|---|
| Per iteration | O(|S|2|A|) | O(|S|3 + |S|2|A|) |
| Iterations needed | Many | Few |
| Exact solution | Approximate (converges) | Exact per step |
Summary
- MDP = (S, A, T, R, γ) — framework for sequential decision making under uncertainty
- Bellman equation: recursive relationship between state values
- Value iteration: iterate Bellman update until convergence
- Policy iteration: alternates evaluation & improvement — fewer iterations but each is costlier
- γ controls trade-off between immediate and future rewards