1. The Agent-Environment Interface, Goals and Rewards
The reinforcement learning problem is meant to be a straightforward framing of the problem of learning from interaction to achieve a goal. The learner and decision-maker is called the agent. The thing it interacts with, comprising everything outside the agent, is called the environment. These interact continually, the agent selecting actions and the environment responding to those actions and presenting new situations to the agent. The environment also gives rise to rewards, special numeric values that the agent tries to maximize over time. A complete specification of an environment defines a task, one instance of the reinforcement learning problem.
More specifically, the agent and environment interact at each of a sequence of discrete time steps, t = 0, I , 2, 3,. . . . At each time step t, the agent receives some representation of the environment s state, stS, where S is the set of possible states, and on that basis selects an action, atA(st), where A (st) is the set of actions available in state st. One time step later, in part as a consequence of its action, the agent receives a numerical reward, rt 1R, and finds itself in a new state, st 1.
At each time step, the agent implements a mapping from states to probabilit of selecting each possible action. This mapping is called the agent s policy and is denoted pi;t,, where pi;t(s, a) is the probability that at=a if st=s. Reinforcement learning methods specify how the agent changes its policy as a result of its experience. The agents goal, roughly speaking, is to maximize the total amount of reward it receives over the long run.
In reinforcement learning, the purpose or goal of the agent is formalized in terms of a special reward signal passing from the environment to the agent. At each time step, the reward is a simple number, rt R. Informally, the agents goal is to maximize the total amount of reward it receives. This means maximizing not immediate reward, but cumulative reward in the long run.
The use of a reward signal to formalize the idea of a goal is one of the most distinctive features of reinforcement learning. Although this way of formulating goals might at first appear limiting, in practice it has proved to be flexible and widely applicable. The best way to see this is to consider examples of how it has been, or could be, used. For example, to make a robot learn to walk, researchers have provided reward on each time step proportional to the robot s forward motion. In making a robot learn how to escape from a maze, the reward is often zero until it escapes, when it becomes 1. Another common approach in maze learning is to give a reward of -1 for every time step that passes prior to escape; this encourages the agent to escape as quickly as possible. To make a robot learn to find and collect empty soda cans for recycling, one might give it a reward of zero most of the time, and then a reward of 1 for each can collected ( and confirmed as empty ) . One might also want to give the robot negative rewards when it bumps into things or when somebody yells at it. For an agent to learn to play checkers or chess, the natural rewards are 1 for winning, -1 for losing, and 0 for drawing and for all nontenninal positions.
You can see what is happening in all of these examples. The agent always learns to maximize its reward. If we want it to do something for us, we must provide rewards to it in such a way that in maximizing them the agent will also achieve our goals. It is thus critical that the rewards we set up truly indicate what we want accomplished. In particular, the reward signal is not the place to impart to the agent prior knowledge about how to achieve what we want it to do. For example, a chess-playing agent should be rewarded only for actually winning, not for achieving subgoals such as taking its opponents pieces or gaining control of the center of the board . If achieving these sorts of subgoals were rewarded, then the agent might find a way to achieve them without achieving the real goal. For example, it might find a way to take the opponent s pieces even at the cost of losing the game. The reward signal is your way of communicating to the agent what you want it to achieve, not how you want it achieved.
2. Markov Decision Processes
In the reinforcement learning framework, the agent makes its decisions as a function of a signal from the environment called the environments state. In this section we discuss what is required of the state signal, and what kind of information we should and should not expect it to provide. In particular, we formally define a property of environments and their state signals that is of particular interest, called the Markov property.
In this book, by 'the state' we mean whatever information is available to the agent. We assume that the state is given by some preprocessing system that is nominally part of the environment. We do not address the issues of constructing, changing, or learning the state signal in this book. We take this approach not because we consider state representation to be unimportant, but in order to focus fully on the decision-making issues. In other words, our main concern is not with designing the state signal, but with deciding what action to take as a function of whatever state signal is available.
Certainly the state signal should include immediate sensations such as sensory measurements, but it can contain much more than that. State representations can be highly processed versions of original sensations, or they can be complex structures built up over time from the sequence of sensations. For example, we can move our eyes over a scene, with only a tiny spot corresponding to th
剩余内容已隐藏,支付完成后下载完整资料
强化学习的相关介绍
1. agent与环境的接口、目标与奖赏:
强化学习问题是直接从交互中学习而实现目标的一种框架。学习器和决策器称为agent;与之交互、在agent之外的一切东西都称为环境(environment)。这些交互不断地进行着:agent选择动作,环境对这些动作作出响应,产生新的场景给agent;同时环境引起奖赏,一种agent试图随时间推移最大化的特殊的数字值。环境的完整说明定义了一个任务(task),即强化学习问题的一个实例。
更具体地说,agent和环境在一个离散时间序列(t=0,1,2,3,hellip;hellip;)的每一步中都进行交互。在每个时间步t,agent都得到若干环境状态(state)的表示stS,其中S是所有可能状态的集合,在此基础上选择一个动作(action)atA(st),其中A(st)是在状态st上的可选动作的集合。一个时间步过后,该动作的结果是:agent得到一个数值奖赏(reward)rt 1R,并到达一个新的状态st 1。
在每一个时间步,agent都实施了一个映射,该映射是由状态得到选择每一个可能动作的概率。该映射就称为agent的策略(policy),记为pi;t,其中pi;t(s,a)是st=s时at=a的概率。强化学习方法说明agent如何通过经验改变策略。简单地说,agent的目标就是将长期运行过程中得到的奖赏总和最大化。
在强化学习中,agent的目标是根据一些从环境传递到agent的特殊奖赏信号进行形式化的。在每一个时间步中,奖赏都是一个简单的数字,rtR。不太严格的说,agent的目标就是将它所得到的奖赏总和最大化。这意味着最大化的不是立即奖赏,而是长期运行过程中的累积奖赏。
用奖赏信号将一个目标的观点形式化是强化学习最明显的特征之一。尽管用这种方式来形式化目标也许在开始的时候显得有些局限性,但是在实践中它已经被证明具有较大的灵活性和适用性。明白这一点的最好方式是思考一些例子,看它如何被使用或可以被使用的。举例来说,使一个机器人学会走路,研究人员在每一个时间步给机器人与前进动作成比例的奖赏。使机器人学会如何走出迷宫时,奖赏在走出前一直是0,走出后变成了+1。另一个在迷宫中学习的一般方法是在每一个时间步中给走出迷宫前的动作奖赏为-1;这样就鼓励了agent尽快的从迷宫中走出来。为了使机器人学会寻找和收集空易拉罐,在大部分时间里给它一个0奖赏,然后每收集一个,奖赏就加1(确认是空的易拉罐)。当然,也可以在它撞到什么东西或有人冲它大喊大叫时给机器人一个负奖赏。为让agent学习西洋跳棋或国际象棋,自然是胜利时奖赏为+1,失败时为-1,平局或所有没有结局的位置时为0。
你可以看到在所有这些例子中发生的是什么。agent总是学着将它的奖赏最大化。如果我们想让它为我们做些什么,我们就必须以这样一种方式提供奖赏给它,这样agent在最大化奖赏的过程中我们也达到了目的。因此正确设置奖赏以表明达到我们想要达到什么目的是很关键的。尤其是,奖赏信号不是告诉agent如何实现我们要它所做事情的先验经验。例如,玩国际象棋的agent只有在真正赢了的时候才会被奖励,而不是在完成一些子目标时就有奖励,比如说吃掉了对手的几个棋子,或是控制了棋盘的中央地带。如果实现这些子目标时就奖励,那么agent可能就会找到实现这些子目标的方法,而不是实现真正的目标。比如说,它可能找到一个以输掉比赛为代价而吃掉对方棋子的方式。奖赏信号是你与agent沟通你想要它完成什么的一种方式,而不是你想让它如何来完成。
2. 马尔可夫决策过程
在强化学习框架中,agent使用一个来自环境的信号函数做决策,该信号称为环境的状态。在本节我们讨论:状态信号需要些什么?我们指望它提供什么信息,又不能指望它提供什么信息。尤其是,我们正式定义一个称为马尔可夫性的环境性质,以及它特别感兴趣的一些状态信号。
在本书,通过“状态”我们表示了对agent来说是可用的任何信息。我们假定状态是由一些名义上是环境部分的预处理系统给定的。本书不讨论构建、改变或学习状态信号的问题。我们采用这个方法不是因为状态表示不重要,而是为了全力集中在决策问题上。换句话说,我们主要关注的不是设计状态信号,而是关注决定采用什么动作,而该动作是一个可用状态信号的函数。
当然,状态信号应当包括直接的感觉,如传感器度量,但不仅限于如此。状态表示可能是原始感觉高度处理后的版本,也可能是随时间在感觉序列中建立起来的复杂结构。例如,我们可以在画面中移动眼球,在任何时候仅仅需要在视网膜上的一个微小动作就可以建立一幅丰富、详尽的画面。或者,更明显的是,我们可以看着一个目标然后视线离开,我们知道它仍在那儿。我们可以听到肯定的回答,并且认为自己是在一个曾经到过但从此不再听人提起的完全不同的状态中。更通俗地讲,控制系统可能在两个不同的时间测量位置,以产生包括速度信息在内的一个状态表示。所有这些情况中,状态都被建立起来,并维持在直接感觉、以及先前状态或一些过去感觉的其他记忆的基础上。本书不去探究它是如何做的,但是可以肯定的是它可以做并且已经做了。没有理由将状态表示限制在直接感觉上,在通常的应用中,应当指望状态表示可以告知agent比直接感觉多得多的东西。
另一方面,不应该指望状态信号告知agent关于环境的一切,或者甚至是一些对它做决策有用的东西。如果agent在玩二十一点游戏,我们不应该指望agent预先知道接下来要发什么牌。如果agent在接电话,我们不应该指望它预先知道是谁打电话过来。如果agent是交通事故的医护人员,我们不应该指望它立刻知道一个失去知觉的受伤者的内伤在哪儿。在所有这些情况中,环境中含有隐藏的状态信息,如果agent知道这些的话是有用的,但是agent无法知道,因为它从来没有得到过任何相关感觉。简而言之,我们不会因为agent不知道一些要紧的东西而怪它,而只会为知道但又忘了而怪它。
理想中,我们所喜欢的是一个状态能够简练地总结过去的感觉,而这种方式又能保留所有相关的信息。这通常要求比直接感觉更多的东西,但从来不要求全部过去感觉的历史。成功保留所有相关信息的状态信号可以说成是马尔可夫(Markov)的,或者有马尔可夫性(the Markov property)(下面我们会正式定义该性质)。举例来说,一个棋局(棋盘上所有棋子的当前布局)就可以当成是一个马尔可夫状态,因为它汇集了所有导致它当前这个局面的完整棋局序列的一切重要内容。虽然关于这个序列的很多信息丢失了,但是所有与这个游戏未来紧密相关的重要东西保留了下来。同样,一个炮弹的当前位置和速度是与它将来的飞行有关的东西,而与位置和速度是怎么来的无关。这也就是有时候指的“路径的独立”性,因为所有有关的信息都在当前状态信号中,它的含义是独立于导致当前局面的信号的“路径”或历史。
我们现在正式定义强化学习问题的马尔可夫性。为了使数学上简单,这里我们假设有有穷个状态和奖赏值。这样我们可以用求和和概率,而不用积分和概率密度来做,但是这个问题可以轻易的扩展到包括连续状态和奖赏的问题中。思考一下一个普通环境可能会在t 1时刻对t时刻所做的动作如何反应。在最普通的、有前因后果的情况中,这个反应可能依赖于前面发生的一切。这种情况下,这个动态性可能只能通过指定完整的概率分布来定义:
(2.1)
对所有s,r,以及所有过去事件中的可能值:st,at,rt,st-1,at-1,...,r1,s0,a0。另一方面,如果状态信号有马尔可夫性,那么环境在t 1的响应只取决于在t时刻的状态和动作的表示,在此情况下,环境的动态性可以通过只指定下式来定义
(2.2)
对所有的s, r, st和at。换句话说,当且仅当对所有s,r,以及历史st, at, rt, st-1, at-1, ..., r1, s0, a0,有(2.2)式等于(2.1)式,那么状态信号有马尔可夫性,是一个马尔可夫状态。在这种情况下,环境和任务作为一个整体也具有马尔可夫性。
满足马尔可夫性质的强化学习任务被称为是马尔可夫决策过程(Markov decision process)或MDP。如果状态和动作空间是有穷的,那么它就称为有穷马尔可夫决策过程(finite Markov decision process,有穷MDP)。有穷MDP对强化学习理论来说尤其重要。我们将在整本书中都提到它们,它们占你需要理解的全部强化学习的90%。
具体的一个有穷MDP由状态和动作集以及环境的一步动态性所定义。给定任意状态s和动作a,则每个可能的下一状态s的概率为:
(2.3)
这称为转换概率(transition probability)。同样,给定任意当前状态s和动作a,以及任意下一状态s,则下一奖赏的期望值为:
(2.4)
和这两个量完全说明了有穷MDP动态性中最重要的方面(只是关于期望值附近的奖赏分布信息丢失了)。本书其余部分提到的大多数理论都暗含假定了环境是一个有穷MDP。
3. 最优值函数:
大体来说,解决一个强化学习任务意味着寻找一个长期运行过程中获得许多奖赏的策略。对有穷MDP,我们可以用下列方式精确定义一个最优策略。值函数定义了策略的偏序。定义:对所有状态,如果策略pi;的期望回报大于或等于策略pi;的期望回报,那么我们就说策略pi;要优于或者等于策略pi;。换句话说,当且仅当对所有,有时pi;ge;pi;。总是至少会有一个策略要优于或者等于其他策略的,这就是一个最优策略。尽管最优策略可能不只一个,我们用pi;*来表示所有的最优策略。它们有相同的状态值函数,称为最优状态值函数(optimal state-value function),记为V*,定义如下:
对所有, (3.1)
最优策略同样也有相同的最优动作值函数(optimal action-value function),记为Q*,定义如下:
对所有的sS和aA(s), (3.2)
对状态动作对(s,a),该函数给出了在状态s采用动作a,然后遵循一个最优策略的期望回报。因此,我们可以根据V*把Q*写成如下形式:
(3.3)
4. TD预测
TD和蒙特卡罗方法都是用经验来解决预测问题。给定一些在策略下的经验,两种方法都去更新它们的的估计。如果在时刻访问了非终止状态,那么两种方法都是基于此次访问之后发生的事情来更新它们的估计。大体来说,蒙特卡罗方法一直等到该次访问以后的回报已知后,才用这个回报作为的目标。一个适合用在非稳定环境中的简单every-visit蒙特卡罗是
(4.1)
其中是时刻之后的实际回报,是一个常量步长参数。我们称这种方法为常量-(constant-)MC。蒙特卡罗方法必须一直等到情节结束才能确定的增量(只有这时才是已知的),而TD方法只需等到下一个时间步。在时刻,它们立刻形成目标,利用观察到的奖赏和估计去作出有用的更新。最简单的TD方法,比如TD(0)是
(4.2)
实际上,蒙特卡罗更新的目标是,而TD更新的目标是。
因为TD方法的更新部分基于一个已经存在的估计,像DP一样,所以我们称之为bootstrapping方法。我们在第3章已经了解到
(4.3)
(4.4)
大体来说,蒙特卡罗方法用(4.3)式的估计作为目标,而DP方法用(4.4)式的估计作为目标。蒙特卡罗目标是一个估计,因为(4.3)式中的期望值是未知的,是用抽样回报来代替实际的期望回报。DP目标是一个估计,不是因为期望值的原因,它是假定能够完全由环境模型提供的,而是因为未知,而由当前估计值来代替的缘故。TD目标是一个估计,上述两个原因都存在:它对(4.4)式中的期望值进行了抽样,并且用当前估计来代替真正的。因此TD方法将蒙特卡罗的抽样和DP的bootstrapping结合起来。正如我们将要看到的,在我们的细心和想象之下这种结合可以使我们获得蒙特卡罗和动态规划方法的优点。
图4.1 表格式TD(0)估计
图4.1以程序形式完整说明了TD(0)算法,图4.2给出了它的更新图。更新图顶部状态节点的值的估计是在一个从它到它的直接下一状态的抽样转换基础上更新的。我们提到TD和蒙特卡罗更新时都称为抽样更新(sample backup),因为它们都涉及到
剩余内容已隐藏,支付完成后下载完整资料
资料编号:[501063],资料为PDF文档或Word文档,PDF文档可免费转换为Word
以上是毕业论文外文翻译,课题毕业论文、任务书、文献综述、开题报告、程序设计、图纸设计等资料可联系客服协助查找。