Chapter 1: Basic Concepts in Reinforcement Learning
/ 6 min read
Table of Contents
A grid-world example
一个网格世界,非常经典的例子

机器人可以到达相邻的网格,不能进入forbidden的网格,且网格四周有边界
- 任务:找到一个比较好的路径从起点到终点
State
在网格世界中,state就是agent的位置。比如下图中有9个状态:

Action
对于每个状态,Agent可采取的行动叫做Action。例如:
- : move upward;
- : move rightward;
- : move downward;
- : move leftward.
- …
State transition 状态转移
当agent采取一个action的时候,状态会从一个转移到另一个,这种过程叫做状态转移, 用如下符号表示:
其中
State transition定义了Agent和环境交互的规则。比如以下例子:

本课程采用case1
用表格表示state transition
第行第列表示
局限性:只能表示确定性的情况
State transition probability
用概率(条件概率)去表示state transition
- Intuition 直觉:At state s1, if we choose action a2, the next state is s2
- 数学表示:
Policy
策略告诉Agent在某个状态下采取什么动作
用箭头表示
数学表示
也是采用条件概率表示,比如在:
也有随机的(stochastic)策略

用表格表示
第行第列表示的状态下,采取动作的概率,即的数值
Reward
Reward是一个实数标量
- A positive reward represents encouragement to take such actions.
- A negative reward represents punishment to take such actions
比如说,在之前的网格世界,agent想要走出边界,那么我们可以让
同样的,可以用表格表示reward

也可以用数学表示,例如: and
Trajectory and return
轨迹是一个 state-action-reward 链
return是轨迹中所有reward的和,数学上可以用return刻画一个策略的好坏
Discounted return 折扣汇报
为什么需要这么一个东西呢,看以下这种情况,一个轨迹:
此时return发散:
由此定义discount rate 折扣因子 ,则discount return 定义为:
折扣汇报的作用:
- 让无限回报成为有限值
- 平衡近期奖励与远期奖励
当 接近 0 时:
智能体主要关心马上获得的奖励,表现得比较“短视”。 当 接近 1 时,远期奖励衰减得比较慢,智能体更愿意为了将来的较大收益暂时放弃当前收益。
Episode
智能体按照某个策略 与环境不断交互
如果最终到达某个终止状态 terminal state,交互就停止。从初始状态到终止状态的trajactory,称为一个 Episode,也叫 trial。
一个episode通常是一个有限的轨迹。
- 存在明确起点和终点、每次到达终止状态后重新开始的任务,称为episodic tasks
- 如果任务的轨迹可能是无限的,则称为continuous tasks
在网格世界示例中,我们是否应该在到达目标后停止?
- 将目标状态视为具有策略的正常状态。智能体仍然可以离开目标状态,并在进入目标状态时获得r = +1的奖励。
- 我们无需将目标状态与其他状态区分开来,可以将其视为正常状态
Markov decision process (MDP)
Key elements of MDP:
- Sets:
- State: the set of states
- Action: the set of actions is associated for state .
- Reward: the set of rewards .
- Probability distribution (or called system model):
- State transition probability: at state , taking action , the probability to transit to state is
- Reward probability: at state , taking action , the probability to get reward is
- Policy: at state , the probability to choose action is
- Markov property: memoryless property
All the concepts introduced in this lecture can be put in the framework in MDP.