(其实是专业课作业 感觉算法岗面试可能会问,来存一下档)

问题:证明 Value Iteration 收敛性

Please prove the convergence of Value Iteration algorithm in discounted reward setting, and analyze the performance between resulting policy and optimal policy. 证明 Value Iteration 的收敛性。

背景:

  • Policy Iteration:先得到一个 policy,然后算出它的 value function,基于该 value function 取 max_a Q(s,a) 作为新 policy,再算新 policy 的 value function…
  • Value Iteration:不停对 value function 使用贝尔曼算子,新 V = max_a [r(s,a) + γV(s')]。

0 Definitions - 定义

First, we define

  • Discrete state space \(S=\{s_1,\cdots,s_n\}\), discrete action space \(A=\{a_1,\cdots,a_n\}\).
  • Value function: \(V(s)=E_{a\sim\pi(a|s)}\big[r(s,a) + \gamma E_{s'\sim p(s'|s,a)}V(s')\big]\) .
  • Bellman operator: for all \(s\in S\) ,
\[\begin{aligned}
B_\pi V(s) &\triangleq E_{a\sim\pi(a|s)}\big[r(s,a)+\gamma E_{s'\sim p(s'|s,a)}V(s') \big]
\\
B_* V(s) &\triangleq \max_a \big[r(s,a)+\gamma E_{s'\sim p(s'|s,a)}V(s') \big]
\end{aligned}
\]

The Value Iteration algorithm is to conduct Bellman operator \(B_*\) on the value function \(V(s)\). We want to prove that the sequence will converge to the optimal value function \(V^*\), which should be the of the Bellman equation \(B_*V=V\) .

我们定义了状态空间、动作空间、值函数(value function)和贝尔曼算子(Bellman operator)。VI 算法,就是对 value function 一直使用 Bellman operator,希望最后能收敛到最优的 value function。这样,该最优 value function 必然是 Bellman equation \(B_*V=V\) 的不动点。

1 Bellman operator is a Contraction Mapping - 贝尔曼算子是压缩映射

Then, we need to prove that Bellman Operator is a Contraction Mapping. The definition of Contraction Mapping is as follows:

\[d(f(x_1),f(x_2))\le\gamma d(x_1,x_2),
\]

where \(d\) is a measurement over a metric space, \(\gamma\in(0,1)\), and \(f\) is the Contraction Mapping. In our case, the definition of Contraction Mapping is as follows:

\[|f(x_1)-f(x_2)|_\infty \le \gamma|x_1-x_2|_\infty,
\]

where \(||_\infty\) is the infinite norm (return the max value over all dimensions of a vector).

接下来,证明贝尔曼算子是压缩映射(Contraction Mapping)。在这里,压缩映射的定义是,两个变量的无穷范数(向量各维之差的最大绝对值)会被 \(f\) 映射压缩 \(\gamma\) 倍。

Let's prove that Bellman Operator \(B_*\) is a Contraction Mapping. The proof is as follows.

\[\begin{aligned}
&|B_*V_1(s)-B_*V_2(s)| \\
&=\bigg|\max_a\big[r(s,a)+\gamma E_{s'~p(s'|s,a)}V_1(s')\big] - \max_a\big[r(s,a)+\gamma E_{s}V_2(s')\big] \bigg| \\
&\le \bigg| \max_a[r(s,a) + \gamma E_{s'}V_1(s') - r(s,a) - \gamma E_{s'}V_2(s')]\bigg| \\
&= \bigg|\gamma\max_a E_{s'}(V_1(s')-V_2(s'))\bigg| \\
&\le \gamma\max_a\bigg|E_{s'}(V_1(s')-V_2(s'))\bigg| \\
&= \gamma\max_a \bigg|\sum_{s'}p(s'|s,a)\big[V_1(s')-V_2(s')\big]\bigg| \\
&\le \gamma\max_a \sum_{s'}p(s'|s,a)\bigg|V_1(s')-V_2(s')\bigg| \\
&= \gamma \sum_{s'}p(s'|s,a_*(s))\bigg|V_1(s')-V_2(s')\bigg| \\
&\le \gamma \sum_{s'}p(s'|s,a_*(s))\max_s\bigg|V_1(s)-V_2(s)\bigg| \\
&= \gamma|V_1-V_2|_\infty
\end{aligned}
\]

贝尔曼算子是压缩映射的证明:一连串放缩,如上。

2 Contraction Mapping converges to the optimal value function - 压缩映射能收敛到最优值函数

If Bellman Operator is a Contraction Mapping, then we can use the Banach fixed point theorem to prove that, the optimal value function \(V^*\) is the unique fixed point of the Bellman Operator \(B_*\), and the sequence \(B_*(B_*(\cdots B_*V))\) converges to \(V^*\).

如果贝尔曼算子是压缩映射,则可以用巴拿赫不动点定理(Banach fixed point theorem),证明 \(V^*\) 是 Bellman Equation \(B_*V=V\) 的唯一不动点,并且一定会收敛到该不动点。

The first step is to prove that the fixed point \(V^*\) is unique. Use proof by contradiction. Suppose there are two converged value \(V_1^*,V_2^*\), then we have \(|B_*V_1^*-B_*V_2^*|_\infty=|V_1^*-V_2^*|_\infty\). However, Bellman operator \(B_*\) is a Contraction Mapping, so there is \(|B_*V_1^*-B_*V_2^*|_\infty\le\gamma|V_1^*-V_2^*|_\infty\), which contradicts the previous one. Thus, there can be only one converged value, and it is obviously the fixed point \(V^*\).

第一步,证明收敛到的不动点是唯一的。使用反证法,假设有两个不动点,那么它们俩的压缩映射都映射到原地(不动点嘛),距离没有 γ 倍压缩,矛盾,从而得证。

The second step is to prove that the fixed point \(V^*\) really exists. If we can prove that \(\{V,B_*V,B_*^2V,\cdots\}\) is a Cauchy sequence, the fixed point \(V^*\) exists. Take two value \(B_*^a,B_*^b\) from the sequence, where \(a\gg b\). Use the triangle inequality of \(||_\infty\) as a measurement, we can get

\[\begin{aligned}
|B_*^a-B_*^b|_\infty &\le |B_*^a-B_*^{a-1}|_\infty + |B_*^{a-1}-B_*^b|_\infty
\\
&\le |B_*^a-B_*^{a-1}|_\infty + |B_*^{a-1}-B_*^{a-2}|_\infty + |B_*^{a-2}-B_*^b|_\infty
\\
&\le |B_*^a-B_*^{a-1}|_\infty + \cdots + |B_*^{b+1}-B_*^b|_\infty
\\
&\le \gamma^b|B_*V-V|\sum_{i=0}^{a-b-1}\gamma^i
\le \frac{\gamma^b}{1-\gamma}|B_*V-V|
\end{aligned}.
\]

So, if we can choose a large enough \(b\), the value of \(|B_*^a-B_*^b|_\infty\) can be less than any \(\epsilon\gt0\). Thus, there must exists an \(N\in\mathbb N\), such that \(|B_*^a-B_*^b|_\infty\lt\epsilon\), for all \(a,b\gt N\) . The sequence is a Cauchy sequence, and the fixed point \(V^*\) exists.

第二步,证明不动点 \(V^*\) 存在。去证 \(\{V,B_*V,B_*^2V,\cdots\}\) 是柯西序列(Cauchy sequence),如果是柯西序列,那么就存在收敛的不动点。柯西序列的定义是,对于序列里的 \(x_a,x_b\),存在正整数 N 使得对于任意 \(a,b\gt N\),度量 \(d(x_a,x_b)\lt\epsilon\),其中 \(\epsilon\) 是任意小的正实数。先使用三角不等式,将 \(x_a-x_b\) 的形式拆成 \((x_a-x_{a-1})+(x_{a-1}-x_{a-2})+\cdots+(x_{b+1}-x_b)\),然后使用压缩映射的性质,放缩成 γ 的等比序列求和,即可得到,它小于任意的小实数。

Reference - 参考资料

RL 基础 | Value Iteration 的收敛性证明的更多相关文章

  1. K-Means算法的收敛性和如何快速收敛超大的KMeans?

    不多说,直接上干货! 面试很容易被问的:K-Means算法的收敛性. 在网上查阅了很多资料,并没有看到很清晰的解释,所以希望可以从K-Means与EM算法的关系,以及EM算法本身的收敛性证明中找到蛛丝 ...

  2. 再论EM算法的收敛性和K-Means的收敛性

    标签(空格分隔): 机器学习 (最近被一波波的笔试+面试淹没了,但是在有两次面试时被问到了同一个问题:K-Means算法的收敛性.在网上查阅了很多资料,并没有看到很清晰的解释,所以希望可以从K-Mea ...

  3. [ML从入门到入门] 支持向量机:从SVM的推导过程到SMO的收敛性讨论

    前言 支持向量机(Support Vector Machine,SVM)在70年代由苏联人 Vladimir Vapnik 提出,主要用于处理二分类问题,也就是研究如何区分两类事物. 本文主要介绍支持 ...

  4. 【题解】CF24D Broken Robots(收敛性)

    [题解]CF24D Broken Robots http://codeforces.com/problemset/problem/24/D 解1(不会写,口胡的) 获得一个比较显然的转移式子 \(dp ...

  5. 51nod1674:区间的价值2(分治,利用&和|的收敛性)

    lyk拥有一个区间. 它规定一个区间的价值为这个区间中所有数and起来的值与这个区间所有数or起来的值的乘积. 例如3个数2,3,6.它们and起来的值为2,or起来的值为7,这个区间对答案的贡献为2 ...

  6. 2020-BUAA OO-面向对象设计与构造-HW11中对ageVar采用缓存优化的等价性证明(包括溢出情况)

    HW11中对ageVar采用缓存优化的等价性证明(包括溢出情况) 概要 我们知道,第三次作业里age上限变为2000,而如果缓存年龄的平方和,2000*2000*800 > 2147483647 ...

  7. CSS+DIV入门第一天基础视频 CSS选择器层叠性和继承性

    大家好,我是小强老师, 现在网上的CSS+DIV视频,要么讲的太深,要么太浅,很多初学的同学们总是遇到困难,今天小强老师专门给大家准备了css课程的视频.带你从零基础学习CSS+DIV一直到能独立完成 ...

  8. java并发基础(六)--- 活跃性、性能与可伸缩性

    <java并发编程实战>的第9章主要介绍GUI编程,在实际开发中实在很少见到,所以这一章的笔记暂时先放一放,从第10章开始到第12章是第三部分,也就是活跃性.性能.与测试,这部分的知识偏理 ...

  9. e的存在性证明和计算公式的证明

    \(\quad\quad前言\quad\quad\\\) \(此证明,改编自中科大数分教材,史济怀版\\\) \(中科大教材,用的是先固定m,再放大m,跟菲赫金哥尔茨的方法一样.\\\) \(而我这里 ...

  10. KL散度非负性证明

    1 KL散度 KL散度(Kullback–Leibler divergence) 定义如下: $D_{K L}=\sum\limits_{i=1}^{n} P\left(x_{i}\right) \t ...

随机推荐

  1. 基于 Probe 的实时全局光照方案(Probe-based Global Illumination)

    目录 Precomputed Probe 预放置 probes 四面体镶嵌(Tetrahedral Tessellations) Indirect Light Cache Volumetric Lig ...

  2. 巧用 bc 命令测试 Linux 主机的 CPU 性能

    今天向公司申请了一台 Linux 主机,作为平时的开发环境.由于自己并不依赖远程开发(大多数情况下项目都可以本地开发.调试),于是只申请了 4C/8G 的低配机器. 突然好奇的是,这台机器的性能怎么样 ...

  3. Unity UGUI的CanvasScaler(画布缩放器)组件的介绍及使用

    Unity UGUI的CanvasScaler(画布缩放器)组件的介绍及使用 1. 什么是CanvasScaler组件? CanvasScaler是Unity中UGUI系统中的一个组件,用于控制画布的 ...

  4. PostgreSQL 9.6 文档: 数据类型

    章 8. 数据类型 目录 8.1. 数字类型 8.1.1. 整数类型 8.1.2. 任意精度数字 8.1.3. 浮点类型 8.1.4. 序数类型 8.2. 货币类型 8.3. 字符类型 8.4. 二进 ...

  5. jmeter:内存溢出解决办法

    使用jmeter执行性能测试,报错:java.lang.OutOfMemoryError: Java heap space 需要对jmeter的jvm进行调优.记录如下: 1. 问题记录及分析: 使用 ...

  6. SQL技巧:WITH RECURSIVE递归运算

    SQL技巧:WITH RECURSIVE递归运算 1.累加求和运算 -- 计算递归 WITH RECURSIVE t(n) AS (     VALUES (1)   UNION ALL     SE ...

  7. WPF 自定义窗体(一)

    .Net默认的窗体样式只有四种:None.SingleBorderWindow.ThreeDBorderWindow.ToolWindow,都比较"丑".而很多时候,我们希望自定义 ...

  8. 基于 LLM 的知识图谱另类实践

    本文整理自社区用户陈卓见在「夜谈 LLM」主题分享上的演讲,主要包括以下内容: 利用大模型构建知识图谱 利用大模型操作结构化数据 利用大模型使用工具 利用大模型构建知识图谱 上图是之前,我基于大语言模 ...

  9. MindSponge分子动力学模拟——Constraint约束

    技术背景 在前面的几篇博客中,我们已经介绍了MindSponge的基本使用方法,比如定义一个分子系统.计算分子的单点能以及迭代器的使用等.有了这些基础的教程,用户以及可以执行一些比较简单的模拟任务,比 ...

  10. jQuery提交表单

    $('#myform').form('submit',{ url: "login.action", onSubmit:function(){ return $('#myform') ...