Upload
shruti-shru
View
216
Download
0
Embed Size (px)
Citation preview
7/24/2019 3_Informed_search_algorithms.pdf
1/24
Informed search algorithms
Chapter 3 Section 3.5 & 3.6
7/24/2019 3_Informed_search_algorithms.pdf
2/24
Outline
Best-first search
Greedy best-first search
A*search
Heuristics
7/24/2019 3_Informed_search_algorithms.pdf
3/24
Best-first search
Idea: use an evaluation functionf(n) for each node
estimate of "desirability"
Expand most desirable unexpanded node
Implementation:Order the nodes in fringe in decreasing order of desirability
Special cases: greedy best-first search
A*search
7/24/2019 3_Informed_search_algorithms.pdf
4/24
Romania with step costs in km
7/24/2019 3_Informed_search_algorithms.pdf
5/24
Greedy best-first search
Evaluation functionf(n) = h(n) (heuristic) = estimate of cost from
nto goal
e.g., hSLD(n)= straight-line distance from nto Bucharest
Greedy best-first search expands the node that appearsto be
closest to goal
7/24/2019 3_Informed_search_algorithms.pdf
6/24
Greedy best-first search example
7/24/2019 3_Informed_search_algorithms.pdf
7/24
Greedy best-first search example
7/24/2019 3_Informed_search_algorithms.pdf
8/24
Greedy best-first search example
7/24/2019 3_Informed_search_algorithms.pdf
9/24
Greedy best-first search example
7/24/2019 3_Informed_search_algorithms.pdf
10/24
Properties of greedy best-first search
Complete?Nocan get stuck in loops, e.g., IasiNeamt
IasiNeamt
Time?O(b
m
), but a good heuristic can give dramaticimprovement
Space?O(bm) -- keeps all nodes in memory
Optimal?No
7/24/2019 3_Informed_search_algorithms.pdf
11/24
A*search
Idea: avoid expanding paths that are already
expensive
Evaluation functionf(n) = g(n) + h(n)
g(n) = cost so far to reach n
h(n)= estimated cost from nto goal
f(n) = estimated total cost of path through nto goal
7/24/2019 3_Informed_search_algorithms.pdf
12/24
A*search example
7/24/2019 3_Informed_search_algorithms.pdf
13/24
A*search example
7/24/2019 3_Informed_search_algorithms.pdf
14/24
A*search example
7/24/2019 3_Informed_search_algorithms.pdf
15/24
A*search example
7/24/2019 3_Informed_search_algorithms.pdf
16/24
A*search example
7/24/2019 3_Informed_search_algorithms.pdf
17/24
A*search example
7/24/2019 3_Informed_search_algorithms.pdf
18/24
Admissible heuristics
A heuristic h(n)is admissibleif for every node n,
h(n) h*(n), where h*(n)is the true cost to reach the goal
state from n.
An admissible heuristic never overestimatesthe cost to reach
the goal, i.e., it is optimistic
Example: hSLD(n) (never overestimates the actual road
distance)
Theorem: If h(n) is admissible, A*using TREE-SEARCHis
optimal
7/24/2019 3_Informed_search_algorithms.pdf
19/24
Optimality of A*(proof by contradiction)
Suppose some suboptimal goal G2has been generated and is in the fringe.Let nbe an unexpanded node in the fringe such that n is on a shortestpath to an optimal goal G.
f(G2) = g(G2) since h(G2) = 0
> g(G) since G2is suboptimal
f(n) since h is admissible
Since f(G2) f(n), A* will NEVER select G2for expansion.
7/24/2019 3_Informed_search_algorithms.pdf
20/24
Consistent heuristics
A heuristic is consistentif for every node n, every successor n'of ngeneratedby any action a,
h(n) c(n,a,n') + h(n')
If his consistent, we havef(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-SEARCHis optimal
7/24/2019 3_Informed_search_algorithms.pdf
21/24
Optimality of A*
A*expands nodes in order of increasingfvalue
Gradually adds "f-contours" of nodes
Contour ihas all nodes withf=fi, wherefi< fi+1
7/24/2019 3_Informed_search_algorithms.pdf
22/24
Properties of A*
Complete?Yes (unless there are infinitely many nodes with f
f(G) )
Time?Exponential
Space?Keeps all nodes in memory
Optimal?Yes
7/24/2019 3_Informed_search_algorithms.pdf
23/24
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) = ?
h2(S) = ?
7/24/2019 3_Informed_search_algorithms.pdf
24/24
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