βˆ‘GateAndNet
PlannerSign Up
ADVANCEDFrequently Tested 4 min read 3 views

Markov Decision Processes (MDP), Bellman Equations & Q-Learning (RL)

Discounted Markov Decision Processes, Bellman Expectation vs Optimality equations, Value Iteration vs Policy Iteration convergence, and On-Policy SARSA vs Off-Policy Q-Learning.

1. Solving Known MDPs: Value Iteration vs Policy Iteration

An MDP is defined by (S,A,T,R,Ξ³)(S, A, T, R, \gamma) where γ∈[0,1)\gamma \in [0, 1) bounds infinite-horizon discounted return Gt=βˆ‘k=0∞γkrt+k+1≀Rmax⁑1βˆ’Ξ³G_t = \sum_{k=0}^\infty \gamma^k r_{t+k+1} \le \frac{R_{\max}}{1 - \gamma}.

Planning MethodPer-Iteration StepTime per IterationExact Convergence
Value IterationNon-linear Bellman optimality update Vk+1←Bβˆ—VkV_{k+1} \leftarrow \mathcal{B}^* V_k$\mathcal{O}(S
Policy Iteration(1) Linear Policy Evaluation (Iβˆ’Ξ³TΟ€)VΟ€=RΟ€(I - \gamma T^\pi)V^\pi = R^\pi + (2) Greedy Policy Improvement$\mathcal{O}(S

2. Model-Free Reinforcement Learning: SARSA vs Q-Learning

When transition probabilities T(s,a,sβ€²)T(s,a,s') and rewards RR are unknown, the agent learns directly from experience tuples (s,a,r,sβ€²,aβ€²)(s, a, r, s', a'):

  • SARSA (On-Policy TD Control): Q(s,a)←Q(s,a)+Ξ±[r+Ξ³Q(sβ€²,aβ€²)βˆ’Q(s,a)]Q(s, a) \leftarrow Q(s, a) + \alpha\big[r + \gamma Q(s', a') - Q(s, a)\big] Uses the actual next action aβ€²a' chosen by the current Ο΅\epsilon-greedy policy (in the classic Cliff Walking environment, SARSA learns the safer upper path away from the cliff because it accounts for Ο΅\epsilon-random slips!).
  • Q-Learning (Off-Policy TD Control): Q(s,a)←Q(s,a)+Ξ±[r+Ξ³max⁑aβ€²Q(sβ€²,aβ€²)βˆ’Q(s,a)]Q(s, a) \leftarrow Q(s, a) + \alpha\big[r + \gamma \max_{a'} Q(s', a') - Q(s, a)\big] Uses max⁑aβ€²Q(sβ€²,aβ€²)\max_{a'} Q(s', a') regardless of exploratory behavior, converging directly to Qβˆ—Q^* (the shortest optimal path right along the cliff edge!).
Key Formulas Summary
Bellman Optimality Equations for V*(s) and Q*(s, a)
Vβˆ—(s)=max⁑a∈Aβˆ‘sβ€²T(s,a,sβ€²)[R(s,a,sβ€²)+Ξ³Vβˆ—(sβ€²)],Qβˆ—(s,a)=βˆ‘sβ€²T(s,a,sβ€²)[R(s,a,sβ€²)+Ξ³max⁑aβ€²Qβˆ—(sβ€²,aβ€²)]V^*(s) = \max_{a \in A} \sum_{s'} T(s, a, s')\big[R(s, a, s') + \gamma V^*(s')\big], \qquad Q^*(s, a) = \sum_{s'} T(s, a, s')\big[R(s, a, s') + \gamma \max_{a'} Q^*(s', a')\big]
Note: Discount factor gamma in [0, 1) makes the Bellman backup a gamma-contraction in L_infinity norm!
Tabular Q-Learning Temporal-Difference (TD) Update
Q(st,at)←Q(st,at)+Ξ±[rt+1+Ξ³max⁑aβ€²Q(st+1,aβ€²)⏟TDΒ Targetβˆ’Q(st,at)]Q(s_t, a_t) \leftarrow Q(s_t, a_t) + \alpha \Big[ \underbrace{r_{t+1} + \gamma \max_{a'} Q(s_{t+1}, a')}_{\text{TD Target}} - Q(s_t, a_t) \Big]
Note: Off-policy: learns optimal Q* even while following an exploratory epsilon-greedy behavior policy!
#Artificial Intelligence#Reinforcement Learning#MDP#Bellman Equation#Q-Learning#SARSA

Practice Questions on This Chapter (2)

Q1GATE DA RLMCQMEDIUM
+2M β€’ -0.67

In tabular Q-Learning with learning rate Ξ±=0.5\alpha = 0.5 and discount factor Ξ³=0.8\gamma = 0.8, suppose Q(s1,a1)=4.0Q(s_1, a_1) = 4.0. Taking action a1a_1 in s1s_1 yields immediate reward r=6.0r = 6.0 and transitions to s2s_2, where max⁑aβ€²Q(s2,aβ€²)=10.0\max_{a'} Q(s_2, a') = 10.0. What is the updated Q(s1,a1)Q(s_1, a_1)?

⚑ Click an option above to verify instantly
Q2GATE DA RLMCQEASY
+1M β€’ -0.33

An agent receives a constant reward of r=+3r = +3 on every step (t=0,1,2,…t = 0, 1, 2, \dots) forever in an infinite-horizon MDP with discount factor Ξ³=0.75\gamma = 0.75. What is the total discounted return G0=βˆ‘k=0∞γkrG_0 = \sum_{k=0}^\infty \gamma^k r?

⚑ Click an option above to verify instantly
Previous TopicFirst-Order Logic Resolution, Bayesian Networks, D-Separation & Markov Blankets