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.

CS788 Dialogue Management Systems Lecture #2: Markov Decision Processes

Reinforcement Learning

Reinforcement Learning. Up until now we have been

ARTIFICIAL INTELLIGENCE. Reinforcement learning

CS599 Lecture 1 Introduction To RL

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

Reinforcement Learning (1)

The Reinforcement Learning Problem

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

The Markov Decision Process (MDP) model

Introduction to Reinforcement Learning. CMPT 882 Mar. 18

Reinforcement Learning

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

Reinforcement learning an introduction

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

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

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

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

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

Reinforcement Learning. Machine Learning, Fall 2010

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

Introduction to Reinforcement Learning

Planning in Markov Decision Processes

Reinforcement Learning and Control

Internet Monetization

Reinforcement Learning

Computational Reinforcement Learning: An Introduction

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

Reinforcement Learning. Introduction

Reinforcement Learning II

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

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

Some AI Planning Problems

Machine Learning I Reinforcement Learning

Basics of reinforcement learning

Autonomous Helicopter Flight via Reinforcement Learning

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

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

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

Reinforcement Learning

Reinforcement Learning

Q-Learning in Continuous State Action Spaces

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

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

Grundlagen der Künstlichen Intelligenz

, and rewards and transition matrices as shown below:

Lecture 1: March 7, 2018

MDP Preliminaries. Nan Jiang. February 10, 2019

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

Markov Decision Processes Chapter 17. Mausam

Markov decision processes

Real Time Value Iteration and the State-Action Value Function

Lecture 18: Reinforcement Learning Sanjeev Arora Elad Hazan

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

Markov Decision Processes Chapter 17. Mausam

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

CS 7180: Behavioral Modeling and Decisionmaking

Markov Decision Processes

REINFORCEMENT LEARNING

Reinforcement Learning Active Learning

Decision Theory: Markov Decision Processes

Reinforcement Learning: An Introduction

Decision Theory: Q-Learning

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

Introduction to Reinforcement Learning Part 1: Markov Decision Processes

Factored State Spaces 3/2/178

Probabilistic Planning. George Konidaris

Reinforcement Learning and NLP

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

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

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

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

Grundlagen der Künstlichen Intelligenz

Laplacian Agent Learning: Representation Policy Iteration

Chapter 4: Dynamic Programming

An Introduction to Markov Decision Processes. MDP Tutorial - 1

Reinforcement Learning (1)

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

Reinforcement Learning. George Konidaris

CS 188 Introduction to Fall 2007 Artificial Intelligence Midterm

CSE250A Fall 12: Discussion Week 9

CS230: Lecture 9 Deep Reinforcement Learning

Reinforcement Learning. Yishay Mansour Tel-Aviv University

Reinforcement Learning

Reinforcement Learning

Exponential Moving Average Based Multiagent Reinforcement Learning Algorithms

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 ))]

Reinforcement Learning Part 2

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

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

Lecture 23: Reinforcement Learning

Q-Learning for Markov Decision Processes*

Notes on Reinforcement Learning

Active Policy Iteration: Efficient Exploration through Active Learning for Value Function Approximation in Reinforcement Learning

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

Lecture 3: Markov Decision Processes

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 Some important alternate formulations 1 1

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

The Agent Learns a Policy Policy at step t, π t : a mapping from states to action probabilities π t (s, a) = probability that a t = a when s t = s 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. 3 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 be 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. 4 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 life-span. 5 5

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

Returns for Continuing Tasks Continuing tasks: interaction does not have natural episodes. Discounted return: k =0 R t = r t +1 +γ r t+ 2 + γ 2 r t +3 +L = γ k r t + k +1, where γ, 0 γ 1, is the discount rate. shortsighted 0 γ 1 farsighted 7 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 for each step before failure return = number of steps before failure As a continuing task with discounted return: reward = 1 upon failure; 0 otherwise return is related to γ k, for k steps before failure In either case, return is maximized by avoiding failure for as long as possible. 8 8

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. 9 9

A Unified Notation In episodic tasks, we number the time steps of each episode starting from zero. We usually do not have to distinguish between episodes, so we write instead of for the state at step t of episode j. s t s t, j Think of each episode as ending in an absorbing state that always produces reward of zero: We can cover all cases by writing R t = γ k r t +k +1, where γ can be 1 only if a zero reward absorbing state is always reached. k =0 10 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{ s t +1 = s, r t +1 = r s t,a t,r t, s t 1,a t 1,K, r 1,s 0,a } 0 = Pr{ s t +1 = s, r t +1 = r s t,a } t for all s, r, and histories s t,a t,r t, s t 1,a t 1,K, r 1, s 0,a 0. 11 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 P s s { } for all s, a = Pr s t +1 = s s t = s, a t = a reward expectations: s S, a A(s). a R s { } for all s, = E r t +1 s t = s, a t = a, s t +1 = s 12 s S, a A(s). 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 13 13

Recycling Robot MDP S = { high, low} A(high) = { search, wait} A(low) = { search, wait, recharge} R search = expected no. of cans while searching R wait = expected no. of cans while waiting R search > R wait 14 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 π : V π (s) = E π R t s t = s { } = E π γ k r t +k +1 s t = s 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 π : k =0 Action- value function for policy π : { } = E π γ k r t + k +1 s t = s,a t = a Q π (s, a) = E π R t s t = s, a t = a k = 0 15 15

Bellman Equation for a Policy π The basic idea: R t = r t +1 + γ r t +2 +γ 2 r t + 3 +γ 3 r t + 4 L = r t +1 + γ ( r t +2 + γ r t +3 + γ 2 r t + 4 L) = r t +1 + γ R t +1 So: V π (s) = E π R t s t = s { } { } = E π r t +1 + γ V π ( s t +1 ) s t = s Or, without the expectation operator: V π (s) = π(s, a) P a s s a s [ + γ V π ( s )] R a s s 16 16

More on the Bellman Equation V π (s) = π(s, a) P a s s a s [ + γ V π ( s )] R a s s This is a set of equations (in fact, linear), one for each state. The value function for π is its unique solution. Backup diagrams: for V π for Q π 17 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. State-value function for equiprobable random policy; γ = 0.9 18 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 19 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. 20 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 21 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 a A( s) = max a A( s) E{ r t +1 + γ V (s t +1 ) s t = s, a t = a} P a R a s s s s s The relevant backup diagram: [ + γ V ( s )] V is the unique solution of this system of nonlinear equations. 22 22

Bellman Optimality Equation for Q* { } Q (s, a) = E r t +1 + γ max Q ( s, a ) s t = s, a t = a s = P a s s a [ R a s s +γ max Q ( s, a )] a The relevant backup diagram: Q * is the unique solution of this system of nonlinear equations. 23 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: 24 24

What About Optimal Action-Value Functions? Q * Given, the agent does not even have to do a one-stepahead search: π (s) = arg max Q (s, a) a A(s) 25 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 and 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. 26 26

Average Reward MDPs In a discounted MDP, optimal policies depend on γ The most common alternative is to define return as: ρ π (s) = lim N r t 1 N E N t=1 A policy is called gain-optimal if it optimizes over all states r t where is the reward received at step t starting in state s and following policy π ρ π (s) 27

Average Reward cont. An MDP is unichain if all trajectories generated by all policies end up in the same recurrent class of states In a unichain MDP, for all states s and s ρ π (s) = ρ π ( s ) = ρ π Bias value, or relative value of s: V π (s) = lim N E N (r t ρ π ) t=1 where is the reward received at step t starting in state s and following policy π A policy is bias-optimal if it maximizes this value over all states r t 28

Gain-optimal vs. Bias-optimal a1: 100 A B 1 a2: 100 Both policies are gain optimal, but only a1 is bias optimal 29

Semi-Markov Decision Processes (SMDPs) Generalization of an MDP where there is a waiting (or dwell) time τ in each state Transition probabilities generalize to: P( s,τ s,a) Bellman equations generalize, e.g. for a discrete time SMDP: V * (s) = max P( s,τ s,a) R a + γ τ V * ( s s s ) a where is now the amount of a A(s) s,τ [ ] R s s discounted reward expected to accumulate over the waiting time in s upon doing a and ending up in s 30

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 Average reward MDPs Semi-Markov decision processes 31 31