cs 188 artificial intelligence
play

CS 188: Artificial Intelligence Spring 2007 Lecture 4: A* Search - PowerPoint PPT Presentation

CS 188: Artificial Intelligence Spring 2007 Lecture 4: A* Search Srini Narayanan ICSI and UC Berkeley Many slides over the course adapted from Dan Klein, Stuart Russell and Andrew Moore PDF created with pdfFactory Pro trial version


  1. CS 188: Artificial Intelligence Spring 2007 Lecture 4: A* Search Srini Narayanan – ICSI and UC Berkeley Many slides over the course adapted from Dan Klein, Stuart Russell and Andrew Moore PDF created with pdfFactory Pro trial version www.pdffactory.com

  2. Announcements § Submission of Assignment 1 § Submit program should be updated by today § Use submit hw1 for this assignment § Enrollment issues PDF created with pdfFactory Pro trial version www.pdffactory.com

  3. Today § A* Search § Heuristic Design § Local Search PDF created with pdfFactory Pro trial version www.pdffactory.com

  4. Recap: Search § Search problems: § States, successors, costs, start and goal tests § Search trees: § Nodes: represent paths, have costs § Strategies differing fringe management § Tree vs. graph search PDF created with pdfFactory Pro trial version www.pdffactory.com

  5. Uniform Cost: Problems § 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 PDF created with pdfFactory Pro trial version www.pdffactory.com

  6. Best-First / Greedy Search PDF created with pdfFactory Pro trial version www.pdffactory.com

  7. Best-First / Greedy Search § Expand the node that seems closest… § What can go wrong? PDF created with pdfFactory Pro trial version www.pdffactory.com

  8. Best-First / Greedy Search GOAL a 2 2 h=0 h=8 c b 2 5 h=4 h=5 1 8 h=11 2 e d 3 f 9 1 h=8 9 h=4 START h 4 5 h=6 1 h=12 4 3 p r 15 q h=11 h=6 h=9 PDF created with pdfFactory Pro trial version www.pdffactory.com

  9. Best-First / Greedy Search § A common case: b … § Best-first takes you straight to the goal on a wrong path § 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) PDF created with pdfFactory Pro trial version www.pdffactory.com

  10. Best First Greedy Search Algorithm Complete Optimal Time Space Greedy Best-First O( b m ) O( b m ) Y* N Search b … m § What do we need to do to make it complete? § Can we make it optimal? PDF created with pdfFactory Pro trial version www.pdffactory.com

  11. Combining UCS and Greedy § Uniform-cost orders by path cost, or backward cost g(n) § Best-first orders by goal proximity, or forward cost h(n) 5 h=1 e 1 1 3 2 S a d G h=5 2 1 h=6 h=2 h=0 1 b c h=5 h=4 § A* Search orders by the sum: f(n) = g(n) + h(n) Example: Teg Grenager PDF created with pdfFactory Pro trial version www.pdffactory.com

  12. When should A* terminate? § Should we stop when we enqueue a goal? A 2 1 h = 2 G S h = 3 h = 0 B 2 2 h = 1 § No: only stop when we dequeue a goal PDF created with pdfFactory Pro trial version www.pdffactory.com

  13. Is A* Optimal? 1 A 3 h = 6 h = 0 S h = 7 G 5 § What went wrong? § Estimated goal cost > actual good goal cost § We need estimates to be less than actual costs! PDF created with pdfFactory Pro trial version www.pdffactory.com

  14. Admissible Heuristics § A heuristic is admissible (optimistic) if: where is the true cost to a nearest goal § E.g. Euclidean distance on a map problem § Coming up with admissible heuristics is most of what’s involved in using A* in practice. PDF created with pdfFactory Pro trial version www.pdffactory.com

  15. Optimality of A*: Blocking This proof assumed § Proof: tree search! Where? … § What could go wrong? § We’d have to have to pop a suboptimal goal off the fringe queue § This can’t happen: § Imagine a suboptimal goal G’ is on the queue § Consider any unexpanded (fringe) node n on a shortest path to optimal G § n will be popped before G PDF created with pdfFactory Pro trial version www.pdffactory.com

  16. What to do with revisited states? c = 1 2 The heuristic h is h = 100 1 clearly admissible 2 1 90 100 0 PDF created with pdfFactory Pro trial version www.pdffactory.com

  17. What to do with revisited states? c = 1 2 2+1 f = 1+100 h = 100 1 2 1 4+90 90 ? 100 104 0 I f we discar d t his new node, t hen t he sear ch algor it hm expands t he goal node next and r et ur ns a non-opt imal solut ion PDF created with pdfFactory Pro trial version www.pdffactory.com

  18. What to do with revisited states? 1 2 2+1 1+100 100 1 2 1 2+90 4+90 90 100 102 104 0 I nst ead, if we do not discar d nodes r evisit ing st at es, t he sear ch t er minat es wit h an opt imal solut ion PDF created with pdfFactory Pro trial version www.pdffactory.com

  19. Optimality of A*: Contours § Consider what A* does: § Expands nodes in increasing total f value (f-contours) § Proof idea: optimal goals have lower f value, so get expanded first Holds for graph search as well, but we made a different assumption. What? PDF created with pdfFactory Pro trial version www.pdffactory.com

  20. Consistency § Wait, how do we know we expand in increasing f value? § Couldn’t we pop some node n , and find its child n’ to have lower f value? § YES: h = 0 h = 8 B 3 g = 10 G A h = 10 § What do we need to do to fix this? § Consistency: § Real cost always exceeds reduction in heuristic PDF created with pdfFactory Pro trial version www.pdffactory.com

  21. Admissibility and Consistency § A consist ent heurist ic is also admissible [Lef t as an exercise] § An admissible heurist ic may not be consist ent , but many admissible heurist ics are consist ent PDF created with pdfFactory Pro trial version www.pdffactory.com

  22. UCS vs A* Contours § Uniform-cost expanded in all directions Start Goal § A* expands mainly toward the goal, but does hedge its bets to ensure optimality Start Goal PDF created with pdfFactory Pro trial version www.pdffactory.com

  23. Properties of A* Uniform-Cost A* b b … … PDF created with pdfFactory Pro trial version www.pdffactory.com

  24. Admissible Heuristics § Most of the work is in coming up with admissible heuristics § Good news: usually admissible heuristics are also consistent § More good news: inadmissible heuristics are often quite effective (especially when you have no choice) § Very common hack: use α x h(n) for admissible h, α > 1 to generate a faster but less optimal inadmissible h’ PDF created with pdfFactory Pro trial version www.pdffactory.com

  25. Example: 8-Puzzle § What are the states? § What are the actions? § What states can I reach from the start state? § What should the costs be? PDF created with pdfFactory Pro trial version www.pdffactory.com

  26. 8-Puzzle I § Number of tiles misplaced? § Why is it admissible? Average nodes expanded when 8 § h(start) = optimal path has length… …4 steps …8 steps …12 steps § This is a relaxed- 3.6 x 10 6 ID 112 6,300 problem heuristic TILES 13 39 227 PDF created with pdfFactory Pro trial version www.pdffactory.com

  27. 8-Puzzle II § What if we had an easier 8-puzzle where any tile could slide any one direction at any time? § Total Manhattan distance Average nodes expanded when § Why admissible? optimal path has length… …4 steps …8 steps …12 steps § h(start) = 3 + 1 + 2 + … TILES 13 39 227 MAN- 12 25 73 = 18 HATTAN PDF created with pdfFactory Pro trial version www.pdffactory.com

  28. 8-Puzzle III § How about using the actual cost as a heuristic? § Would it be admissible? § Would we save on nodes? § What’s wrong with it? § With A*, trade-off between quality of estimate and work per node! PDF created with pdfFactory Pro trial version www.pdffactory.com

  29. Trivial Heuristics, Dominance § Dominance: § Heuristics form a semi-lattice: § Max of admissible heuristics is admissible § Trivial heuristics § Bottom of lattice is the zero heuristic (what does this give us?) § Top of lattice is the exact heuristic PDF created with pdfFactory Pro trial version www.pdffactory.com

  30. Course Scheduling § From the university’s perspective: § Set of courses {c 1 , c 2 , … c n } § Set of room / times {r 1 , r 2 , … r n } § Each pairing (c k , r m ) has a cost w km § What’s the best assignment of courses to rooms? § States: list of pairings § Actions: add a legal pairing § Costs: cost of the new pairing § Admissible heuristics? PDF created with pdfFactory Pro trial version www.pdffactory.com

  31. Other A* Applications § Pathing / routing problems § Resource planning problems § Robot motion planning § Language analysis § Machine translation § Speech recognition § … PDF created with pdfFactory Pro trial version www.pdffactory.com

  32. Summary: A* § A* uses both backward costs and (estimates of) forward costs § A* is optimal with admissible heuristics § Heuristic design is key: often use relaxed problems PDF created with pdfFactory Pro trial version www.pdffactory.com

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