Informed Search Algorithms
Informed Search Algorithms
Informed Search Algorithms
Chapter 4
Outline
• Best-first search
• Greedy best-first search
• A* search
• Heuristics
• Local search algorithms
• Hill-climbing search
• Simulated annealing search
• Local beam search
• Genetic algorithms
Best-first search
• Idea: use an evaluation function f(n) for each node
– estimate of "desirability"
Expand most desirable unexpanded node
• Implementation:
Order the nodes in fringe in decreasing order of
desirability
• Two approaches:
– Expand the node closest to the goal
– Expand the node with least cost solution path
• Special cases:
– greedy best-first search
– A* search
Romania with step costs in km
Greedy best-first search
• Evaluation function f(n) = h(n) (heuristic)
= estimate of cost from n to goal
• e.g., hSLD(n) = straight-line distance from n
to Bucharest
• Greedy best-first search expands the node
that appears to be closest to goal
• Minimizes estimated cost to reach the goal
state
Greedy best-first search
example
Greedy best-first search
example
Greedy best-first search
example
Greedy best-first search
example
Properties of greedy best-first
search
• Complete? No – can get stuck in loops, e.g., Iasi
Neamt Iasi Neamt
• Susceptible to wrong start and quality of heuristic function
• Time? O(bm), but a good heuristic can give
dramatic improvement
• Space? O(bm) -- keeps all nodes in memory
• Optimal? No; goes on selected a single path and
never checks for other possibilities
A search
*
• 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
Optimality of A *
• h1(S) = ?
• h2(S) = ?
•
Admissible heuristics
E.g., for the 8-puzzle:
• h1(n) = number of misplaced tiles
• h2(n) = total Manhattan distance
(i.e., no. of squares from desired location of each tile)
• h1(S) = ? 8
• h2(S) = ? 3+1+2+2+2+3+3+2 = 18
•
Dominance
• If h2(n) ≥ h1(n) for all n (both admissible)
• then h2 dominates h1
• h2 is better for search
•
Hill-climbing search
• Problem: depending on initial state, can
get stuck in local maxima
•
Hill-climbing search: 8-queens problem
• h = number of pairs of queens that are attacking each other, either directly
or indirectly
• h = 17 for the above state
•
Hill-climbing search: 8-queens problem
•
Properties of simulated
annealing search
• One can prove: If T decreases slowly enough,
then simulated annealing search will find a
global optimum with probability approaching 1