lecture 2
play

Lecture 2 Music: 9 to 5 - Dolly Parton Por una Cabeza - PowerPoint PPT Presentation

Lecture 2 Music: 9 to 5 - Dolly Parton Por una Cabeza (instrumental) - written by Carlos Gardel, performed by Horacio Rivera Bear Necessities - from The Jungle Book, performed by Anthony the Banjo Man AI in the News


  1. Lecture 2 ▪ Music: ▪ 9 to 5 - Dolly Parton ▪ Por una Cabeza (instrumental) - written by Carlos Gardel, performed by Horacio Rivera ▪ Bear Necessities - from The Jungle Book, performed by Anthony the Banjo Man

  2. AI in the News ▪ https://ai.googleblog.com/2019/06/introducing-tensornetwork- open-source.html ▪ Use cases in physics! ▪ Approximating quantum states is a typical use-case for tensor networks in physics. ▪ “... we describe a tree tensor network (TTN) algorithm for approximating the ground state of either a periodic quantum spin chain (1D) or a lattice model on a thin torus (2D)”

  3. Announcements ▪ Lecture moved to North Gate Hall, room 105, starting Wednesday (tomorrow) ▪ Project 0: Python Tutorial ▪ Optional, but please do it. It walks you through the project submission process. ▪ Homework 0: Math self-diagnostic ▪ Optional, but important to check your preparedness for second half of the class. ▪ Project 1: Search is out! ▪ Best way to test your programming preparedness ▪ Use post @5 on Piazza to search for a project partner if you don’t have one! ▪ HW 1 is out! ▪ 3 components: electronic, written, and self-assessment ▪ Sections start this week ▪ Sorry for the lecture-discussion misalignment! ▪ Make sure you are signed up for Piazza and Gradescope ▪ Check all the pinned posts on Piazza ▪ You can give me feedback through this link: https://tinyurl.com/aditya-feedback-form

  4. CS 188: Artificial Intelligence Search Instructors: Sergey Levine & Stuart Russell University of California, Berkeley [slides adapted from Dan Klein, Pieter Abbeel]

  5. Today ▪ Agents that Plan Ahead ▪ Search Problems ▪ Uninformed Search Methods ▪ Depth-First Search ▪ Breadth-First Search ▪ Uniform-Cost Search

  6. Agents and environments Agent Environment Sensors Percepts ? Actuators Actions ▪ An agent perceives its environment through sensors and acts upon it through actuators ▪ Q: What are some examples of this?

  7. Rationality ▪ A rational agent chooses actions maximize the expected utility ▪ Today: agents that have a goal, and a cost ▪ E.g., reach goal with lowest cost ▪ Later: agents that have numerical utilities, rewards, etc. ▪ E.g., take actions that maximize total reward over time (e.g., largest profit in $)

  8. Agent design ▪ The environment type largely determines the agent design ▪ Fully/partially observable => agent requires memory (internal state) ▪ Discrete/continuous => agent may not be able to enumerate all states ▪ Stochastic/deterministic => agent may have to prepare for contingencies ▪ Single-agent/multi-agent => agent may need to behave randomly

  9. Agents that Plan

  10. Reflex Agents ▪ Reflex agents: ▪ Choose action based on current percept (and maybe memory) ▪ May have memory or a model of the world’s current state ▪ Do not consider the future consequences of their actions ▪ Consider how the world IS ▪ Can a reflex agent be rational? [Demo: reflex optimal (L2D1)] [Demo: reflex optimal (L2D2)]

  11. Video of Demo Reflex Optimal

  12. Video of Demo Reflex Odd

  13. Planning Agents ▪ Planning agents: ▪ Ask “what if” ▪ Decisions based on (hypothesized) consequences of actions ▪ Must have a model of how the world evolves in response to actions ▪ Must formulate a goal (test) ▪ Consider how the world WOULD BE ▪ Planning vs. replanning [Demo: re-planning (L2D3)] [Demo: mastermind (L2D4)]

  14. Video of Demo Replanning

  15. Video of Demo Mastermind

  16. Search Problems

  17. Search Problems ▪ A search problem consists of: ▪ A state space ▪ A successor function “N”, 1.0 (with actions, costs) “E”, 1.0 ▪ A start state and a goal test ▪ A solution is a sequence of actions (a plan) which transforms the start state to a goal state

  18. Search Problems Are Models

  19. Example: Traveling in Romania ▪ State space: ▪ Cities ▪ Successor function: ▪ Roads: Go to adjacent city with cost = distance ▪ Start state: ▪ Arad ▪ Goal test: ▪ Is state == Bucharest? ▪ Solution?

  20. What’s in a State Space? The world state includes every last detail of the environment A search state keeps only the details needed for planning (abstraction) ▪ Problem: Pathing ▪ Problem: Eat-All-Dots ▪ States: (x,y) location ▪ States: {(x,y), dot booleans} ▪ Actions: NSEW ▪ Actions: NSEW ▪ Successor: update location ▪ Successor: update location only and possibly a dot boolean ▪ Goal test: is (x,y)=END ▪ Goal test: dots all false

  21. State Space Sizes? ▪ World state: ▪ Agent positions: 120 ▪ Food count: 30 ▪ Ghost positions: 12 ▪ Agent facing: NSEW ▪ How many ▪ World states? 120x(2 30 )x(12 2 )x4 ▪ States for pathing? 120 ▪ States for eat-all-dots? 120x(2 30 )

  22. Quiz: Safe Passage ▪ Problem: eat all dots while keeping the ghosts perma-scared ▪ What does the state space have to specify? ▪ (agent position, dot booleans, power pellet booleans, remaining scared time)

  23. Agent design ▪ The environment type largely determines the agent design ▪ Fully/partially observable => agent requires memory (internal state) ▪ Discrete/continuous => agent may not be able to enumerate all states ▪ Stochastic/deterministic => agent may have to prepare for contingencies ▪ Single-agent/multi-agent => agent may need to behave randomly

  24. State Space Graphs and Search Trees

  25. State Space Graphs ▪ State space graph: A mathematical representation of a search problem ▪ Nodes are (abstracted) world configurations ▪ Arcs represent successors (action results) ▪ The goal test is a set of goal nodes (maybe only one) ▪ In a state space graph, each state occurs only once! ▪ We can rarely build this full graph in memory (it’s too big), but it’s a useful idea

  26. State Space Graphs ▪ State space graph: A mathematical G a representation of a search problem c b ▪ Nodes are (abstracted) world configurations ▪ Arcs represent successors (action results) e d ▪ The goal test is a set of goal nodes (maybe only one) f S h ▪ In a state space graph, each state occurs only p r q once! Tiny state space graph for a tiny ▪ We can rarely build this full graph in memory search problem (it’s too big), but it’s a useful idea

  27. Search Trees This is now / start “N”, 1.0 “E”, 1.0 Possible futures ▪ A search tree: ▪ A “what if” tree of plans and their outcomes ▪ The start state is the root node ▪ Children correspond to successors ▪ Nodes show states, but correspond to PLANS that achieve those states ▪ For most problems, we can never actually build the whole tree

  28. State Space Graphs vs. Search Trees Each NODE in in State Space Graph Search Tree the search tree is an entire PATH in S the state space graph. G e p a d c b q e h r b c e d f h r p q f a a We construct both S h q c on demand – and G p q f p r q we construct as a q c G little as possible. a

  29. Quiz: State Space Graphs vs. Search Trees Consider this 4-state graph: How big is its search tree (from S)? a G S b

  30. Quiz: State Space Graphs vs. Search Trees Consider this 4-state graph: How big is its search tree (from S)? s a a b G S b G a G a G b G b … … Important: Lots of repeated structure in the search tree!

  31. Break! ▪ Stand up and stretch ▪ Talk to your neighbors

  32. Tree Search

  33. Search Example: Romania

  34. Searching with a Search Tree ▪ Search: ▪ Expand out potential plans (tree nodes) ▪ Maintain a fringe of partial plans under consideration ▪ Try to expand as few tree nodes as possible

  35. General Tree Search ▪ Important ideas: ▪ Fringe ▪ the set of nodes that are to-be-visited ▪ Expansion ▪ the process of ‘visiting’ a node ▪ Exploration strategy ▪ how do we decide which fringe node to visit? ▪ Main question: which fringe nodes to explore?

  36. Example: Tree Search G a c b e d f S h p r q

  37. Example: Tree Search G a c b e e d d f f S h p r r q s S s � d e p s � e d s � p q e h r c s � d � b b s � d � c h r p q f a a s � d � e s � d � e � h q c G p q f s � d � e � r s � d � e � r � f a q c G s � d � e � r � f � c s � d � e � r � f � G a

  38. Depth-First Search

  39. Depth-First Search G Strategy: expand a a a deepest node first c c b b e e d d f f S h h p p r r q q S e p d q e h r b c h r p q f a a q c G p q f a q c G a

  40. Search Algorithm Properties

  41. Search Algorithm Properties ▪ Complete: Guaranteed to find a solution if one exists? ▪ Optimal: Guaranteed to find the least cost path? ▪ Time complexity? ▪ Space complexity? 1 node b b nodes … b 2 nodes ▪ Cartoon of search tree: m tiers ▪ b is the branching factor ▪ m is the maximum depth ▪ solutions at various depths b m nodes ▪ Number of nodes in entire tree? ▪ 1 + b + b 2 + …. b m = O(b m )

Recommend


More recommend