cse 473 artificial intelligence
play

CSE 473: Artificial Intelligence Autumn 2011 Search Luke - PowerPoint PPT Presentation

CSE 473: Artificial Intelligence Autumn 2011 Search Luke Zettlemoyer Slides from Dan Klein, Stuart Russell, Andrew Moore Outline Agents that Plan Ahead Search Problems Uninformed Search Methods (part review for some)


  1. CSE 473: Artificial Intelligence Autumn 2011 Search Luke Zettlemoyer Slides from Dan Klein, Stuart Russell, Andrew Moore

  2. Outline § Agents that Plan Ahead § Search Problems § Uninformed Search Methods (part review for some) § Depth-First Search § Breadth-First Search § Uniform-Cost Search § Heuristic Search Methods (new for all) § Best First / Greedy Search

  3. Review: Rational Agents § An agent is an entity that perceives and acts . Agent § A rational agent selects Sensors actions that maximize its Percepts utility function . Environment § Characteristics of the ? percepts, environment, and action space dictate techniques for selecting Actuators rational actions. Actions Search -- the environment is: fully observable, single agent, deterministic, episodic, discrete

  4. Reflex Agents § Reflex agents: § Choose action based on current percept (and maybe memory) § Do not consider the future consequences of their actions § Act on how the world IS § Can a reflex agent be rational? § Can a non-rational agent achieve goals?

  5. Famous Reflex Agents

  6. Goal Based Agents § Goal-based agents: § Plan ahead § Ask “what if” § Decisions based on (hypothesized) consequences of actions § Must have a model of how the world evolves in response to actions § Act on how the world WOULD BE

  7. Search Problems § A search problem consists of: § A state space “N”, 1.0 § A successor function “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

  8. Example: Romania § State space: § Cities § Successor function: § Go to adj city with cost = dist § Start state: § Arad § Goal test: § Is state == Bucharest? § Solution?

  9. State Space Graphs § State space graph: G § Each node is a state a c b § The successor function is represented by arcs e d f § Edges may be labeled S h with costs p r § We can rarely build this q graph in memory (so we don’t) Ridiculously tiny search graph for a tiny search problem

  10. State Space Sizes? § Search Problem: Eat all of the food § Pacman positions: 10 x 12 = 120 § Pacman facing: up, down, left, right § Food Count: 30 § Ghost positions: 12

  11. Search Trees “N”, 1.0 “E”, 1.0 § A search tree: § Start state at the root node § Children correspond to successors § Nodes contain states, correspond to PLANS to those states § Edges are labeled with actions and costs § For most problems, we can never actually build the whole tree

  12. Example: Tree Search State Graph: G a c b e d f S h p r q What is the search tree?

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

  14. Building Search Trees § Search: § Expand out possible plans § Maintain a fringe of unexpanded plans § Try to expand as few tree nodes as possible

  15. General Tree Search § Important ideas: § Fringe Detailed pseudocode is in the book! § Expansion § Exploration strategy § Main question: which fringe nodes to explore?

  16. Review: Depth First Search G Strategy : expand a deepest node first c b Implementation : e d Fringe is a LIFO f S queue (a stack) h p r q

  17. Review: Depth First Search G a a Expansion ordering: c c b b e e (d,b,a,c,a,e,h,p,q,q,r,f,c,a,G) 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 p q f G a q c G a

  18. Review: Breadth First Search G Strategy : expand a shallowest node c b first e d Implementation : f S Fringe is a FIFO h queue p r q

  19. Review: Breadth First Search G a c Expansion order: b e d (S,d,e,p,b,c,e,h,r,q,a, f S h a,h,r,p,q,f,p,q,f,q,c,G) p r q S e p d Search q e h r b c Tiers h r p q f a a q c p q f G a q c G a

  20. Search Algorithm Properties § Complete? Guaranteed to find a solution if one exists? § Optimal? Guaranteed to find the least cost path? § Time complexity? § Space complexity? Variables: n Number of states in the problem b The maximum branching factor B (the maximum number of successors for a state) C* Cost of least cost solution d Depth of the shallowest solution m Max depth of the search tree

  21. DFS Algorithm orithm Complete Optimal Time Space DFS N N Depth First O(B LMAX ) O(LMAX) N N Infinite Infinite Search b a START GOAL § Infinite paths make DFS incomplete … § How can we fix this?

  22. DFS 1 node b b nodes … b 2 nodes m tiers b m nodes Algorithm orithm Complete Optimal Time Space DFS w/ Path Y N O( b m ) O( bm ) Checking * Or graph search – next lecture.

  23. BFS Algorithm orithm Complete Optimal Time Space DFS w/ Path Y N O( b m ) O( bm ) Checking BFS Y Y* O( b d ) O( b d ) 1 node b b nodes … d tiers b 2 nodes b d nodes b m nodes

  24. Comparisons § When will BFS outperform DFS? § When will DFS outperform BFS?

  25. Iterative Deepening Iterative deepening uses DFS as a subroutine: b … 1. Do a DFS which only searches for paths of length 1 or less. 2. If “1” failed, do a DFS which only searches paths of length 2 or less. 3. If “2” failed, do a DFS which only searches paths of length 3 or less. … .and so on. Algorithm orithm Complete Optimal Time Space DFS w/ Path Y N O( b m ) O( bm ) Checking BFS Y Y* O( b d ) O( b d ) ID Y Y* O( b d ) O( bd )

  26. Costs on Actions GOAL a 2 2 c b 3 2 1 8 2 e d 3 f 9 8 2 START h 4 1 1 4 p r 15 q Notice that BFS finds the shortest path in terms of number of transitions. It does not find the least-cost path.

  27. Uniform Cost Search Expand cheapest node first: GOAL a 2 2 Fringe is c b 3 a priority 2 1 8 queue 2 e d 3 f 9 8 2 START h 4 1 1 4 p r 15 q

  28. Uniform Cost Search 2 G a c b 8 1 Expansion order: 2 2 e 3 d f 1 9 (S,p,d,b,e,a,r,f,e,G) 8 S h 1 1 p r q 15 0 S 1 9 e p 3 d q 16 11 5 17 4 e h r b c 11 Cost 7 6 13 h r p q f a a contours q c 8 p q f G a q c 11 10 G a

  29. Uniform Cost Search Algorithm orithm Complete Optimal Time Space DFS w/ Path Y N O( b m ) O( bm ) Checking BFS Y Y* O( b d ) O( b d ) UCS Y* Y O( b C*/ ε ) O( b C*/ ε ) b … C*/ ε tiers

  30. Uniform Cost Issues § Remember: explores c ≤ 1 … increasing cost contours c ≤ 2 c ≤ 3 § The good: UCS is complete and optimal! § The bad: § Explores options in every “direction” § No information about goal location Start Goal

  31. Uniform Cost: Pac-Man § Cost of 1 for each action § Explores all of the states, but one

  32. Search Heuristics § Any estimate of how close a state is to a goal § Designed for a particular search problem § Examples: Manhattan distance, Euclidean distance 10 5 11.2

  33. Heuristics

  34. Best First / Greedy Search Expand closest node first: Fringe is a priority queue

  35. Best First / Greedy Search § Expand the node that seems closest … § What can go wrong?

  36. Best First / Greedy Search b § A common case: … § Best-first takes you straight to the (wrong) goal § Worst-case: like a badly- guided DFS in the worst case § Can explore everything § Can get stuck in loops if no b cycle checking … § Like DFS in completeness (finite states w/ cycle checking)

  37. To Do: § Look at the course website: § http://www.cs.washington.edu/cse473/11au/ § Do the readings § Get started on PS1, when it is posted

  38. Search Gone Wrong?

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend