← Back to Reinforcement Learning Mind Map
🎮 Reinforcement LearningID: value-iteration-policy

Value vs Policy Iteration

价值迭代 vs 策略迭代
🎯Core Definition
Value Iteration (VI) iterates the Bellman optimality equation directly with synchronous sweeps over all states: Vk+1(s)=max⁡a∑s′P(s′∣s,a)[r(s,a)+γVk(s′)]V_{k+1}(s) = \max_a \sum_{s'} P(s'|s,a)\left[ r(s,a) + \gamma V_k(s') \right], where VkV_k is the estimate at round kk, max⁡a\max_a performs an implicit greedy improvement, and ∑s′P(s′∣s,a)[⋅]\sum_{s'} P(s'|s,a)[\cdot] is the transition-weighted expectation; each sweep is one step of evaluation plus one step of improvement — VI is policy iteration truncated to a single evaluation step. Because the Bellman operator is a γ\gamma-contraction (∥TV−TU∥∞≤γ∥V−U∥∞\|TV - TU\|_\infty \le \gamma \|V - U\|_\infty), Vk→V∗V_k \to V^* is guaranteed; note intermediate VkV_k need not be the value function of any single policy — only the final greedy policy w.r.t. VkV_k is optimal. Policy Iteration (PI) alternates two steps: ① policy evaluation — iterate the current policy's value function Vπk(s)=∑s′P(s′∣s,πk(s))[r(s,πk(s))+γVπk(s′)]V^{\pi_k}(s) = \sum_{s'} P(s'|s, \pi_k(s))\left[ r(s, \pi_k(s)) + \gamma V^{\pi_k}(s') \right] to convergence (or truncated by tolerance); ② policy improvement — greedy update πk+1(s)=arg⁡max⁡a∑s′P(s′∣s,a)[r(s,a)+γVπk(s′)]\pi_{k+1}(s) = \arg\max_a \sum_{s'} P(s'|s,a)\left[ r(s,a) + \gamma V^{\pi_k}(s') \right].The improvement theorem guarantees Vπk+1≥VπkV^{\pi_{k+1}} \ge V^{\pi_k} monotonically, so PI terminates at the optimal policy on finite MDPs (≤ ∣A∣∣S∣|A|^{|S|} rounds in theory, far fewer in practice).
💡Use Cases
tabular small-scale MDPs with known model P,RP, R (planning problems) — e.g. grid worlds and robot navigation; also the standard interview question distinguishing the two dynamic-programming schools (contrast with model-free DQN).
⚡Key Problems Solved
naive policy search is exponential in ∣A∣∣S∣|A|^{|S|}; PI turns search into polynomial-level iteration via evaluate-improve cycles, converging in tens of rounds with costlier but fewer iterations; VI is cheap per sweep (O(∣S∣2∣A∣)O(|S|^2|A|)) but needs more sweeps — both are different partitions of the same Bellman fixed-point iteration.
🎯Core Interview Exam Points
Fundamentals · Production Scenarios · Deep Dive
Core Def
Explain the core definition, underlying mechanism/math, and key principles of Value vs Policy Iteration.
Use Cases
In production engineering, what are the primary use cases for Value vs Policy Iteration and what core pain points does it solve?
🔥 High-Frequency Deep-Dive Questions
1
Write the value iteration update and explain each term. Why does VI converge to V*?
2
What are the two steps of policy iteration? Why does the improvement theorem guarantee monotonic gains?
3
Compare VI vs PI in complexity and convergence speed. Why does PI need fewer rounds but cost more per round?
4
Is an intermediate Vk necessarily the value function of some policy? How is the final policy extracted?
5
Given a small grid-world MDP, manually run 1-2 sweeps of VI/PI to demonstrate the updates.
Updated 2026-08-12
🎯
Verify Mastery: Practice Exam Questions for "Value vs Policy Iteration"
Take pitfall multiple-choice questions with derivation options; mistakes are automatically logged.
🚀 Start Card Practice ➔
← Previous CardMDP & Bellman EquationsNext Card →MC vs TD Learning

🔗 More Reinforcement Learning Knowledge Cards

引用出处: TalentMe 450+ 工业级 AI 架构考点知识库 (Tech Vault) · 遵循 CC-BY-4.0 知识共享协议
URL: https://talentme.airsota.com/resources/tech/roadmap/mindmap/RL/card/value-iteration-policy
中文速览与面试要点

价值迭代 vs 策略迭代 (Value vs Policy Iteration)

定义: 价值迭代 (VI, Value Iteration) 直接迭代 Bellman 最优方程做全状态同步更新:V_k+1(s) = _a _s' P(s'|s,a) [ r(s,a) + V_k(s') ], 其中 V_k 是第 k 轮估计, _a 隐式做贪婪改进, _s' P(s'|s,a)[ ] 是转移加权期望;每次迭代 = 一步策略评估 + 一步改进, 等价于"截断到一步"的策略迭代。因 Bellman 算子是 -压缩映射 (\|TV - TU\|_ \|V - U\|_ ), V_k V^* 保证收敛;注意中间 V_k 可能不对应任何单一策略的值函数,收敛后才取贪婪策略。策略迭代 (PI, Policy Iteration) 分两步交替: ① 策略评估——迭代求解当前策略的值函数 V^ _k(s) = _s' P(s'|s, _k(s)) [ r(s, _k(s)) + V^ _k(s') ] 直到收敛 (或按容忍度截断);② 策略改进——对新值函数做贪婪更新 _k+1(s) = _a _s' P(s'|s,a) [ r(s,a) + V^ _k(s') ]。改进定理保证 V^ _k+1 V^ _k 单调提升, 因此有限 MDP 上 PI 必然终止于最优策略 (理论上至多 |A|^|S| 轮, 实践远少于此)。 使用场景: 已知模型 P, R 的表格型小规模 MDP (规划问题)——如经典格点世界、机器人导航;也是面试区分动态规划两大流派的标准考题 (与 DQN 等无模型方法对比)。 解决的问题: 朴素策略搜索空间是指数级 |A|^|S|, 不可行;PI 用"评估-改进"交替把搜索转为多项式级迭代,通常几十轮内收敛、每轮更贵但总轮数少;VI 每轮便宜 (O(|S|^2|A|)) 但轮数更多——两者都是 Bellman 不动点迭代的不同切分方式。

核心要点

  • 手推并写出价值迭代的更新公式,逐项解释符号?为什么 VI 能收敛到 V*?
  • 策略迭代的两步是什么?策略改进定理为什么保证单调提升?
  • VI 与 PI 的复杂度与收敛速度对比?为什么 PI 轮数少但每轮贵?
  • VI 迭代中的 Vk 是否一定是某个策略的值函数?最终策略如何取?
  • 给定一个小格点 MDP,手动跑 1-2 轮 VI/PI 演示更新过程?