An MDP has non-terminal states A and B, and γ=0.9. In A, action a1 gives reward 2 and ends the episode. Action a2 gives reward 0, and moves to B with probability 0.8 or stays in A with probability 0.2. In B, action b1 gives reward 4 and ends the episode. Action b2 gives reward 0 and moves to A. Starting from V0=0, what are the results of three sweeps of value iteration, and then what are V∗ exactly and the optimal policy?

Reinforcement learning, Dynamic programming
Level L3 Intermediate. Length Long. Nature Mat Mathematical.

What's being asked

Whether you can apply the Bellman optimality backup with stochastic transitions, and then solve for the exact fixed point.

Key idea

Value iteration applies Vk+1(s)=max⁡a∑s′P(s′∣s,a)[r+γVk(s′)] to every state. It converges to V∗ because the backup is a γ-contraction.

Steps

  1. Sweep 1 (all V0=0): V1(A)=max⁡(2, 0)=2, V1(B)=max⁡(4, 0)=4.
  2. Sweep 2. For A: Q(A,a2)=0.9 (0.8×4+0.2×2)=0.9×3.6=3.24. So V2(A)=max⁡(2,3.24)=3.24. For B: Q(B,b2)=0.9×2=1.8, so V2(B)=max⁡(4,1.8)=4.
  3. Sweep 3. For A: Q(A,a2)=0.9 (0.8×4+0.2×3.24)=0.9×3.848=3.4632. So V3(A)=3.4632. For B: Q(B,b2)=0.9×3.24=2.916<4, so V3(B)=4.
  4. Find V∗. Guess that B takes b1, so V∗(B)=4, and check this in the next step. For A with a2: V=0.9 (0.8×4+0.2 V), so V(1−0.18)=2.88 and V∗(A)=2.88/0.82≈3.512. This beats a1's value of 2.
  5. Check the B decision: b2 would give 0.9×3.512=3.16<4. The optimal policy is a2 in A and b1 in B.
  6. Note the sequence for A: 2,3.24,3.463,⋯→3.512. The error in V(A) goes 0.272 then 0.049, shrinking by a factor 0.9×0.2=0.18 per sweep once V(B) is exact, which is consistent with contraction.

Common mistakes

How long your answer should be

About a page, with a three-row table; 6–8 minutes.

Last checked on 4 December 2026.

Read this

Previous in Reinforcement learning: An MDP has two states X and Y and γ=0.5. In X, action a gives reward 2 and moves to Y, while action b gives reward 1 and stays in X. In Y, action c gives reward 0 and moves to X, while action d gives reward 3 and stays in Y. Run policy iteration from the policy "b in X, c in Y". What are the evaluation and improvement steps, and what are the optimal policy and values?
Next in Reinforcement learning: A Markov reward process has two states with transition matrix P=(010.50.5), expected rewards R=(0,1)⊤ and γ=0.5. What is the Bellman equation in matrix form, what is its solution for V, and why does a unique solution exist for any γ<1?