lecture18

今天來討論我最喜歡的算法之一,用以控制MDP,我覺得是一個優雅、高效、強大的算法。先討論MDP的幾個常見變種(與現有的MDP定義會有不同)。

Agenda

state-action rewards

finite horizon MDPs

linear dynamical systems 線性動力系統

-models

-linear quadratic regulation(LQR) 線性二次型調節控制

just a recap:MDP is a five tuple(下圖給出一般性的定義,然后做一些改動,生成variations)

首先在reward function上做一些改動,使之不僅僅是states的函數,而且還是action的函數。記得在上一講時,我說過對於無限連續狀態的MDP,不能直接應用value iteration,因為對於continuous MDP, we use some approximations of the optimal value function. But later, we’ll talk about a special case of MDPs, where you can actually represent the value function exactly, even if you have an infinite-state space or even if you have a continuous-state space. I’ll actually do that, talk about these special constants of infinite-state MDPs, using this new variations of the reward function and the alternative to just counting, so start to make the formulation a little easier.

first variation: state-action reward 比如機器人動起來比靜止麻煩,所以reward和action也有關系了。

second variation: finite horizon MDP

圖中說到的optimal policy may be non-stationery(非平穩的),that is to say, my optimal action to take will be different for different time steps. 然后舉了一個例子(見黑板右下的方框內)

Since we have non-stationery optimal policy ,I’m going to allow non-stationery transition probabilities (非平穩過渡概率)as well. 比如說飛機,飛久了燃料就少了,轉移概率就是時變的。

So now we have a non-stationery optimal policy, let’s talk about an algorithm to actually try to find the optimal policy. Let’s define the following.(圖中的value function start increasingly from time t and end at time T), and write out the value iteration algorithm(橫線下面).

事實上,有一個很漂亮的dynamics programming algorithm(動態規划算法)來解決,從T開始,反向計算。

有人提問,finite horizon MDP 沒有了discounting 那一項,也就是γ(用以調節reward隨時間衰減的)

Andrew: usually use either finite horizon MDP or discounting, not the both. 其實二者在作用上又一些共同,都可以保證value function 是有限的。

以上就是finite horizon MDP

下面綜合以上兩種idea來提出一種special MDP(雖然有着strong assumptions , but are reasonable),along with a very elegant and effective algorithm to solve the even very large MDP.

LQR

要用到和finite horizon MDP 一樣的動態規划算法。specify the problem first, assume A B W are given, our goal is to find an optimal policy. 另外,圖中的noise (W)其實並不重要,所以后面的可能會忽略,或者處理的比較馬虎。

assume Ut and Vt are positive semi definite(半正定的),從而reward 函數總是負的。

對於以上,for a complete example(以便理解), suppose you have a helicopter : want St 盡可能等於0

接下來的幾個步驟 I’m going to derive things for the general case of non-stationary dynamics(非穩態動力學),會有更多的數學和equations for LQR, I’m going to write out the case for the fairy general case of time varied dynamics and time varied reward functions.為了便於理解,你們可以忽略一些帶有時間下標的符號,假想是固定的。

然后會講extension of this called differential dynamic programming(微分動態規划的擴展)

先講一下how to come up with a linear model. The key assumption in the model is that the dynamics are linear. There is also the assumption that reward function is quadratic.

If you have an inverted pendulum system, and you want to model the inverted pendulum using a linear model like this…

another way to come up with a linear model is to linearize a nonlinear model.(需要注意的問題是:應該在期望工作點附近線性化,比如倒立擺的豎直位置,否則遠端的誤差太大了。)

write it(linearize a nonlinear model)in math, first write the simple case and the fully general one in a second.

now I’ll post a LQR problem, given A B U V, then our goal is to come up with a policy to maximize the expected value of this rewards.

算法正是早先提到的用於解決 finite horizon 的動態規划算法。

下圖中的(because …≥0)是因為VT矩陣是半正定的,最后時刻T肯定希望沒有動作。

好了,現在讓我們做動態規划的步驟(DP steps):簡單說就是given V*t+1想要求V*t

It turns out LQR has following useful property, it turns out each of these value function can be represented as a quadratic function . (不理解??)

所以你可以這樣開始遞歸

St狀態的value function 等於t時刻的即時reward和St+1時刻的reward的期望。。。

對at求導可得optimal action(some linear combination of states St,或者一個矩陣Lt乘以St)

然后把at放回去,做maximization,你會得到這個,其中迭代公式的名稱叫做Discrete time Riccati equatoin :

So, to summarize, our algorithm for finding the exact solution to finite horizon LQR problems is as follows.

Andrew在總結時的一段話:

So the very cool thing about the solution of discrete time LQR problems finite horizon LQR problems is that this is a problem in an infinite state, with a continuous state. But nonetheless, under the assumptions we made, you can prove that the value function is a quadratic function of the state. Therefore, just by computing these matrixes phi(t) and the real number psi(t), you can actually exactly represent the value function, even for these infinite large state spaces, even for continuous state spaces. And so the computation of these algorithms scales only like the cubes, scales only as a polynomial in terms of the number of state variables… it’s easily applied to problems with even very large states spaces, so we actually often apply variations of this algorithm to some subset, to some particular subset for the things we do on our helicopter, which has high dimensional state spaces with twelve or higher dimensions. This has worked very well for that.

So it turns out there are even more things you can do with this…

關於這個還有一些很精妙的結論,下講我再講。

lqr算法 c语言,【CS229 lecture18】linear quadratic regulation(LQR) 線性二次型調節控制相关推荐

  1. 线性回归学习算法c语言实现_线性搜索算法及其C语言实现

    线性回归学习算法c语言实现 Linear Search is basically a sequential search algorithm. 线性搜索基本上是一种顺序搜索算法 . In this a ...

  2. 密码学:c/c 语言实现 pdf,典型密码算法C语言实现pdf

    典型密码算法C语言实现 内容简介 <典型密码算法C语言实现>详细讲述了一些典型密码算法的算法原理及C语言实现.书中密码算法包括:序列密码.分组密码.公钥密码和Hash算法,其中序列密码有祖 ...

  3. 自动驾驶规划控制(A*、pure pursuit、LQR算法,使用c++在ubuntu和ros环境下实现)

    文章目录 1 目录概述 2 算法介绍 2.1 Astart改进 2.2 ROS(Gazebo仿真) 2.2.1 使用Gazebo仿真需要安装的功能包 2.2.2 创建工作空间 catkin_ws 2. ...

  4. c语言贝叶斯分类,基于朴素贝叶斯分类器的文本分类算法(C语言)

    基于朴素贝叶斯分类器的文本分类算法(C语言) 基于朴素贝叶斯分类器的文本分类算法(C语言).txt两个人吵架,先说对不起的人,并不是认输了,并不是原谅了.他只是比对方更珍惜这份感情.#include ...

  5. 《数据结构与算法 C语言版》—— 3.8习题

    本节书摘来自华章出版社<数据结构与算法 C语言版>一 书中的第3章,第3.8节,作者:徐凤生,更多章节内容可以访问云栖社区"华章计算机"公众号查看. 3.8习题 1名 ...

  6. 《数据结构与算法 C语言版》—— 2.5上机实验

    本节书摘来自华章出版社<数据结构与算法 C语言版>一 书中的第2章,第2.5节,作者:徐凤生,更多章节内容可以访问云栖社区"华章计算机"公众号查看. 2.5上机实验 实 ...

  7. 《数据结构与算法 C语言版》—— 2.7习题

    本节书摘来自华章出版社<数据结构与算法 C语言版>一 书中的第2章,第2.7节,作者:徐凤生,更多章节内容可以访问云栖社区"华章计算机"公众号查看. 2.7习题 1描 ...

  8. 狄斯奎诺算法 c语言,图的邻接表实现迪杰斯特拉算法(C语言).doc

    图的邻接表实现迪杰斯特拉算法(C语言) /*迪杰斯特拉算法(狄斯奎诺算法)解决的是从源点到其它所有顶点的最短路径问题*/ //算法实现: #include #include #define MAX 2 ...

  9. 每日算法C语言1-求某整数

    每日算法C语言 题目 一个整数,它加上100后是一个完全平方数,再加上168又是一个完全平方数,请问该数是多少? 程序分析: 在10万以内判断,先将该数加上100后再开方,再将该数加上168后再开方如 ...

  10. 非常值得一看—九种滤波算法C语言实现

    关注"嵌入式软件开发学习圈"免费获取更多学习教程 今天带着大家学习滤波算法c语言(九种滤波算法)实现,以及代码,大家可以学习了解下.... 1.限幅滤波算法(程序判断滤波算法) 方 ...

最新文章

  1. 我用AI分析了《赛博朋克 2077》的评价,发现真爱粉都是来吸猫的
  2. Active Directory还原工具之三Software Active Directory Recycle Bin PowerPack
  3. 网站的高性能架构--web前端优化
  4. activexobject对象不能创建_面向对象设计方法(Object oriented)
  5. arcgis使用工具箱导出dbf_ArcGIS——好好的属性表,咋就乱码了呢?
  6. qq群 html,我的群组-普通群组.html
  7. mysql安装及远程连接_Mysql安装、使用、配置远程连接,看这一篇就够了!
  8. pcie握手机制_【博文连载】PCIe扫盲——Ack/Nak 机制详解(一)
  9. autograd手动仿真手记
  10. android本地gradle地址,android gradle本地路径不存在
  11. Quartz入门到精通
  12. 手机app登录显示服务器异常,手机app 连接云服务器异常
  13. 不忘初心,砥砺前行;只争朝夕,不负韶华——国家开放大学2018年度首届优秀青年教师总结报告
  14. 3日线与5日线金叉买入法
  15. 计算机二级mysql上机考试操作步骤_计算机二级mysql上机操作题怎么做
  16. oracle11g ora12170,11g告警日志中大量ORA-12170错误
  17. cocos2d实现语音_【Cocos Creator与C++知识分享】Creator接入呀呀语音SDK
  18. php如何把文字加粗,HTML中如何将字体加粗
  19. web服务器—nginx
  20. 浅谈大根堆,小根堆,以及堆排序(python)实现

热门文章

  1. HelloWord你的第一个rainmeter皮肤
  2. 遗传算法优化SVM支持向量机分类预测的参数代码模型
  3. 解密360黑幕:离职奇虎360老员工的告白
  4. mybatis批量更新报错问题解决
  5. SublimeText-win10光标跟随问题
  6. 用python画多来a梦-用python画哆啦a梦
  7. 基于忆阻器的神经网络应用研究
  8. ImportREC重建输入表
  9. DTcms 上传图片BUG补丁,解决方案
  10. 手机变成投影仪 建筑穿上节能衣