Partially Observable Markov Decision Process

部分可观察马尔可夫决策过程(POMDP)

基础定义

一个 POMDP 模型 M\mathscr{M} 可以形式化定义为元组 S, A, O, P, Q, R, γ, b0\langle \mathcal{S},\ \mathcal{A},\ \mathcal{O},\ \mathcal{P},\ \mathcal{Q},\ \mathcal{R},\ \gamma,\ b_{0} \rangle

  1. 有限状态集合 S={s1, s2, , sn}\mathcal{S} = \{ s_{1},\ s_{2},\ \cdots,\ s_{n} \}
  2. 有限动作集合 A={a1, a2, , am}\mathcal{A} = \{ a_{1},\ a_{2},\ \cdots,\ a_{m} \}
  3. 有限观测集合 Ω={o1, o2, , ol}\Omega = \{ o_{1},\ o_{2},\ \cdots,\ o_{l} \}
  4. 状态转移概率矩阵 P={pij(a)=p(St+1=siSt=sj, At=a)}m×n×n\mathcal{P} = \{ p_{ij}^{(a)} = p(S_{t + 1} = s_{i} \mid S_{t} = s_{j},\ A_{t} = a) \}_{m \times n \times n}
  5. 观测状态激发概率矩阵 O={pij=p(Ot=oiSt=sj)}l×n\mathcal{O} = \{ p_{ij} = p(O_{t} = o_{i} \mid S_{t} = s_{j}) \}_{l \times n}
  6. 奖励函数 R:S×AR=E(Rt+1St=s, At=a)\mathcal{R} : \mathcal{S} \times \mathcal{A} \mapsto \mathbb{R} = \mathcal{E}(R_{t + 1} \mid S_{t} = s,\ A_{t} = a)
  7. 衰减因子 γ[0, 1)\gamma \in [0,\ 1)
  8. 初始状态概率分布 b0[0, 1]nb_{0} \in [0,\ 1]^{n}

为了将 POMDP 转化为 MDP 问题,需要定义一个新的状态空间——信息状态空间 I\mathcal{I},使得该空间内的状态的转移行为可以看做是一个 MDP,信息状态 II(t+1)I \in \mathcal{I}^{(t + 1)} 的更新可以形式化为映射:

It+1=κ(I0, I1, , It Ot+1, At)I_{t + 1} = \kappa (I_{0},\ I_{1},\ \cdots,\ I_{t}\ O_{t + 1},\ A_{t})

信息状态通过每次采取的动作 AtA_{t} 和新观测到的 Ot+1O_{t + 1} 进行更新,并且要求这种更新具有马尔可夫性,即:

p(It+1I0, I1, , It, Ot+1, At)=p(It+1It, Ot+1, At)p(I_{t + 1} \mid I_{0},\ I_{1},\ \cdots,\ I_{t},\ O_{t + 1},\ A_{t}) = p(I_{t + 1} \mid I_{t},\ O_{t + 1},\ A_{t})

通过信息状态得到的奖励函数:

RI:I×AR=E(Rt+1It=i, At=a)=sSR(s, a)p(si, a)=sSR(s, a)p(si)\mathcal{R}_{\mathcal{I}} : \mathcal{I} \times \mathcal{A} \mapsto \mathbb{R} = \mathcal{E}(R_{t + 1} \mid I_{t} = i,\ A_{t} = a) = \sum_{s \in \mathcal{S}} \mathcal{R}(s,\ a) p(s \mid i,\ \xcancel{a}) = \sum_{s \in \mathcal{S}} \mathcal{R}(s,\ a) p(s \mid i)

构造信息状态最直接的方式是将所有的历史信息全部包含在 ItI_{t} 中,即完全信息状态:

ItC=b0, o0, , ot, a0, , at1I_{t}^{\mathrm{C}} = \langle b_{0},\ o_{0},\ \cdots,\ o_{t},\ a_{0},\ \cdots,\ a_{t - 1} \rangle

但是完全信息状态空间复杂度随着规划步数线性增长,并且在形式上难以处理,因此可以将满足以下性质:

  1. 马尔可夫性:It=τ(It1, Ot, At)I_{t} = \tau(I_{t - 1},\ O_{t},\ A_{t})
  2. 隐状态条件概率等价性:p(StIt)=p(StItC)p(S_{t} \mid I_{t}) = p(S_{t} \mid I_{t}^{\mathrm{C}})
  3. 显状态激发概率等价性:p(OtIt1, At1)=p(OtIt1C, At1)p(O_{t} \mid I_{t - 1},\ A_{t - 1}) = p(O_{t} \mid I_{t - 1}^{\mathrm{C}},\ A_{t - 1})

的状态称为充分信息状态,即与完全信息状态的概率表现等价的信息状态。例如信念状态:

Bt(s)=bB:SR=p(St=sItC)B_{t}(s) = b \in \mathcal{B} : \mathcal{S} \mapsto \mathbb{R} = p(S_{t} = s \mid I_{t}^{\mathrm{C}})

经过动作 aa 的执行并且观测到显状态 oo 后信念状态 Bt(s)=b(s)B_{t}(s) = b(s) 确定性地转移(I×A×ΩI\mathcal{I} \times \mathcal{A} \times \Omega \mapsto \mathcal{I})为:

boa(s)=p(St+1=sBt=b, At=a, Ot+1=o)=p(s, b, a, o)p(b, a, o)=p(b, a)p(sb, a)p(os, b, a)O/p(b, a)p(ob, a)=p(os)sSp(s, St=sb, a)/sSp(o, St+1=sb, a)=p(os)sSp(ss, b, a)Pp(sb, a)/sSp(os, b, a)Op(sb, a)=p(os)sSp(ss, a)p(sItC)b(s)/sSp(os)sSp(s, St=sb, a)=p(os)sSp(ss, a)b(s)/sSp(os)sSp(ss, b, a)p(sb, a)b(s)=p(os)sSp(ss, a)b(s)/sSp(os)sSp(ss, a)b(s)\begin{aligned} b_{o}^{a}(s') &= p(S_{t + 1} = s' \mid B_{t} = b,\ A_{t} = a,\ O_{t + 1} = o) = \frac{p(s',\ b,\ a,\ o)}{p(b,\ a,\ o)} \\[5mm] &= \cancel{p(b,\ a)} p(s' \mid b,\ a) \underset{\mathcal{O}}{\underbrace{p(o \mid s',\ \xcancel{b,\ a})}} \bigg/ \cancel{p(b,\ a)} p(o \mid b,\ a) \\[5mm] &= p(o \mid s') \sum_{s \in \mathcal{S}} p(s',\ S_{t} = s \mid b,\ a) \bigg/ \sum_{s'' \in \mathcal{S}} p(o,\ S_{t + 1} = s'' \mid b,\ a) \\[7mm] &= p(o \mid s') \sum_{s \in \mathcal{S}} \underset{\mathcal{P}}{\underbrace{p(s' \mid s,\ \xcancel{b},\ a)}} p(s \mid b,\ \xcancel{a}) \bigg/ \sum_{s'' \in \mathcal{S}} \underset{\mathcal{O}}{\underbrace{p(o \mid s'',\ \xcancel{b,\ a})}} p(s'' \mid b,\ a) \\[7mm] &= p(o \mid s') \sum_{s \in \mathcal{S}} p(s' \mid s,\ a) \underset{b(s)}{\underbrace{p(s \mid I_{t}^{\mathrm{C}})}} \bigg/ \sum_{s'' \in \mathcal{S}} p(o \mid s'') \sum_{s \in \mathcal{S}} p(s'',\ S_{t} = s \mid b,\ a) \\[7mm] &= p(o \mid s') \sum_{s \in \mathcal{S}} p(s' \mid s,\ a) b(s) \bigg/ \sum_{s'' \in \mathcal{S}} p(o \mid s'') \sum_{s \in \mathcal{S}} p(s''\mid s,\ \xcancel{b},\ a) \underset{b(s)}{\underbrace{p(s \mid b,\ a)}} \\[7mm] &= p(o \mid s') \sum_{s \in \mathcal{S}} p(s' \mid s,\ a) b(s) \bigg/ \sum_{s'' \in \mathcal{S}} p(o \mid s'') \sum_{s \in \mathcal{S}} p(s''\mid s,\ a) b(s) \end{aligned}

从上式中还可以看出:

p(ob, a)=sSp(os)sSp(ss, a)b(s)p(o \mid b,\ a) = \sum_{s'' \in \mathcal{S}} p(o \mid s'') \sum_{s \in \mathcal{S}} p(s''\mid s,\ a) b(s)

现在来说明信念状态是充分信息状态,首先从定义和上式中可以得出信念状态满足性质 1、2,对于性质 3:

p(Ot+1=oBt=b, At=a)=sSp(os)sSp(ss, a)b(s)=sSp(os)sSp(ss, a)p(sItC=i)=sSp(os)sSp(ss, a, i)p(sa, i)=sSp(os, a, i)p(sa, i)=p(Ot+1=oItC=i, At=a)\begin{aligned} p(O_{t + 1} = o \mid B_{t} = b,\ A_{t} = a) &= \sum_{s'' \in \mathcal{S}} p(o \mid s'') \sum_{s \in \mathcal{S}} p(s'' \mid s,\ a) b(s) \\[7mm] &= \sum_{s'' \in \mathcal{S}} p(o \mid s'') \sum_{s \in \mathcal{S}} p(s'' \mid s,\ a) p(s \mid I_{t}^{\mathrm{C}} = i) \\[7mm] &= \sum_{s'' \in \mathcal{S}} p(o \mid s'') \sum_{s \in \mathcal{S}} p(s'' \mid s,\ a,\ i) p(s \mid a,\ i) \\[7mm] &= \sum_{s'' \in \mathcal{S}} p(o \mid s'',\ a,\ i) p(s'' \mid a,\ i) \\[7mm] &= p(O_{t + 1} = o \mid I_{t}^{\mathrm{C}} = i,\ A_{t} = a) \end{aligned}

因此建立在动作的基础之上的信念状态之间的转移(I×ApI\mathcal{I} \times \mathcal{A} \overset{p}{\to} \mathcal{I})概率为:

p(bb, a)=oΩp(b, ob, a)=oΩp(bb, a, o)p(ob, a)=oΩI{b=boa}p(ob, a)p(b' \mid b,\ a) = \sum_{o \in \Omega} p(b',\ o \mid b,\ a) = \sum_{o \in \Omega} p(b' \mid b,\ a,\ o) p(o \mid b,\ a) = \sum_{o \in \Omega} \mathbb{I} \{ b' = b_{o}^{a} \} p(o \mid b,\ a)

基于信念状态定义的奖励函数为:

RB:B×AR=sSR(s, a)p(sb)=sSR(s, a)b(s)\mathcal{R}_{\mathcal{B}} : \mathcal{B} \times \mathcal{A} \mapsto \mathbb{R} = \sum_{s \in \mathcal{S}} \mathcal{R}(s,\ a) p(s \mid b) = \sum_{s \in \mathcal{S}} \mathcal{R}(s,\ a) b(s)

策略与价值

尽管通过信念状态可以将 POMDP 模型转化为 MDP 模型,但是考虑到信念状态的状态空间 B=Rn\mathcal{B} = \mathbb{R}^{n} 是无限且连续的,因此难以通过有限离散状态集的 MDP 理论进行求解。另外,由于隐状态的存在,POMDP 模型的策略只能定义在信息状态上,可用的表示方法有策略树(有限期规划)和策略自动机(无限期规划):

以上表示方法均为确定性策略,类似地,定义信息状态价值函数,并且满足贝尔曼期望方程:

vπ(i)=RI(i, π(i))+γiIp(ii, π(i))vπ(i)v_{\pi}(i) = \mathcal{R}_{\mathcal{I}} \bigg( i,\ \pi(i) \bigg) + \gamma \sum_{i' \in \mathcal{I}} p \bigg( i' \mid i,\ \pi(i) \bigg) v_{\pi}(i')

对应的贝尔曼最优方程为:

v(i)=maxaA{RI(i, a)+γiI(i, a)p(ii, a)v(i)}=maxaA{RI(i, a)+γoΩp(oi, a)v(τ(i, o, a))}=maxaA{sSR(s, a)p(si)+γoΩsSp(o, si, a)v(τ(i, o, a))}=maxaA{sSR(s, a)p(si)+γoΩsSp(os, i, a)p(si, a)v(τ(i, o, a))}=maxaA{sSR(s, a)p(si)+γoΩsSp(os, i, a)sSp(s, si, a)v(τ(i, o, a))}=maxaA{sSR(s, a)p(si)+γoΩsSp(os, i, a)sSp(ss, i, a)p(si, a)v(τ(i, o, a))}=maxaA{sSR(s, a)p(si)+γoΩ[sSsSp(os)p(ss, a)p(si)]v(τ(i, o, a))}\begin{aligned} v^{\star}(i) &= \max_{a \in \mathcal{A}} \left\{ \mathcal{R}_{\mathcal{I}}(i,\ a) + \gamma \sum_{i' \in \mathcal{I}(i,\ a)} p(i' \mid i,\ a) v^{\star}(i') \right\} = \max_{a \in \mathcal{A}} \left\{ \mathcal{R}_{\mathcal{I}}(i,\ a) + \gamma \sum_{o \in \Omega} p(o \mid i,\ a) v^{\star} \bigg( \tau(i,\ o,\ a) \bigg) \right\} \\[7mm] &= \max_{a \in \mathcal{A}} \left\{ \sum_{s \in \mathcal{S}} \mathcal{R}(s,\ a) p(s \mid i) + \gamma \sum_{o \in \Omega} \sum_{s' \in \mathcal{S}} p(o,\ s' \mid i,\ a) v^{\star} \bigg( \tau(i,\ o,\ a) \bigg) \right\} \\[7mm] &= \max_{a \in \mathcal{A}} \left\{ \sum_{s \in \mathcal{S}} \mathcal{R}(s,\ a) p(s \mid i) + \gamma \sum_{o \in \Omega} \sum_{s' \in \mathcal{S}} p(o \mid s',\ \xcancel{i,\ a}) p(s' \mid i,\ a) v^{\star} \bigg( \tau(i,\ o,\ a) \bigg) \right\} \\[7mm] &= \max_{a \in \mathcal{A}} \left\{ \sum_{s \in \mathcal{S}} \mathcal{R}(s,\ a) p(s \mid i) + \gamma \sum_{o \in \Omega} \sum_{s' \in \mathcal{S}} p(o \mid s',\ \xcancel{i,\ a}) \sum_{s \in \mathcal{S}} p(s',\ s \mid i,\ a) v^{\star} \bigg( \tau(i,\ o,\ a) \bigg) \right\} \\[7mm] &= \max_{a \in \mathcal{A}} \left\{ \sum_{s \in \mathcal{S}} \mathcal{R}(s,\ a) p(s \mid i) + \gamma \sum_{o \in \Omega} \sum_{s' \in \mathcal{S}} p(o \mid s',\ \xcancel{i,\ a}) \sum_{s \in \mathcal{S}} p(s' \mid s,\ \xcancel{i},\ a) p(s \mid i,\ \xcancel{a}) v^{\star} \bigg( \tau(i,\ o,\ a) \bigg) \right\} \\[7mm] &= \max_{a \in \mathcal{A}} \left\{ \sum_{s \in \mathcal{S}} \mathcal{R}(s,\ a) p(s \mid i) + \gamma \sum_{o \in \Omega} \left[ \sum_{s' \in \mathcal{S}} \sum_{s \in \mathcal{S}} p(o \mid s') p(s' \mid s,\ a) p(s \mid i) \right] v^{\star} \bigg( \tau(i,\ o,\ a) \bigg) \right\} \end{aligned}

最优状态价值函数表示

对于任一 PWLC 函数,经过算子 L\mathscr{L} 的变换后依然是一个 PWLC 函数:

L{v}=maxaA{sSR(s, a)b(s)+γoΩp(ob, a)v(boa)}=maxaA{sSR(s, a)b(s)+γoΩp(ob, a)maxθΘsSθ(s)boa(s)}\begin{aligned} \mathscr{L} \{ v \} &= \max_{a \in \mathcal{A}} \left\{ \sum_{s \in \mathcal{S}} \mathcal{R}(s,\ a) b(s) + \gamma \sum_{o \in \Omega} p(o \mid b,\ a) v(b_{o}^{a}) \right\} \\[7mm] &= \max_{a \in \mathcal{A}} \left\{ \sum_{s \in \mathcal{S}} \mathcal{R}(s,\ a) b(s) + \gamma \sum_{o \in \Omega} p(o \mid b,\ a) \max_{\theta \in \Theta} \sum_{s' \in \mathcal{S}} \theta(s') b_{o}^{a}(s') \right\} \end{aligned}

其中

boa(s)=p(s, ob, a)p(ob, a)=1p(ob, a)p(os)sSp(ss, a)b(s)b_{o}^{a}(s') = \frac{p(s',\ o \mid b,\ a)}{p(o \mid b,\ a)} = \frac{1}{p(o \mid b,\ a)} p(o \mid s') \sum_{s \in \mathcal{S}} p(s' \mid s,\ a) b(s)

进而得到

L{v}=maxaA{sSR(s, a)b(s)+γoΩp(ob, a)maxθΘsSθ(s)boa(s)}=maxaA{sSR(s, a)b(s)+γoΩp(ob, a)maxθΘsSθ(s)boa(s)}=maxaA{sSR(s, a)b(s)+γoΩmaxθΘsSb(s)sSθ(s)p(os)p(ss, a)}\begin{aligned} \mathscr{L} \{ v \} &= \max_{a \in \mathcal{A}} \left\{ \sum_{s \in \mathcal{S}} \mathcal{R}(s,\ a) b(s) + \gamma \sum_{o \in \Omega} p(o \mid b,\ a) \max_{\theta \in \Theta} \sum_{s' \in \mathcal{S}} \theta(s') b_{o}^{a}(s') \right\} \\[7mm] &= \max_{a \in \mathcal{A}} \left\{ \sum_{s \in \mathcal{S}} \mathcal{R}(s,\ a) b(s) + \gamma \sum_{o \in \Omega} p(o \mid b,\ a) \max_{\theta \in \Theta} \sum_{s \in \mathcal{S}} \theta(s) b_{o}^{a}(s) \right\} \\[7mm] &= \max_{a \in \mathcal{A}} \left\{ \sum_{s \in \mathcal{S}} \mathcal{R}(s,\ a) b(s) + \gamma \sum_{o \in \Omega} \max_{\theta \in \Theta} \sum_{s \in \mathcal{S}} b(s) \sum_{s' \in \mathcal{S}} \theta(s') p(o \mid s') p(s' \mid s,\ a) \right\} \end{aligned}

θoa(s)=sSθ(s)p(os)p(ss, a)θ^=arg maxθΘsSb(s)θoa(s)\theta_{o}^{a}(s) = \sum_{s' \in \mathcal{S}} \theta(s') p(o \mid s') p(s' \mid s,\ a) \qquad \hat{\theta} = \argmax_{\theta \in \Theta} \sum_{s \in \mathcal{S}} b(s) \theta_{o}^{a}(s)

原式可以重写为:

L{v}=maxaA{sSR(s, a)b(s)+γoΩsSb(s)θ^oa(s)}=maxaA{sSb(s)[R(s, a)+γoΩθ^oa(s)]}\mathscr{L} \{ v \} = \max_{a \in \mathcal{A}} \left\{ \sum_{s \in \mathcal{S}} \mathcal{R}(s,\ a) b(s) + \gamma \sum_{o \in \Omega} \sum_{s \in \mathcal{S}} b(s) \hat{\theta}_{o}^{a}(s) \right\} = \max_{a \in \mathcal{A}} \left\{ \sum_{s \in \mathcal{S}} b(s) \left[ \mathcal{R}(s,\ a) + \gamma \sum_{o \in \Omega} \hat{\theta}_{o}^{a}(s) \right] \right\}

如果令:

θa, b(s)=R(s, a)+γoΩθ^oa(s)\theta \langle a,\ b \rangle (s) = \mathcal{R}(s,\ a) + \gamma \sum_{o \in \Omega} \hat{\theta}_{o}^{a}(s)

变换式又可以写作 PWLC 函数的形式

L{v}=maxaA{sSθa, b(s)b(s)}\mathscr{L} \{ v \} = \max_{a \in \mathcal{A}} \left\{ \sum_{s \in \mathcal{S}} \theta \langle a,\ b \rangle (s) b(s) \right\}

同时对于所有的 aAa \in \mathcal{A}bBb \in \mathcal{B},由 θa, b\theta \langle a,\ b \rangle 构成的新的向量集合 Θ\Theta' 的大小的上界为 AΘΩ| \mathcal{A} | |\Theta|^{|\Omega|}(给定 oo 可以得到 Θ|\Theta| 种不同的 θoa\theta_{o}^{a},而对于变换后的参数 θa, b\theta \langle a,\ b \rangle 包含求和项 oΩθ^oa(s)\sum_{o \in \Omega} \hat{\theta}_{o}^{a}(s),至多有 ΘΩ|\Theta|^{\Omega} 种求和序列)。对于有限期规划问题,其后序初始最优状态价值函数即为一个 PWLC 函数:

v0(b)=maxaAsSR(s, a)b(s)v^{\star} \langle 0 \rangle (b) = \max_{a \in \mathcal{A}} \sum_{s \in \mathcal{S}} \mathcal{R}(s,\ a) b(s)

在有限期规划时需要通过后序遍历来不断地对价值函数 vv 进行备份操作,表示为向量集合就有了可计算性。


Partially Observable Markov Decision Process
http://example.com/2024/07/10/POMDP/
Author
木辛
Posted on
July 10, 2024
Licensed under