5-Nov-2003 Heuristic Search Techniques What do you do when the search space is very large or infinite? We’ll study three more AI search algorithms: Backtracking.
Published byModified over 5 years ago
Presentation on theme: "5-Nov-2003 Heuristic Search Techniques What do you do when the search space is very large or infinite? We’ll study three more AI search algorithms: Backtracking."— Presentation transcript:
5-Nov-2003 Heuristic Search Techniques What do you do when the search space is very large or infinite? We’ll study three more AI search algorithms: Backtracking search Greedy search (Best-first) A*
5-Nov-2003 Example: the 8-puzzle How would you use AI techniques to solve the 8-puzzle problem?
5-Nov-2003 Symbolic AI solution Start state: 5 4 0 6 1 8 7 3 2 (e.g.) Goal state: 1 2 3 8 0 4 7 6 5 Edges: sliding a tile. From start state: 5 4 8 6 1 0 7 3 2 5 0 4 6 1 8 7 3 2 What search algorithm should I use?
5-Nov-2003 Backtracking search Start at the start state Search in any direction Backtrack when stuck This is really the same as Used very frequently E.g. Perl regular expression matching E.g. finding a traveling salesman’s circuit E.g. graph coloring Depth-first search Is there any way I can be smarter than a blind search?
5-Nov-2003 How to get from Arad to Bucharest? How to get from Isai to Fagaras?
5-Nov-2003 Greedy Search (Best-first) Best-first search: like DFS, but pick the path that gets you closest to the goal first Need a measure of distance from the goal h(n) = estimated cost of cheapest path from n to goal h(n) is a heuristic Analysis Greed tends to work quite well (despite being one of the seven deadly sins) But, it doesn’t always find the shortest path Susceptible to false starts May go down an infinite path with no way to reach goal How to ensure you’ll find the best solution?
5-Nov-2003 A* Can we apply the ideas of Dijkstra’s algorithm? Pay attention to total path length, not just distance to the goal f(n) = g(n) + h(n) g(n) = distance traveled so far h(n) = estimated remaining distance (heuristic) A*: do a DFS-like search with lowest f(n) first Does this guarantee an optimal solution?
5-Nov-2003 Optimality of A* Suppose h(n) never overestimates (such heuristics are called admissible) Note that f(n) always increases as search progresses A* is complete and optimal (though often slower than best-first search) The first limitation you are likely to run into with A* search: not enough RAM in your computer…
5-Nov-2003 Heuristics for the 8-puzzle What would a good, admissible heuristic be for the 8-puzzle? h1: number of tiles out of place h2: total distance of squares from destinations
5-Nov-2003 Results of A* Consider solving the 8-puzzle by search, using the following algorithms DFS BFS IDS (iterative deepening search): like staged DFS. A* with heuristic h1 A* with heuristic h2 Will each be able to find the shortest solution? Which one will find it most quickly? Which ones will use lots of memory?