POLAYOR

贝尔曼公式

贝尔曼公式

Calculating return

  1. Direct calculate
  2. Bootstrapping (returns rely on each other)

Bellman equation

  • Calculate returns in bootstrapping
  • Matrix-vector form is expected

State value

At(St)=Rt+1,St+1,At+1(St+1)=Rt+2,St+2,

Gt=Rt+1+γRt+2+γ2Rt+3+

vπ(s)=E[Gt|St=s], can also be expressed as v(s,π)

  • It is a function of s .
  • It is based on the policy \pi .

Deriving the Bellman equation

Gt=Rt+1+γGt+1,(1)vπ(s)=E[Gt|St=s](2)=E[Rt+1|St=s]+γE[Gt+1|St=s]

(3)E[Rt+1|St=s]=Σaπ(a|s)E[Rt+1|St=s,At=a](4)=Σaπ(a|s)Σrp(r|s,a)r

(5)E[Gt+1|St=s]=ΣsE[Gt+1|St+1=s]p(s|s)(6)=Σsvπ(s)p(s|s)(7)=Σsvπ(s)Σap(s|s,a)π(a|s)

Therefore, we have

vπ(s)=Σaπ(a|s)[Σrp(r|s,a)r+γΣsp(s|s,a)vπ(s)],sS.

  • 贝尔曼公式使用n个式子求解,一般只写上述这一个式子
  • 贝尔曼公式依赖于policy
  • 后面几个章节都默认已知dynamic model(environment model),对于未知的model会在未来学习

Matrix-vector form of the Bellman equation

Rewrite the Bellman equation as

vπ(s)=rπ(s)+γΣspπ(s|s)vπ(s)

Add the index

vπ(si)=rπ(si)+γΣsjpπ(sj|si)vπ(sj)

[vπ(s1)vπ(s2)vπ(s3)vπ(s4)]vπ=[rπ(s1)rπ(s2)rπ(s3)rπ(s4)]rπ+γ[pπ(s1|s1)pπ(s2|s1)pπ(s3|s1)pπ(s4|s1)pπ(s1|s2)pπ(s2|s2)pπ(s3|s2)pπ(s4|s2)pπ(s1|s3)pπ(s2|s3)pπ(s3|s3)pπ(s4|s3)pπ(s1|s4)pπ(s2|s4)pπ(s3|s4)pπ(s4|s4)]Pπ[vπ(s1)vπ(s2)vπ(s3)vπ(s4)]vπ

Closed-form solution

vπ=(IγPπ)1rπ

iterative solution

vk+1=rπ+γPπvk,vkvπ=(IγPπ)1rπ,k

证明方法:定义 v_k 和 v_\pi 的差

Action value

qπ(s,a)=E[Gt|St=s,At=a]

在s状态进行a动作

  • a function of the state-action pair (s, a)
  • depends on \pi

Relation to state value

E[Gt|St=s]vπ(s)=ΣaE[Gt|St=s,At=a]qπ(s,a)π(a|s)

Compare state value (v_ \pi) and action value(q_ \pi) , we have

qπ(s,a)=Σrp(r|s,a)r+γΣsp(s|s,a)vπ(s)

posted on   POLAYOR  阅读(70)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· winform 绘制太阳,地球,月球 运作规律
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示