Presentation is loading. Please wait.

Presentation is loading. Please wait.

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.

Similar presentations


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:

1 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*

2 5-Nov-2003 Example: the 8-puzzle How would you use AI techniques to solve the 8-puzzle problem?

3 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?

4 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 5-Nov-2003 How to get from Arad to Bucharest? How to get from Isai to Fagaras?

6 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?

7 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?

8 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…

9 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

10 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?

11 5-Nov-2003 Search CostEffective Branching Factor IDSA*(h1)A*(h2)IDSA*(h1)A*(h2) 210662.451.79 411213122.871.481.45 668020182.731.341.30 8638439252.801.331.24 104712793392.791.381.22 12364404227732.781.421.24 1434739415391132.831.441.23 1613012111.451.25 1830563631.461.26 2072766761.471.27 221809412191.481.28 243913516411.481.26


Download ppt "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."

Similar presentations


Ads by Google