Chapter 3: The Reinforcement Learning Problem

Similar documents
Lecture 3: The Reinforcement Learning Problem

Chapter 3: The Reinforcement Learning Problem

Reading Response: Due Wednesday. R. S. Sutton and A. G. Barto: Reinforcement Learning: An Introduction 1

Course basics. CSE 190: Reinforcement Learning: An Introduction. Last Time. Course goals. The website for the class is linked off my homepage.

Reinforcement Learning

CS788 Dialogue Management Systems Lecture #2: Markov Decision Processes

Reinforcement Learning. Up until now we have been

ARTIFICIAL INTELLIGENCE. Reinforcement learning

Today s s Lecture. Applicability of Neural Networks. Back-propagation. Review of Neural Networks. Lecture 20: Learning -4. Markov-Decision Processes

The Reinforcement Learning Problem

CS599 Lecture 1 Introduction To RL

Reinforcement Learning (1)

Introduction to Reinforcement Learning. Part 6: Core Theory II: Bellman Equations and Dynamic Programming

Reinforcement Learning

Reinforcement Learning. Machine Learning, Fall 2010

Balancing and Control of a Freely-Swinging Pendulum Using a Model-Free Reinforcement Learning Algorithm

CMU Lecture 11: Markov Decision Processes II. Teacher: Gianni A. Di Caro

The Markov Decision Process (MDP) model

Christopher Watkins and Peter Dayan. Noga Zaslavsky. The Hebrew University of Jerusalem Advanced Seminar in Deep Learning (67679) November 1, 2015

Introduction to Reinforcement Learning. CMPT 882 Mar. 18

Chapter 7: Eligibility Traces. R. S. Sutton and A. G. Barto: Reinforcement Learning: An Introduction 1

Reinforcement Learning

Machine Learning I Reinforcement Learning

Sequential decision making under uncertainty. Department of Computer Science, Czech Technical University in Prague

MARKOV DECISION PROCESSES (MDP) AND REINFORCEMENT LEARNING (RL) Versione originale delle slide fornita dal Prof. Francesco Lo Presti

Machine Learning. Reinforcement learning. Hamid Beigy. Sharif University of Technology. Fall 1396

Internet Monetization

Prof. Dr. Ann Nowé. Artificial Intelligence Lab ai.vub.ac.be

Planning in Markov Decision Processes

Reinforcement Learning II

Course 16:198:520: Introduction To Artificial Intelligence Lecture 13. Decision Making. Abdeslam Boularias. Wednesday, December 7, 2016

Reinforcement learning an introduction

Introduction to Reinforcement Learning

MS&E338 Reinforcement Learning Lecture 1 - April 2, Introduction

, and rewards and transition matrices as shown below:

Reinforcement Learning and Control

Reinforcement Learning

Computational Reinforcement Learning: An Introduction

Probabilistic Planning. George Konidaris

Temporal Difference. Learning KENNETH TRAN. Principal Research Engineer, MSR AI

This question has three parts, each of which can be answered concisely, but be prepared to explain and justify your concise answer.

Autonomous Helicopter Flight via Reinforcement Learning

Reinforcement Learning (1)

Q-Learning in Continuous State Action Spaces

Some AI Planning Problems

Basics of reinforcement learning

Reinforcement Learning

Reinforcement Learning. Introduction

INF 5860 Machine learning for image classification. Lecture 14: Reinforcement learning May 9, 2018

Review: TD-Learning. TD (SARSA) Learning for Q-values. Bellman Equations for Q-values. P (s, a, s )[R(s, a, s )+ Q (s, (s ))]

Markov Decision Processes Chapter 17. Mausam

Grundlagen der Künstlichen Intelligenz

CMU Lecture 12: Reinforcement Learning. Teacher: Gianni A. Di Caro

MDP Preliminaries. Nan Jiang. February 10, 2019

The Book: Where we are and where we re going. CSE 190: Reinforcement Learning: An Introduction. Chapter 7: Eligibility Traces. Simple Monte Carlo

Monte Carlo is important in practice. CSE 190: Reinforcement Learning: An Introduction. Chapter 6: Temporal Difference Learning.

Reinforcement Learning: An Introduction

Reinforcement Learning. Yishay Mansour Tel-Aviv University

Machine Learning. Machine Learning: Jordan Boyd-Graber University of Maryland REINFORCEMENT LEARNING. Slides adapted from Tom Mitchell and Peter Abeel

Lecture 15: Bandit problems. Markov Processes. Recall: Lotteries and utilities

Sequential decision making under uncertainty. Department of Computer Science, Czech Technical University in Prague

Factored State Spaces 3/2/178

Reinforcement Learning

Lecture 18: Reinforcement Learning Sanjeev Arora Elad Hazan

Reinforcement Learning for Continuous. Action using Stochastic Gradient Ascent. Hajime KIMURA, Shigenobu KOBAYASHI JAPAN

REINFORCEMENT LEARNING

Introduction to Reinforcement Learning Part 1: Markov Decision Processes

Markov Decision Processes Chapter 17. Mausam

Reinforcement Learning

Reinforcement Learning Part 2

Markov decision processes

Lecture 3: Policy Evaluation Without Knowing How the World Works / Model Free Policy Evaluation

Reinforcement Learning (1)

Reinforcement Learning. Summer 2017 Defining MDPs, Planning

Chapter 6: Temporal Difference Learning

REINFORCE Framework for Stochastic Policy Optimization and its use in Deep Learning

Markov Decision Processes and Solving Finite Problems. February 8, 2017

Reinforcement Learning and NLP

CS 7180: Behavioral Modeling and Decisionmaking

Temporal difference learning

Reinforcement Learning

Machine Learning and Bayesian Inference. Unsupervised learning. Can we find regularity in data without the aid of labels?

Today s Outline. Recap: MDPs. Bellman Equations. Q-Value Iteration. Bellman Backup 5/7/2012. CSE 473: Artificial Intelligence Reinforcement Learning

An Adaptive Clustering Method for Model-free Reinforcement Learning

Reinforcement Learning. George Konidaris

Reinforcement Learning with Function Approximation. Joseph Christian G. Noel

An Introduction to Markov Decision Processes. MDP Tutorial - 1

Introduction to Reinforcement Learning. Part 5: Temporal-Difference Learning

Q-Learning for Markov Decision Processes*

(Deep) Reinforcement Learning

Reinforcement Learning. Spring 2018 Defining MDPs, Planning

CSE250A Fall 12: Discussion Week 9

CS 570: Machine Learning Seminar. Fall 2016

PART A and ONE question from PART B; or ONE question from PART A and TWO questions from PART B.

Decision Theory: Q-Learning

Laplacian Agent Learning: Representation Policy Iteration

Reinforcement Learning II. George Konidaris

Lecture 1: March 7, 2018

CS230: Lecture 9 Deep Reinforcement Learning

Lecture 25: Learning 4. Victor R. Lesser. CMPSCI 683 Fall 2010

Transcription:

Chapter 3: The Reinforcement Learning Problem Objectives of this chapter: describe the RL problem we will be studying for the remainder of the course present idealized form of the RL problem for which we have precise theoretical results; introduce key components of the mathematics: value functions and Bellman equations; describe trade-offs between applicability and mathematical tractability. R. S. Sutton and A. G. Barto: Reinforcement Learning: An Introduction 1

The Agent-Environment Interface Agent state s t reward r t action a t r t+1 s t+1 Environment Agent and environment interact at discrete time steps: Agent observes state at step t : s S produces action at step t : at A( st ) gets resulting reward : r R and resulting next state : t + 1 s t + 1 t t = 0, 1, 2, K... s t a t r t +1 s t +1 a t +1 r t +2 s t +2 t +2 a r t +3 s t +3... a t +3 R. S. Sutton and A. G. Barto: Reinforcement Learning: An Introduction 2

The Agent Learns a Policy Policy at step t, π : t a mapping from states to action probabilities π ( s, a) = probability that a = a when s = s t t t Reinforcement learning methods specify how the agent changes its policy as a result of experience. Roughly, the agent s goal is to get as much reward as it can over the long run. R. S. Sutton and A. G. Barto: Reinforcement Learning: An Introduction 3

Getting the Degree of Abstraction Right Time steps need not refer to fixed intervals of real time. Actions can be low level (e.g., voltages to motors), or high level (e.g., accept a job offer), mental (e.g., shift in focus of attention), etc. States can low-level sensations, or they can be abstract, symbolic, based on memory, or subjective (e.g., the state of being surprised or lost ). An RL agent is not like a whole animal or robot, which consist of many RL agents as well as other components. The environment is not necessarily unknown to the agent, only incompletely controllable. Reward computation is in the agent s environment because the agent cannot change it arbitrarily. R. S. Sutton and A. G. Barto: Reinforcement Learning: An Introduction 4

Goals and Rewards Is a scalar reward signal an adequate notion of a goal? maybe not, but it is surprisingly flexible. A goal should specify what we want to achieve, not how we want to achieve it. A goal must be outside the agent s direct control thus outside the agent. The agent must be able to measure success: explicitly; frequently during its lifespan. R. S. Sutton and A. G. Barto: Reinforcement Learning: An Introduction 5

In general, Returns Suppose the sequence of rewards after step t is : r, r, r, K t + 1 t + 2 t + 3 What do we want to maximize? { }. we want to maximize the expected return, E R, for each step t Episodic tasks: interaction breaks naturally into episodes, e.g., plays of a game, trips through a maze. Rt = rt + 1 + rt + 2 + L + rt, where T is a final time step at which a terminal state is reached, ending an episode. t R. S. Sutton and A. G. Barto: Reinforcement Learning: An Introduction 6

Returns for Continuing Tasks Continuing tasks: interaction does not have natural episodes. Discounted return: t t + 1 t + 2 t + 3 t + k + 1 k = 0 2 k R = r + γ r + γ r + L = γ r, where γ, 0 γ 1, is the discount rate. shortsighted 0 γ 1 farsighted R. S. Sutton and A. G. Barto: Reinforcement Learning: An Introduction 7

An Example Avoid failure: the pole falling beyond a critical angle or the cart hitting end of track. As an episodic task where episode ends upon failure: reward = + 1 return = As a continuing task with discounted return: reward = 1 return = for each step before failure number of steps before failure upon failure; 0 otherwise, for k steps before failure R. S. Sutton and A. G. Barto: Reinforcement Learning: An Introduction 8 γ k In either case, return is maximized by avoiding failure for as long as possible.

Another Example Get to the top of the hill as quickly as possible. reward = 1 for each step where not at top of hill return = number of steps before reaching top of hill Return is maximized by minimizing number of steps reach the top of the hill. R. S. Sutton and A. G. Barto: Reinforcement Learning: An Introduction 9

A Unified Notation In episodic tasks, we number the time steps of each episode starting from zero. We usually do not have distinguish between episodes, so we write s t instead of s t, j for the state at step t of episode j. Think of each episode as ending in an absorbing state that always produces reward of zero: r 1 = +1 r s 0 s 2 = +1 1 We can cover all cases by writing s 2 r 3 = +1 r 4 = 0 r 5 = 0 where γ can be 1 only if a zero reward absorbing state is always reached. R t k = γ rt + k + 1, k = 0 R. S. Sutton and A. G. Barto: Reinforcement Learning: An Introduction 10

The Markov Property By the state at step t, the book means whatever information is available to the agent at step t about its environment. The state can include immediate sensations, highly processed sensations, and structures built up over time from sequences of sensations. Ideally, a state should summarize past sensations so as to retain all essential information, i.e., it should have the Markov Property: Pr{ st + = s rt + = r st at rt st at r s a } 1, 1,,, 1, 1, K, 1, 0, 0 = Pr { st + = s rt + = r st a } 1, 1, t for all s, r, and histories s, a, r, s, a, K, r, s, a. t t t t 1 t 1 1 0 0 R. S. Sutton and A. G. Barto: Reinforcement Learning: An Introduction 11

Markov Decision Processes If a reinforcement learning task has the Markov Property, it is basically a Markov Decision Process (MDP). If state and action sets are finite, it is a finite MDP. To define a finite MDP, you need to give: state and action sets one-step dynamics defined by transition probabilities: a P = Pr st 1 = s st = s, at = a for all s, s S, a A( s). ss + { } reward probabilities: { } a R = E r s = s, a = a, s = s for all s, s S, a A( s). ss t + 1 t t t + 1 R. S. Sutton and A. G. Barto: Reinforcement Learning: An Introduction 12

An Example Finite MDP Recycling Robot At each step, robot has to decide whether it should (1) actively search for a can, (2) wait for someone to bring it a can, or (3) go to home base and recharge. Searching is better but runs down the battery; if runs out of power while searching, has to be rescued (which is bad). Decisions made on basis of current energy level: high, low. Reward = number of cans collected R. S. Sutton and A. G. Barto: Reinforcement Learning: An Introduction 13

Recycling Robot MDP S = { high, low} A( high) search, wait = { } = { } A( low) search, wait, recharge R R search wait = expected no. of cans while searching = expected no. of cans while waiting R search > R wait 1, R wait wait 1 β, 3 search β, R search high 1, 0 recharge low search wait α, R search 1 α, R search 1, R wait R. S. Sutton and A. G. Barto: Reinforcement Learning: An Introduction 14

Value Functions The value of a state is the expected return starting from that state; depends on the agent s policy: State - value function for policy π : π k V ( s) = E { π Rt st = s} = Eπ γ rt + k + 1 st = s k = 0 The value of taking an action in a state under policy π is the expected return starting from that state, taking that action, and thereafter following π : Action - value function for policy π : π k Q ( s, a) = E { π Rt st = s, at = a} = Eπ γ rt + k + 1 st = s, at = a k = 0 R. S. Sutton and A. G. Barto: Reinforcement Learning: An Introduction 15

Bellman Equation for a Policy π The basic idea: 2 3 R = r + γ r + γ r + γ r t t + 1 t + 2 t + 3 t + 4 2 = r + γ r + γ r + γ r t + 1 t + 2 t + 3 t + 4 = r + γ R t + 1 t + 1 π So: V ( s) = E R s = s L ( L) { } π t t { } π t + 1 t + 1 t E r γ V s s s = + ( ) = Or, without the expectation operator: π a a π V ( s) = π( s, a) P R + γ V ( s ) a s [ ] ss ss R. S. Sutton and A. G. Barto: Reinforcement Learning: An Introduction 16

More on the Bellman Equation π a a π V ( s) = π( s, a) P R + γ V ( s ) a s [ ] ss ss This is a set of equations (in fact, linear), one for each state. The value function for π is its unique solution. Backup diagrams: (a) s (b) s,a a r s' r s' a' for V π for Q π R. S. Sutton and A. G. Barto: Reinforcement Learning: An Introduction 17

Gridworld Actions: north, south, east, west; deterministic. If would take agent off the grid: no move but reward = 1 Other actions produce reward = 0, except actions that move agent out of special states A and B as shown. A B 3.3 8.8 4.4 5.3 1.5 A' +10 B' +5 Actions 1.5 3.0 2.3 1.9 0.5 0.1 0.7 0.7 0.4-0.4-1.0-0.4-0.4-0.6-1.2-1.9-1.3-1.2-1.4-2.0 State-value function for equiprobable random policy; γ = 0.9 R. S. Sutton and A. G. Barto: Reinforcement Learning: An Introduction 18

Golf State is ball location Reward of 1 for each stroke until the ball is in the hole Value of a state? Actions: putt (use putter) driver (use driver) putt succeeds anywhere on the green V putt 6 5 4 3 1 2 s an d 4 3 2 3 4 s a n d 0 1 green 2 R. S. Sutton and A. G. Barto: Reinforcement Learning: An Introduction 19

Optimal Value Functions For finite MDPs, policies can be partially ordered: π π π π if and only if V ( s) V ( s) for all s S There is always at least one (and possibly many) policies that is better than or equal to all the others. This is an optimal policy. We denote them all π *. Optimal policies share the same optimal state-value function: π V ( s) = max V ( s) for all s S π Optimal policies also share the same optimal action-value function: π Q ( s, a) = max Q ( s, a) for all s S and a A( s) π This is the expected return for taking action a in state s and thereafter following an optimal policy. R. S. Sutton and A. G. Barto: Reinforcement Learning: An Introduction 20

Optimal Value Function for Golf We can hit the ball farther with driver than with putter, but with less accuracy Q*(s,driver) gives the value or using driver first, then using whichever actions are best Q * (s,driver) s a n d 2 0 1 2 3 s an d green R. S. Sutton and A. G. Barto: Reinforcement Learning: An Introduction 21

Bellman Optimality Equation for V* The value of a state under an optimal policy must equal the expected return for the best action from that state: π V ( s) = max Q ( s, a) a A( s) = max E r + γ V ( s ) s = s, a = a a A( s) { } t + 1 t + 1 t t a a = max P R + γ V ( s ) a A( s) The relevant backup diagram: s [ ] ss ss (a) max s a r s' V is the unique solution of this system of nonlinear equations. R. S. Sutton and A. G. Barto: Reinforcement Learning: An Introduction 22

Bellman Optimality Equation for Q* { } t + 1 t + 1 t t a Q ( s, a) = E r + γ max Q ( s, a ) s = s, a = a a a = P R + γ max Q ( s, a ) s ss ss The relevant backup diagram: [ ] a (b) s,a r s' max a' Q * is the unique solution of this system of nonlinear equations. R. S. Sutton and A. G. Barto: Reinforcement Learning: An Introduction 23

Why Optimal State-Value Functions are Useful Any policy that is greedy with respect to V is an optimal policy. V Therefore, given, one-step-ahead search produces the long-term optimal actions. E.g., back to the gridworld: A B +5 22.0 24.4 22.0 19.4 17.5 19.8 22.0 19.8 17.8 16.0 +10 B' 17.8 19.8 17.8 16.0 14.4 16.0 17.8 16.0 14.4 13.0 A' 14.4 16.0 14.4 13.0 11.7 a) gridworld b) V* c) π* R. S. Sutton and A. G. Barto: Reinforcement Learning: An Introduction 24

What About Optimal Action-Value Functions? Q * Given, the agent does not even have to do a one-step-ahead search: π ( s) = arg max Q ( s, a) a A( s) R. S. Sutton and A. G. Barto: Reinforcement Learning: An Introduction 25

Solving the Bellman Optimality Equation Finding an optimal policy by solving the Bellman Optimality Equation requires the following: accurate knowledge of environment dynamics; we have enough space an time to do the computation; the Markov Property. How much space and time do we need? polynomial in number of states (via dynamic programming methods; Chapter 4), BUT, number of states is often huge (e.g., backgammon has about 10**20 states). We usually have to settle for approximations. Many RL methods can be understood as approximately solving the Bellman Optimality Equation. R. S. Sutton and A. G. Barto: Reinforcement Learning: An Introduction 26

Summary Agent-environment interaction States Actions Rewards Policy: stochastic rule for selecting actions Return: the function of future rewards agent tries to maximize Episodic and continuing tasks Markov Property Markov Decision Process Transition probabilities Expected rewards Value functions State-value function for a policy Action-value function for a policy Optimal state-value function Optimal action-value function Optimal value functions Optimal policies Bellman Equations The need for approximation R. S. Sutton and A. G. Barto: Reinforcement Learning: An Introduction 27