Skip to content
Jambity's Blog

Lecture 3: Bellman Optimality Equation

强化学习中的数学原理 | 第三课

RL,强化学习中的数学原理3min read...

这次课会学习最优策略(Optimal Policy)和贝尔曼最优公式(Bellman Optimality Equation)

核心:最优策略的定义以及怎么寻找最优策略

首先确保理解了state value和action value的计算

Question: while the policy is not good, how can we improve it?

我们可以更新policy,让选择当前policy下action value最大的那个action(这段说法不太严谨,下一part会给出严格定义)

正确性?

这个找到最优policy的方式,他的正确性其实并不那么直观

如果policy一坨屎,拿屎迭代真的还能迭代出好的policy吗?

下面我们将从数学上证明,只要不断迭代,最后一定得到的是最优的策略。

使用到贝尔曼最优公式(Bellman Optimality Equation)

we know that the state value could be used to evaluate if a policy is good or not:

if

then is better than

Definition

A policy is optimal if for all s and for any other policy

1787665190440

To answer these questions, we study the Bellman optimality equation.

相比于贝尔曼公式就在前面多了一个

Remarks:

  • are known
  • are unknown to be calculated
  • is unknown. 在贝尔曼公式中是给定的,但在贝尔曼最优公式中是待求解的

Bellman optimality equation (matrix-vector form):

BOE is tricky yet elegant!

  • elegant: it describes the optimal policy and optimal state value in an elegant way.
  • tricky: there is a maximization(最优化问题) on the rhs,which may not be straightforward to see how to compute.

Many questions to answer:

  • Algorithm: how to solve this equation?
  • Existence: does this equation have solutions?
  • Uniqueness: is the solution to this equation unique?
  • Optimality: how is it related to optimal policy?

BOE: elementwise form

BOE: matrix-vector form

1787708954865

1787709392945

这个最优化问题就是上面例子里的每一项的系数和为1的一个问题

从上面的例子我们就能发现,由于:

where the optimality is achieved when

where

The BOE is . Let

then, the Bellman optimality equation becomes

where

some concepts:

  • Fixed point 不动点: is a fixed point of if

  • Contraction mapping (or contractive function): is a contraction mapping if

where

  • 严格小于1,
  • can be any vector norm

然后我们就可以看看压缩映射原理

1787711215692

Theorem (Contraction Property)

is a contraction mapping satisfying

where is the discount rate!

证明在书上,大致是注意到的范数小于1

Applying the contraction mapping theorem gives the following results.

1787711867372

Suppose is the solution to the Bellman optimality equation. It satisfies

Suppose

Then

Therefore, is a policy and is the corresponding state value.

Is the optimal policy? Is the greatest state value can be achieved? 有一个结论能够证明

1787712770575

1787712844543

上面已经介绍完了贝尔曼最优公式,下面我们用他来分析一些最优策略

公式里哪些因素影响了最优策略呢?

可以看到公式里红色就是已知的的概率、reward、,其他变量就是要求的,所以最优策略就是由这些红色的量来决定

there are three factors:

  • Reward design:
  • System model: 代表了系统的模型
  • Discount rate:
  • are unknowns to be calculated

我们将通过例子看一下改变和会对最优策略的影响

  1. 如果中惩罚设置不那么高的话,策略会敢于尝试take risks

1787714420336

  1. 变小会导致最优策略变得shorted-sighted

1787714514773

降到0时则是只关注immediate reward的情况

  1. What if we change ?

1787714686910

对整体 r 表做线性变换,实际可以发现不会对最优策略产生影响

What matters is not the absulate reward values! It is their relative values! 因为我们选择的时候只关注最大的,不关注有多大

严谨公式:

1787714841307

  1. Meaningless detour. 不需要给无意义的一步特地加上惩罚

1787715061432

discount rate会起到不让他绕远路,而是尽快拿到奖励的作用

  • BOE 一定有解,且根据压缩映射原理解一定是唯一的(最优的是唯一的,不一定唯一)
  • 我们给出了 iterative algorithm 来求解最优解

结束了 BOE,keep learning

Comments

© Jambity. All rights reserved.......