1 / 20

CS 312: Algorithm Analysis

This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License. CS 312: Algorithm Analysis. Lecture #37: A* (cont.); Admissible Heuristics. Credit : adapted from slides by Stuart Russell of UC Berkeley. Announcements. Homework #27 due today Project #7: TSP

oma
Download Presentation

CS 312: Algorithm Analysis

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License. CS 312: Algorithm Analysis Lecture #37: A* (cont.); Admissible Heuristics Credit: adapted from slides by Stuart Russell of UC Berkeley.

  2. Announcements • Homework #27 due today • Project #7: TSP • Early: today • Due: Friday! • Competition (“The Bake-Off”) • Big 3 problems in the “Competition” survey • Open categories: • #1: parallel implementations • #2: B&B without time bounds • #3: non B&B • Also required: “Competition Test Set” survey • Submit only once to this survey • Hall of Fame (Bake-Off results) presented next Monday • Also: Cookie Bake-Off on day of final

  3. Objectives • Prove the optimality of A* • Understand Admissible Heuristics • Revisit the idea of “Relaxed Problems” more deeply

  4. State-space search algorithms

  5. Theorem • If h(n) is admissible, then A* is optimal

  6. Proof of Optimality of A* • Suppose some sub-optimal goal state G2has been generated and is on the agenda. Let n be an unexpanded state on the agenda such that n is on a shortest (optimal) path to the optimal goal state G. Assume h() is admissible. f(G2) = g(G2) since h(G2) = 0 g(G2) > g(G) since G2 is suboptimal f(G) = g(G) since h(G) = 0 f(G2) > f(G) substitution

  7. Proof of Optimality of A* • Suppose some sub-optimal goal state G2has been generated and is on the agenda. Let n be an unexpanded state on the agenda such that n is on a shortest (optimal) path to the optimal goal state G. Assume h() is admissible. Now focus on n: h(n) ≤ h*(n) since h is admissible g(n) + h(n) ≤ g(n) + h*(n) algebra f(n) = g(n) + h(n) definition f(G) = g(n) + h*(n) by assumption f(n) ≤ f(G) substitution f(G2) = g(G2) since h(G2) = 0 g(G2) > g(G) since G2 is suboptimal f(G) = g(G) since h(G) = 0 f(G2) > f(G) substitution Hence f(G2) > f(n), and A* will never select G2 for expansion.

  8. Optimality of A* • A* expands states in order of increasing f value • Gradually adds "f-contours" of states • Like Uniform cost search, but more directed! • Contour i has all states with f=fi, where fi < fi+1

  9. Example: The 8-puzzle • states? • actions? • goal test? • path cost? What does the state space look like? How deep?

  10. Example: The 8-puzzle • states?locations of tiles • actions?move blank left, right, up, down • goal test?= goal state (given) • path cost? 1 per move

  11. Example: The 8-puzzle • Note: optimal solution of n-Puzzle family is NP-hard • Not known to be in NP

  12. Admissible heuristics?

  13. Admissible heuristics? • total pieces out of place • manhattan distance(blank, g_blank) • (or other norm) • optimal solution to problem with w/ 2 blanks (possibly solved recursively by A*!) • look-up in pattern database • if goal; 1 otherwise • total manhattan distance x 2 (-1) if blank involved • total of: optimal number of moves between any two locations on board

  14. Admissible heuristics E.g., for the 8-puzzle: • h1(n) = number of misplaced tiles • h2(n) = total Manhattan distance (i.e., no. of squares from desired location of each tile) • h1(S) = ? • h2(S) = ?

  15. Admissible heuristics E.g., for the 8-puzzle: • h1(n) = number of misplaced tiles • h2(n) = total Manhattan distance (i.e., no. of squares from desired location of each tile) • h1(S) = ? 8 • h2(S) = ? 3+1+2+2+2+3+3+2 = 18

  16. Relaxed problems • A problem with fewer restrictions is called a relaxed problem • Theorem:The cost of an optimal solution to a relaxed problem is an admissible heuristic for the original problem • E.g., our bound function for TSP

  17. Relaxed problems • If the rules of the 8-puzzle are relaxed • so that a tile can move anywhere • then h1(n) gives the shortest solution • If the rules are relaxed • so that a tile can move to any adjacent square • then h2(n) gives the shortest solution

  18. Dominance; i.e. Tighter Bounds • If h2(n) ≥ h1(n) for all n (both admissible) • then h2dominatesh1 • h2is better for search • Typical search costs (average number of states expanded) for d-puzzle: • d=12 (3x4 ?) Iterative Deepening Search (IDS) = 3,644,035 states A*(h1) = 227 states A*(h2) = 73 states • d=24 (4 x 6?) IDS = too many states A*(h1) = 39,135 states A*(h2) = 1,641 states

  19. Compare and Contrast • A* vs. Branch & Bound • Reasoning about an admissible heuristic in A* is like reasoning about optimistic bounds in B&B • A* doesn’t include a BSSF • Thus, B&B is potentially more memory efficient • How could you change A* or B&B to be more memory efficient? • Various forms of Beam search

  20. Assignment No more homework Finish Project #7! Reading: local search

More Related