announcements
play

Announcements Homework 2 Due 2/11 (today) at 11:59pm Electronic - PowerPoint PPT Presentation

Announcements Homework 2 Due 2/11 (today) at 11:59pm Electronic HW2 Written HW2 Project 2 Releases today Due 2/22 at 4:00pm Mini-contest 1 (optional) Due 2/11 (today) at 11:59pm CS 188: Artificial Intelligence


  1. Announcements ▪ Homework 2 ▪ Due 2/11 (today) at 11:59pm ▪ Electronic HW2 ▪ Written HW2 ▪ Project 2 ▪ Releases today ▪ Due 2/22 at 4:00pm ▪ Mini-contest 1 (optional) ▪ Due 2/11 (today) at 11:59pm

  2. CS 188: Artificial Intelligence How to Solve Markov Decision Processes Instructors: Sergey Levine and Stuart Russell University of California, Berkeley [slides adapted from Dan Klein and Pieter Abbeel http://ai.berkeley.edu.]

  3. Example: Grid World ▪ A maze-like problem ▪ The agent lives in a grid ▪ Walls block the agent’s path ▪ Noisy movement: actions do not always go as planned ▪ 80% of the time, the action North takes the agent North ▪ 10% of the time, North takes the agent West; 10% East ▪ If there is a wall in the direction the agent would have been taken, the agent stays put ▪ The agent receives rewards each time step ▪ Small “living” reward each step (can be negative) ▪ Big rewards come at the end (good or bad) ▪ Goal: maximize sum of (discounted) rewards

  4. Recap: MDPs ▪ Markov decision processes: s ▪ States S ▪ Actions A a ▪ Transitions P(s’|s,a) (or T(s,a,s’)) ▪ Rewards R(s,a,s’) (and discount γ ) s, a ▪ Start state s 0 s,a,s’ ’s ▪ Quantities: ▪ Policy = map of states to actions ▪ Utility = sum of discounted rewards ▪ Values = expected future utility from a state (max node) ▪ Q-Values = expected future utility from a q-state (chance node)

  5. Example: Racing ▪ A robot car wants to travel far, quickly ▪ Three states: Cool, Warm, Overheated ▪ Two actions: Slow , Fast ▪ 0.5 +1 Going faster gets double reward 1.0 Fast Slow -10 +1 0.5 Warm Slow Fast 0.5 +2 0.5 Cool Overheated +1 1.0 +2

  6. Racing Search Tree

  7. Discounting ▪ How to discount? ▪ Each time we descend a level, we multiply in the discount once ▪ Why discount? ▪ Sooner rewards probably do have higher utility than later rewards ▪ Also helps our algorithms converge ▪ Example: discount of 0.5 ▪ U([1,2,3]) = 1*1 + 0.5*2 + 0.25*3 ▪ U([1,2,3]) < U([3,2,1])

  8. Optimal Quantities ▪ The value (utility) of a state s: V * (s) = expected utility starting in s and s is a s acting optimally state a ▪ The value (utility) of a q-state (s,a): (s, a) is a s, a q-state Q * (s,a) = expected utility starting out having taken action a from state s and s,a,s’ (s,a,s’) is a (thereafter) acting optimally transition ’s ▪ The optimal policy: π * (s) = optimal action from state s [Demo: gridworld values (L9D1)]

  9. Solving MDPs

  10. Snapshot of Demo – Gridworld V Values Noise = 0.2 Discount = 0.9 Living reward = 0

  11. Snapshot of Demo – Gridworld Q Values Noise = 0.2 Discount = 0.9 Living reward = 0

  12. Racing Search Tree

  13. Racing Search Tree

  14. Racing Search Tree ▪ We’re doing way too much work with expectimax! ▪ Problem: States are repeated ▪ Idea: Only compute needed quantities once ▪ Problem: Tree goes on forever ▪ Idea: Do a depth-limited computation, but with increasing depths until change is small ▪ Note: deep parts of the tree eventually don’t matter if γ < 1

  15. Time-Limited Values ▪ Key idea: time-limited values ▪ Define V k (s) to be the optimal value of s if the game ends in k more time steps ▪ Equivalently, it’s what a depth-k expectimax would give from s [Demo – time-limited values (L8D6)]

  16. k=0 Noise = 0.2 Discount = 0.9 Living reward = 0

  17. k=1 Noise = 0.2 Discount = 0.9 Living reward = 0

  18. k=2 Noise = 0.2 Discount = 0.9 Living reward = 0

  19. k=3 Noise = 0.2 Discount = 0.9 Living reward = 0

  20. k=4 Noise = 0.2 Discount = 0.9 Living reward = 0

  21. k=5 Noise = 0.2 Discount = 0.9 Living reward = 0

  22. k=6 Noise = 0.2 Discount = 0.9 Living reward = 0

  23. k=7 Noise = 0.2 Discount = 0.9 Living reward = 0

  24. k=8 Noise = 0.2 Discount = 0.9 Living reward = 0

  25. k=9 Noise = 0.2 Discount = 0.9 Living reward = 0

  26. k=10 Noise = 0.2 Discount = 0.9 Living reward = 0

  27. k=11 Noise = 0.2 Discount = 0.9 Living reward = 0

  28. k=12 Noise = 0.2 Discount = 0.9 Living reward = 0

  29. k=100 Noise = 0.2 Discount = 0.9 Living reward = 0

  30. Computing Time-Limited Values

  31. Value Iteration

  32. Value Iteration ▪ Start with V 0 (s) = 0: no time steps left means an expected reward sum of zero ▪ Given vector of V k (s) values, do one step of expectimax from each state: V k+1 (s) a s, a ▪ Repeat until convergence s,a,s’ (’V k (s ▪ Complexity of each iteration: O(S 2 A) ▪ Theorem: will converge to unique optimal values ▪ Basic idea: approximations get refined towards optimal values ▪ Policy may converge long before values do

  33. Example: Value Iteration 3.5 2.5 0 2 1 0 Assume no discount! 0 0 0

  34. Convergence* ▪ How do we know the V k vectors are going to converge? ▪ Case 1: If the tree has maximum depth M, then V M holds the actual untruncated values ▪ Case 2: If the discount is less than 1 ▪ Sketch: For any state V k and V k+1 can be viewed as depth k+1 expectimax results in nearly identical search trees ▪ The difference is that on the bottom layer, V k+1 has actual rewards while V k has zeros ▪ That last layer is at best all R MAX ▪ It is at worst R MIN ▪ But everything is discounted by γ k that far out ▪ So V k and V k+1 are at most γ k max|R| different ▪ So as k increases, the values converge

  35. The Bellman Equations How to be optimal: Step 1: Take correct first action Step 2: Keep being optimal

  36. The Bellman Equations ▪ Definition of “optimal utility” via expectimax recurrence s gives a simple one-step lookahead relationship amongst a optimal utility values s, a s,a,s’ ’s ▪ These are the Bellman equations, and they characterize optimal values in a way we’ll use over and over

  37. Value Iteration ▪ Bellman equations characterize the optimal values: V(s) a s, a s,a,s’ ▪ Value iteration computes them: (’V(s ▪ Value iteration is just a fixed point solution method ▪ … though the V k vectors are also interpretable as time-limited values

  38. Policy Methods

  39. Policy Evaluation

  40. Fixed Policies Do what π says to do Do the optimal action s s π (s) a s, π (s) s, a s, π (s),s’ s,a,s’ ’s ’s ▪ Expectimax trees max over all actions to compute the optimal values ▪ If we fixed some policy π (s), then the tree would be simpler – only one action per state ▪ … though the tree’s value would depend on which policy we fixed

  41. Utilities for a Fixed Policy ▪ Another basic operation: compute the utility of a state s s under a fixed (generally non-optimal) policy π (s) ▪ Define the utility of a state s, under a fixed policy π : s, π (s) V π (s) = expected total discounted rewards starting in s and following π s, π (s),s’ ▪ Recursive relation (one-step look-ahead / Bellman equation): ’s

  42. Example: Policy Evaluation Always Go Right Always Go Forward

  43. Example: Policy Evaluation Always Go Right Always Go Forward

  44. Policy Evaluation ▪ How do we calculate the V’s for a fixed policy π ? s π (s) ▪ Idea 1: Turn recursive Bellman equations into updates (like value iteration) s, π (s) s, π (s),s’ ’s Challenge question: how else can we solve this? ▪ Efficiency: O(S 2 ) per iteration ▪ Idea 2: Without the maxes, the Bellman equations are just a linear system ▪ Solve with Matlab (or your favorite linear system solver)

  45. Policy Extraction

  46. Computing Actions from Values ▪ Let’s imagine we have the optimal values V*(s) ▪ How should we act? ▪ It’s not obvious! ▪ We need to do a mini-expectimax (one step) ▪ This is called policy extraction, since it gets the policy implied by the values

  47. Computing Actions from Q-Values ▪ Let’s imagine we have the optimal q-values: ▪ How should we act? ▪ Completely trivial to decide! ▪ Important lesson: actions are easier to select from q-values than values!

  48. Policy Iteration

  49. Problems with Value Iteration ▪ Value iteration repeats the Bellman updates: s a s, a ▪ Problem 1: It’s slow – O(S 2 A) per iteration s,a,s’ ’s ▪ Problem 2: The “max” at each state rarely changes ▪ Problem 3: The policy often converges long before the values

  50. k=0 Noise = 0.2 Discount = 0.9 Living reward = 0

  51. k=1 Noise = 0.2 Discount = 0.9 Living reward = 0

  52. k=2 Noise = 0.2 Discount = 0.9 Living reward = 0

  53. k=3 Noise = 0.2 Discount = 0.9 Living reward = 0

  54. k=4 Noise = 0.2 Discount = 0.9 Living reward = 0

  55. k=5 Noise = 0.2 Discount = 0.9 Living reward = 0

  56. k=6 Noise = 0.2 Discount = 0.9 Living reward = 0

  57. k=7 Noise = 0.2 Discount = 0.9 Living reward = 0

  58. k=8 Noise = 0.2 Discount = 0.9 Living reward = 0

  59. k=9 Noise = 0.2 Discount = 0.9 Living reward = 0

  60. k=10 Noise = 0.2 Discount = 0.9 Living reward = 0

  61. k=11 Noise = 0.2 Discount = 0.9 Living reward = 0

  62. k=12 Noise = 0.2 Discount = 0.9 Living reward = 0

  63. k=100 Noise = 0.2 Discount = 0.9 Living reward = 0

Recommend


More recommend