Download presentation
Presentation is loading. Please wait.
Published byAvice Jennings Modified over 9 years ago
1
CS 312: Algorithm Design & Analysis Lecture #37: A* (cont.); Admissible Heuristics Credit: adapted from slides by Stuart Russell of UC Berkeley. This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.Creative Commons Attribution-Share Alike 3.0 Unported License
2
Announcements Project #7: TSP Whiteboard: due today Early: next Wednesday (4/8) Due: next Friday (4/10) Competition (“The Bake-Off”) Big 3 problems in the Competition set survey 3 problems in the One-Time Competition set survey Hall of Fame (Bake-Off results) presented last day of class (4/13) Optional: Cookie Bake-Off Bring to final exam A bit of extra HW credit for winning this bake-off
3
Objectives Prove the optimality of A* Understand Admissible Heuristics Revisit the idea of “Relaxed Problems” more deeply
4
Search algorithms
5
A. Beam Search Q. How could you change A* or B&B to be more memory efficient? Various forms of Beam search: Agenda size Threshold from best Sacrifices guarantees of optimality
6
Theorem
7
Proof of Optimality of A * Suppose some sub-optimal goal state G 2 has 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. Focus on G 2 : f(G 2 ) = g(G 2 )since h(G 2 ) = 0 g(G 2 ) > g(G) since G 2 is suboptimal
8
Proof of Optimality of A * Suppose some sub-optimal goal state G 2 has 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(G 2 ) = g(G 2 )since h(G 2 ) = 0 g(G 2 ) > g(G) since G 2 is suboptimal Focus on G: f(G) = g(G)since h(G) = 0 f(G 2 ) > f(G)substitution
9
Proof of Optimality of A * Suppose some sub-optimal goal state G 2 has 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 Hence f(G 2 ) > f(n), and A * will never select G 2 for expansion. f(G 2 ) = g(G 2 )since h(G 2 ) = 0 g(G 2 ) > g(G) since G 2 is suboptimal f(G) = g(G)since h(G) = 0 f(G 2 ) > f(G)substitution
10
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=f i, where f i < f i+1
11
Consistent heuristics A heuristic is consistent if for every state n, every successor n' of n generated by any action a, h(n) ≤ c(n,a,n') + h(n') If h is consistent, we have f(n') = g(n') + h(n') = g(n) + c(n,a,n') + h(n') ≥ g(n) + h(n) = f(n) i.e., f(n) is non-decreasing along any path. Theorem: If h(n) is consistent, A* using GRAPH-SEARCH is optimal
12
Solving the 8-puzzle with A* states? actions? goal test? path cost g(n)?
13
Example: The 8-puzzle states? actions? goal test? path cost g(n)?
14
Example: The 8-puzzle states? actions? goal test? path cost g(n)?
15
Example: The 8-puzzle states? locations of tiles actions? move blank left, right, up, down goal test? = goal state (given) path cost g(n)? 1 per move
16
Example: The 8-puzzle What does the state space look like? How deep? Note: optimal solution of n-Puzzle family is NP- hard Not known to be in NP
17
Admissible heuristics?
19
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
20
Relaxed problems If the rules of the 8-puzzle are relaxed so that a tile can move anywhere then h 1 (n) gives the shortest solution If the rules are relaxed so that a tile can move to any adjacent square then h 2 (n) gives the shortest solution
21
Admissible heuristics E.g., for the 8-puzzle: h 1 (n) = number of misplaced tiles h 2 (n) = total Manhattan distance (i.e., no. of squares from desired location of each tile) h 1 (S) = ? h 2 (S) = ?
22
Admissible heuristics E.g., for the 8-puzzle: h 1 (n) = number of misplaced tiles h 2 (n) = total Manhattan distance (i.e., no. of squares from desired location of each tile) h 1 (S) = ? 8 h 2 (S) = ? 3+1+2+2+2+3+3+2 = 18
23
Dominance; i.e. Tighter Bounds If h 2 (n) ≥ h 1 (n) for all n (both admissible) then h 2 dominates h 1 h 2 is better for search Typical search costs (average number of states expanded) for d-puzzle: d=11 (3x4) Iterative Deepening Search (IDS) = 3,644,035 states A * (h 1 ) = 227 states A * (h 2 ) = 73 states d=24 (5 x 5) IDS = too many states A * (h 1 ) = 39,135 states A * (h 2 ) = 1,641 states
24
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
25
Assignment HW #28
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.