Reinforcement Learning Analysis, Grid World Applications

Similar documents
Reinforcement Learning

Markov Decision Processes

Reinforcement Learning. Slides based on those used in Berkeley's AI class taught by Dan Klein

CS 343: Artificial Intelligence

CS 188: Artificial Intelligence

Deep RL and Controls Homework 1 Spring 2017

Reinforcement Learning (1): Discrete MDP, Value Iteration, Policy Iteration

Reinforcement Learning (1): Discrete MDP, Value Iteration, Policy Iteration

CS 188: Artificial Intelligence Spring Announcements

17 MAKING COMPLEX DECISIONS

CS 188: Artificial Intelligence

COMP417 Introduction to Robotics and Intelligent Systems. Reinforcement Learning - 2

91.420/543: Artificial Intelligence UMass Lowell CS Fall 2010

16 MAKING SIMPLE DECISIONS

Non-Deterministic Search

Basic Framework. About this class. Rewards Over Time. [This lecture adapted from Sutton & Barto and Russell & Norvig]

16 MAKING SIMPLE DECISIONS

CS 188: Artificial Intelligence Fall 2011

Markov Decision Processes: Making Decision in the Presence of Uncertainty. (some of) R&N R&N

EE266 Homework 5 Solutions

CSE 473: Artificial Intelligence

Logistics. CS 473: Artificial Intelligence. Markov Decision Processes. PS 2 due today Midterm in one week

Markov Decision Processes

CS 188: Artificial Intelligence. Outline

Lecture 12: MDP1. Victor R. Lesser. CMPSCI 683 Fall 2010

COS402- Artificial Intelligence Fall Lecture 17: MDP: Value Iteration and Policy Iteration

CSEP 573: Artificial Intelligence

MDPs: Bellman Equations, Value Iteration

Complex Decisions. Sequential Decision Making

CS 188 Fall Introduction to Artificial Intelligence Midterm 1. ˆ You have approximately 2 hours and 50 minutes.

Probabilistic Robotics: Probabilistic Planning and MDPs

4 Reinforcement Learning Basic Algorithms

The Problem of Temporal Abstraction

Example: Grid World. CS 188: Artificial Intelligence Markov Decision Processes II. Recap: MDPs. Optimal Quantities

Markov Decision Process

CS221 / Spring 2018 / Sadigh. Lecture 7: MDPs I

Lecture 7: MDPs I. Question. Course plan. So far: search problems. Uncertainty in the real world

Intro to Reinforcement Learning. Part 3: Core Theory

Markov Decision Processes. Lirong Xia

POMDPs: Partially Observable Markov Decision Processes Advanced AI

Introduction to Reinforcement Learning. MAL Seminar

Making Decisions. CS 3793 Artificial Intelligence Making Decisions 1

Binary Options Trading Strategies How to Become a Successful Trader?

CS 188 Fall Introduction to Artificial Intelligence Midterm 1. ˆ You have approximately 2 hours and 50 minutes.

Lecture 17: More on Markov Decision Processes. Reinforcement learning

Definition 4.1. In a stochastic process T is called a stopping time if you can tell when it happens.

Markov Decision Processes. CS 486/686: Introduction to Artificial Intelligence

The Agent-Environment Interface Goals, Rewards, Returns The Markov Property The Markov Decision Process Value Functions Optimal Value Functions

Budget Estimator Tool & Budget Template

CS 461: Machine Learning Lecture 8

Decision making in the presence of uncertainty

1. A is a decision support tool that uses a tree-like graph or model of decisions and their possible consequences, including chance event outcomes,

Markov Decision Processes (MDPs) CS 486/686 Introduction to AI University of Waterloo

MDPs and Value Iteration 2/20/17

Algorithmic Trading using Reinforcement Learning augmented with Hidden Markov Model

DECISION MAKING. Decision making under conditions of uncertainty

Lending Club Loan Portfolio Optimization Fred Robson (frobson), Chris Lucas (cflucas)

1.1 Some Apparently Simple Questions 0:2. q =p :

To earn the extra credit, one of the following has to hold true. Please circle and sign.

CEC login. Student Details Name SOLUTIONS

CPS 270: Artificial Intelligence Markov decision processes, POMDPs

The exam is closed book, closed calculator, and closed notes except your three crib sheets.

TDT4171 Artificial Intelligence Methods

CS224W: Social and Information Network Analysis Jure Leskovec, Stanford University

Synchronize Your Risk Tolerance and LDI Glide Path.

A new tool for selecting your next project

Handout 4: Deterministic Systems and the Shortest Path Problem

Q1. [?? pts] Search Traces

Hibernation versus termination

Reinforcement learning and Markov Decision Processes (MDPs) (B) Avrim Blum

Christiano 362, Winter 2006 Lecture #3: More on Exchange Rates More on the idea that exchange rates move around a lot.

Discrete Mathematics for CS Spring 2008 David Wagner Final Exam

Chapter 1 Microeconomics of Consumer Theory

Reinforcement Learning

Module 6 Portfolio risk and return

Midterm I. Introduction to Artificial Intelligence. CS 188 Fall You have approximately 3 hours.

SP500 Market Forecast for July 2011

Retirement. Optimal Asset Allocation in Retirement: A Downside Risk Perspective. JUne W. Van Harlow, Ph.D., CFA Director of Research ABSTRACT

10703 Deep Reinforcement Learning and Control

Lecture outline W.B.Powell 1

Solving dynamic portfolio choice problems by recursing on optimized portfolio weights or on the value function?

Arbitrage is a trading strategy that exploits any profit opportunities arising from price differences.

Iteration. The Cake Eating Problem. Discount Factors

6.825 Homework 3: Solutions

FE501 Stochastic Calculus for Finance 1.5:0:1.5

Markov Decision Processes

Optimal routing and placement of orders in limit order markets

PFP Advisors. Financial Planning For Everyone. 123 neat st. Anywhere, USA 12345

Importance Sampling for Fair Policy Selection

Optimization Prof. A. Goswami Department of Mathematics Indian Institute of Technology, Kharagpur. Lecture - 18 PERT

2D5362 Machine Learning

CS 188 Fall Introduction to Artificial Intelligence Midterm 1

Lecture # Applications of Utility Maximization

Intelligent Systems (AI-2)

Taxation and Efficiency : (a) : The Expenditure Function

VOLATILITY EFFECTS AND VIRTUAL ASSETS: HOW TO PRICE AND HEDGE AN ENERGY PORTFOLIO

Extend the ideas of Kan and Zhou paper on Optimal Portfolio Construction under parameter uncertainty

Decision Theory: Value Iteration

Payoff Scale Effects and Risk Preference Under Real and Hypothetical Conditions

Risk-Averse Anticipation for Dynamic Vehicle Routing

Transcription:

Reinforcement Learning Analysis, Grid World Applications Kunal Sharma GTID: ksharma74, CS 4641 Machine Learning Abstract This paper explores two Markov decision process problems with varying state sizes. One has a relatively small number of states (>15) while the other has a relatively large number of states (>500). Throughout this paper, the following three reinforcement learning algorithms will be analyzed: Value iteration, policy iteration, and Q-Learning. Particular attention will be paid to understanding how each learning algorithm responds to an urgency and risk tradeoff. Where urgency is defined as a living penalty or a cost for any movement in the state space. In this context, risk is a path through the state space that has a high chance of acquiring a relatively large penalty. This paper will also analyze the runtime, number of steps to get to the goal, and reward accumulation for each of the reinforcement algorithms. This paper uses the Grid World implementation from the Brown-UMBC Reinforcement Learning and Planning Java open source library. Microsoft Excel was used for data visualizations. Section 1: Overview and Key Concepts 1.1 Problem Definition Overview Markov Decision Processes is a mathematical framework that depends on the Markov assumption which explains that the probability of future states is not dependent on any information from past states, but rather solely dependent on the present state that an actor or decision maker is in. At a high level, MDP seeks to maximize the total reward by creating an optimal policy for an actor to navigate through a state space. In many applications, the actor must face a number of variables that are random in nature. MDP models are able to incorporate this stochastic element into their policy making. This paper will present two Markov Decision problems that both fundamentally explore whether an actor resulting from various reinforcement algorithms may decide to take riskier paths through a state space given a greater urgency to reach the terminal state. In both problems, to get to the reward state there is a single shorter path and one or more longer paths. A penalty is placed adjacent but not directly on the shortest path. The images below represent the state spaces of the two problems. (Red Box: Penalty, Grey Circle: Actor, Black Box: Wall, Blue Box: Reward/Terminal State) Easy Grid World Hard Grid World

represents the duration that a train passes in the event that it does so. The urgency or living penalty represents cost to the company for late deliveries. 1.2 MDP Since the environment is stochastic, specifically an actor has an 80% chance of taking its intended action and a 20% of taking an unintended action. For example, an actor may choose to go forward but will move right instead. This represents the risk for an agent to take the shorter path as it may slip into the penalty square and accrue a large penalty. The greater the penalty, the greater the risk. The urgency factor can also be a living penalty, a penalty for every action that an actor takes. This penalty is intended to encourage the actor to reach a terminal state and helps reinforcement algorithms converge. The greater this living penalty, the faster an actor would wish to exit the state space. While Grid World experiments might seem overtly abstract and overly simplified, it is because of this that they can be used to study various real world applications. Specifically, this Grid World experiment could be useful in transportation and delivery route planning. Suppose a delivery truck has to deliver a product purchased online to a customer by driving through the city. It can take the shorter route, but it would need to pass a busy set of train tracks. Most of the time trains are not passing by, but when they are the road is blocked and significant time can pass. If the product is not delivered on time, the company can face a monetary loss. The penalty in this case Markov Decision Process or MDP is a framework that follows the aforementioned Markov property and is used in order to help make decisions in a stochastic environment. Below are the key concepts essential to MDP problems. Credit: Leonardo Araujo Santos [2] MDP uses a concept of utility that is value of a state representing a cumulative delayed conditional reward that is typically calculated using some form of the Bellman equation. 1.3 Value Iteration Value iteration assigns a utility value of every state. This value represents the extent to which the state is helpful in finding the optimal solution or policy. To find this utility, the immediate reward for the states with a reward is found. Neighboring state utilities are then found by applying a reward value with a particular discount value and assuming that the actor only makes the best choices in terms of state transitions from that state to the reward state.

More specifically, the Bellman equation is used to find the utility of all of the states in the state space. The equation is as follows: Initially, all states are assigned random values. The utility for every state is updated until convergence is reached. Convergence is reached when the changes in the utilities are less than a selected threshold. 1.4 Policy Iteration Value iteration is often very slow to converge since it is calculating the optimal policy indirectly. However, in policy iteration, policies are iterated over instead of states. First, a random policy is selected. Then, the utility for every state relative to the current policy is calculated. Finally, from the computed policies an optimal policy is chosen. The Bellman equation is used in policy iteration as well, the key difference lies over whether states or policies are iterated through to find the optimal policy. 1.5 Q-Learning To do this, Q-Learning assigns to each state a value referred to as the Q-value. When a state is visited, a reward is given and the Q-value is changed. The Q-value attempts to leave each state in the most optimal manner as it visits new states, unless it is exploring new routes. Q- Learning builds its optimal policy as a result of its exploration. Q-value can be represented by the following equation: Similar to value and policy iteration, the Q-learning algorithm continues to run until convergence is reached. While it is important to follow the best path to get closer to the solution, it is also important for the Q-learning algorithm to explore new areas in the state space in hopes that an even better solution would be found. This is known as the exploit-explore problem. The Q-learning algorithm does both in its search for the optimal policy. Section 2: Grid World Easy Problem 2.1 Problem Overview Value and policy iteration are similar in that they both assume the knowledge about all of the possible transition models and rewards in a state space. Very often however, this information is not present or easy modeled in real world applications. Q-Learning is very different from value and policy iteration as it is only given information about the possible states and all actions that are possible at each state. Q- learning builds its intuition of the optimal policy from only this information and several trials of exploration through the state space. The first MDP problem is relatively small, a 5 by 5 gird. The agent is represented by the

grey circle on the bottom left corner. The red square represents the penalty and the blue square represents a reward of 100 as well as the terminal state. The black squares represent walls, the agent cannot move onto these locations. The short path in this problem is the one straight in front of the agent (8 steps to reward). The longer path is to the right of the agent (12 steps to reward). The agent only risks the penalty if it takes the shorter path. To understand how the reinforcement algorithms tradeoff risk and urgency we can test various values for risk and urgency listed in the quadrant below. Low Urgency High Urgency Low Risk Step Cost = -1 Center = -10 Step Cost = -5 High Risk Step Cost = -1 Step Cost = -5 Long Long Short Given low urgency and high risk (Penalty = - 150), all of the reinforcement algorithms made the rational choice of taking the longer route except for the Q-Learning algorithm. This may because the Q-Learning algorithm does not converge in 200 iteration like policy and value iteration, as can be seen in section 2.3.c. With more iterations or a higher exploration rate, it is likely Q-learning would prefer to go right. c. High Urgency and Low Risk 2.2 Behavior Analysis a. Low Urgency and Low Risk As expected, given low urgency and low risk, all of the reinforcement algorithms made the rational choice of taking the shorter route. While value and policy iteration will go right if in the middle of the bottom row, the Q-Learning algorithm insists on going left quite possibly because it is biased by its initial exploration. Given low urgency and high risk (Step Cost= -5, Penalty = -10), all of the reinforcement algorithms made the rational choice of taking the shorter route. Q-Learning has a few off directional arrows including the one in the center and to the left of the bottom right corner. This again is likely because it has not yet converged. d. High Urgency and High Risk b. Low Urgency and High Risk

Given high urgency and high risk (Step Cost= -5, ), all of the reinforcement algorithms chose to take the risk of a high penalty this time instead of avoiding it. Q- Learning has a several off directional arrows on the bottom right quadrant that would cause the agent to accrue a greater step penalty. e. Analysis Low Urgency, SC = -1 High Urgency, SC = -5 Low Risk, P = -10 High Risk, P = -150 Policy: Short Policy: Long Value: Short Value: Long Q-Learning: Q-Learning: Short Short Policy: Short Value: Short Q-Learning: Short Policy: Short Value: Short Q-Learning: Short Policy iteration and value iteration both converge within 10 iterations. Q-Learning has several spikes that seems to get smaller but it does not seem to definitely converge within the first 200 iterations. The spikes likely represent the Q-learning algorithm visiting unexplored states instead of following its existing optimal plan strictly. This would explain why the spikes seem to get smaller over time. b. Time High urgency or step penalty increases the agent s likelihood of taking on a riskier route. Typically, agents are risk averse and will opt for the shortest path. Further analysis that tests more values for step costs and penalty would be key to getting a clearer understanding of the relationship between risk and urgency. 2.3 Performance Evaluation a. Steps to Goal The graph above displays the runtime for the three reinforcement algorithms. Policy iteration takes the longest time, likely because it must permute through policies to find the optimal

one requiring a substantial number of calculations. c. Reward All three algorithms obtain very negative reward in the first 5 iterations. After this, value and policy iteration seem to converge to a relatively consist reward range while the reward for Q-learning continues to fluctuate. It is important to note that the spikes get smaller over time, likely representing the improved performance from state space exploration. Overall, value and policy iteration have a similar performance on this Easy Grid World problem which is not a surprise as they operate on a very similar mathematical framework. Value iteration would be the best for this problem as it performs in slightly more than half the time as policy iteration. Section 3: GridWorld Hard Problem 3.1 Problem Overview The second MDP problem is much larger than the last, a 18 by 18 gird. The blue square still represents a reward of 100 as well as the terminal state. The short path in this problem is the one that crosses the diagonal. There are two other longer paths that go from the top left or the bottom right corner. Again, the agent only risks the penalty if it takes the shorter path. To understand how the reinforcement algorithms tradeoff risk and urgency in this Grid World, we can test the same values for risk and urgency as we did in the last problem. Low Urgency High Urgency Low Risk Step Cost = -1 Center = -10 Step Cost = -5 3.2 Behavior Analysis a. Low Urgency and Low Risk High Risk Step Cost = -1 Step Cost = -5

High Urgency, SC = -5 Policy: Short Value: Short Q-Learning: Short Policy: Short Value: Short Q-Learning: Short b. Low Urgency and High Risk Long Long Short c. High Urgency and Low Risk Even though the state space of this Grid World problem is nearly 13 times larger than the last and the orientation of the walls is completely different, the results are exactly the same. This seems to further support the notion that agents are typically risk averse and will opt for the shortest and safest path but will take risks when the urgency is higher. More experiments will need to be conducted on problems with shorter and riskier routes and longer but safer routes to identify this pattern with greater confidence. 3.3 Performance Evaluation a. Steps to Goal d. High Urgency and High Risk e. Analysis Low Urgency, SC = -1 Low Risk, P = -10 High Risk, P = -150 Policy: Short Policy: Long Value: Short Value: Long Q-Learning: Q-Learning: Short Short Value iteration and policy iteration take significantly longer to converge than Q learning. This is likely because since the state space is big, it would take several iterations before the discounted reward reaches the initial states at the opposite end of the board. Meanwhile, Q- leaning is able to improve quickly through exploration. While Q-learning converges faster,

value and policy iteration converge to lower values. b. Time to converge. Since value and policy iteration took a significantly larger number of steps to terminate in the first 20 iterations it is not surprising to see that the two algorithms have a proportionately low reward given the step cost. For a problem with a larger state space, Q-Learning converges and performs faster and better than value or policy iteration. This is because the latter two algorithms need to update values for the entire state space every iteration while Q values are only updated as they are visited. Section 4: Conclusion The performance in terms of time is very similar to the Easy Grid World problem. Q- learning takes the least amount of time likely because it is building up its calculations instead of calculating and updating the entire state space every iteration. c. Reward In the smaller grid world problem we found that Value iteration had a slightly higher performance in terms of time than policy iteration. In the larger grid world problem, Q- learning converged the fastest as it need not calculate all state values every iteration. After exploring the trade-off between urgency and risk in both small and large state spaces, we found that the behavior is the same. Agents are typically risk averse and will take the shortest but safest route except when urgency is high, agents are far more likely to take risks. In a real world application this logical. If an Amazon delivery truck was to be fined a few hundred for a late delivery, it would likely rational to take the shorter route through the city and risk having to wait for a passing train. It is important to note, that these models are highly abstracted and many more variables both human and environmental go into real world decision making. This graph closely follows the performance in terms of the number of steps that the reinforcement algorithms took in order References 1. About. BURLAP, Brown University, burlap.cs.brown.edu/.

2. Markov Decision Processes. Zeroassetsor, www.cnblogs.com/helloyz/p/9252568.html.