290 likes | 326 Views
Explore best-first search, A* algorithm, and heuristic search strategies for optimizing pathfinding in large graphs, focusing on efficient navigation through complex networks. Learn how to leverage heuristics like Manhattan distance to enhance graph traversal algorithms.
E N D
Heuristic Search Henry Kautz
Problem: Large Graphs • It is expensive to find optimal paths in large graphs, using BFS, IDS, or Uniform Cost Search (Dijkstra’s Algorithm) • How can we search large graphs efficiently by using “commonsense” about which direction looks most promising?
Example 53nd St 52nd St G 51st St S 50th St 10th Ave 9th Ave 8th Ave 7th Ave 6th Ave 5th Ave 4th Ave 2nd Ave 3rd Ave Plan a route from 9th & 50th to 3rd & 51st
Example 53nd St 52nd St G 51st St S 50th St 10th Ave 9th Ave 8th Ave 7th Ave 6th Ave 5th Ave 4th Ave 2nd Ave 3rd Ave Plan a route from 9th & 50th to 3rd & 51st
Best-First Search • The Manhattan distance ( x+ y) is an estimate of the distance to the goal • It is a search heuristic • Best-First Search • Order nodes in priority to minimize estimated distance to the goal • Compare: Uniform-Cost / Dijkstra’s • Order nodes in priority to minimize distance from the start
Best-First Search • Fringe: Priority queue (heap) • Key: h(n) – heuristic estimate of distance from n to goal
Obstacles • Best-FS eventually will expand vertex to get back on the right track S G 52nd St 51st St 50th St 10th Ave 9th Ave 8th Ave 7th Ave 6th Ave 5th Ave 4th Ave 2nd Ave 3rd Ave
Non-Optimality of Best-First Path found by Best-first = 10 53nd St 2 3 52nd St 1 2 S G 5 4 3 2 51st St 1 50th St 5 4 3 2 1 7 6 10th Ave 9th Ave 8th Ave 7th Ave 6th Ave 5th Ave 4th Ave 2nd Ave 3rd Ave Shortest Path = 8
Improving Best-First • Best-first is often tremendously faster than UCS, but might stop with a non-optimal solution • How can it be modified to be (almost) as fast, but guaranteed to find optimal solutions? • A* - Hart, Nilsson, Raphael 1968 • One of the first significant algorithms developed in AI • Widely used in many applications
h values 53nd St 2 3 52nd St 1 2 S G 5 4 3 2 51st St 1 50th St 5 4 3 2 1 7 6 10th Ave 9th Ave 8th Ave 7th Ave 6th Ave 5th Ave 4th Ave 2nd Ave 3rd Ave
g values 53nd St 8 7 52nd St 9 6 S G 1 2 3 4 51st St 5 50th St 3 4 5 6 7 1 2 10th Ave 9th Ave 8th Ave 7th Ave 6th Ave 5th Ave 4th Ave 2nd Ave 3rd Ave
f = g + h 53nd St 10 10 52nd St 10 8 S G 6 6 6 6 51st St 6 50th St 8 8 8 8 8 8 8 10th Ave 9th Ave 8th Ave 7th Ave 6th Ave 5th Ave 4th Ave 2nd Ave 3rd Ave
A* Graph Search • Optimal if h is consistent as well as admissible
A* Graph Search for Any Admissible Heuristic if State[node] is not in closed OR g[node] < g[LookUp(State[node],closed)] then
Properties of Heuristics • Let h1 and h2 be admissible heuristics • if for all s, h1(s) h2(s), then • h1 dominates h2 • h1 is better than h2 • h3(s) = max(h1(s), h2(s)) is admissible • h3 dominates h1 and h2
Exercise: Rubik’s Cube • State: position and orientation of each cubie • Corner cubie: 8 positions, 3 orientations • Edge cubie: 8 positions, 2 orientations • Center cubie: 1 position – fixed • Move: Turn one face • Center cubits never move! • Devise an admissible heuristic
Next • Heuristic functions for STRIPS planning • Games