Title: Heuristic Search Techniques
1Heuristic Search Techniques
- What do you do when the search space is very
large or infinite? - Well study three more AI search algorithms
- Backtracking search
- Greedy search (Best-first)
- A
2Example the 8-puzzle
- How would you use AI techniques to solve the
8-puzzle problem?
3Symbolic 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?
4Backtracking 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 salesmans circuit
- E.g. graph coloring
Depth-first search
Is there any way I can be smarter than a blind
search?
5- How to get from Arad to Bucharest?
- How to get from Isai to Fagaras?
6Greedy 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 doesnt always find the shortest path
- Susceptible to false starts
- May go down an infinite path with no way to reach
goal - How to ensure youll find the best solution?
7A
- Can we apply the ideas of Dijkstras 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?
8Optimality 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
9Heuristics 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
10Results 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?
11Search Cost Search Cost Search Cost Effective Branching Factor Effective Branching Factor Effective Branching Factor
IDS A(h1) A(h2) IDS A(h1) A(h2)
2 10 6 6 2.45 1.79 1.79
4 112 13 12 2.87 1.48 1.45
6 680 20 18 2.73 1.34 1.30
8 6384 39 25 2.80 1.33 1.24
10 47127 93 39 2.79 1.38 1.22
12 364404 227 73 2.78 1.42 1.24
14 3473941 539 113 2.83 1.44 1.23
16 1301 211 1.45 1.25
18 3056 363 1.46 1.26
20 7276 676 1.47 1.27
22 18094 1219 1.48 1.28
24 39135 1641 1.48 1.26