Informed Search
A* search example
Stages in a greedy best-first tree search for Bucharest with the straight-line distance heuristic hSLD. Nodes are labeled with their h-values.
Stages in an A* search for Bucharest. Nodes are labeled with f = g +h. The
h values are the straight-line distances to Bucharest
A* search example
Comparing A* and greedy search
greedy search path 🡺 140 + 99 + 211 = 450
A* search path 🡺 140 + 80+ 97 + 101 = 418
A* search: another example
Assume h(n)=
A* search: another example
f(n) = g(n) + h(n)
Example
Uniform Cost Search
A* Search
Example (A*search)
Results on A*�
Results on A*�
B
A
C
E
D
H
I
G
K
L
Z
14
12
9
9
11
8
13
13
10
10
9
A* search another example
Admissible heuristics
h(n)≤ h*(n), � h*(n): true cost to reach the goal state from n
13
CONSISTENCY or MONOTONICITY
Consistent heuristics
h(n) ≤ c(n,a,n') + h(n')�
f(n') = g(n') + h(n')
= g(n) + c(n,a,n') + h(n')
≥ g(n) + h(n)
= f(n)�
15
Optimality of A* (proof)
16
Optimality of A* (proof)
🡪 f(G2) > f(n), and A* will never select G2 for expansion�
17
A* search example
Stages in a greedy best-first tree search for Bucharest with the straight-line distance heuristic hSLD. Nodes are labeled with their h-values.
Stages in an A* search for Bucharest. Nodes are labeled with f = g +h. The
h values are the straight-line distances to Bucharest
Optimality of A*
19
Map of Romania showing contours at f = 380, f = 400, and f = 420, with Arad as the start state. Nodes inside a given contour have f-costs less than or equal to the
contour value.
Properties of A*
Exponential
Keeps all nodes in memory
Yes
20
About Heuristics
21
Heuristic Accuracy
h2 dominates h1
Claim 3: �Every node expanded by A* using h2 is also expanded by A* using h1.
22
Example of Evaluation Function
23
f(N) = (sum of distances of each tile to its goal)
+ 3 x (sum of score functions for each tile)
score function: for a non-central tile is 2 if it is
not followed by the correct tile in clockwise order
and 0 otherwise
1
2
3
4
5
6
7
8
1
2
3
4
5
6
7
8
N
goal
f(N) = 2 + 3 + 0 + 1 + 3 + 0 + 3 + 1
3x(2 + 2 + 2 + 2 + 2 + 0 + 2)
= 49
Heuristic Function
24
1
2
3
4
5
6
7
8
1
2
3
4
5
6
7
8
N
goal
h(N) = number of misplaced tiles� = 6
Heuristic Function
25
1
2
3
4
5
6
7
8
1
2
3
4
5
6
7
8
N
goal
h(N) = sum of the distances of
every tile to its goal position
= 2 + 3 + 0 + 1 + 3 + 0 + 3 + 1
= 13
8-Puzzle
26
4
5
5
3
3
4
3
4
4
2
1
2
0
3
4
3
f(N) = h(N) = number of misplaced tiles
8-Puzzle
27
0+4
1+5
1+5
1+3
3+3
3+4
3+4
3+2
4+1
5+2
5+0
2+3
2+4
2+3
f(N) = g(N) + h(N) with h(N) = number of misplaced tiles
8-Puzzle
28
5
6
6
4
4
2
1
2
0
5
5
3
f(N) = h(N) = Σ distances of tiles to goal
Robot Navigation
29
h(N) = Straight-line distance to the goal
= [(Xg – XN)2 + (Yg – YN)2]1/2
XN
YN
N
Robot navigation
30
Cost of one horizontal/vertical step = 1
Cost of one diagonal step = √2
h(N) = straight-line distance to the goal is admissible
Robot Navigation
31
Robot Navigation
32
0
2
1
1
5
8
7
7
3
4
7
6
7
6
3
2
8
6
4
5
2
3
3
3
6
5
2
4
4
3
5
5
4
6
5
6
4
5
f(N) = h(N), with h(N) = Distance to the goal
Robot Navigation
33
0
2
1
1
5
8
7
7
3
4
7
6
7
6
3
2
8
6
4
5
2
3
3
3
6
5
2
4
4
3
5
5
4
6
5
6
4
5
f(N) = h(N), with h(N) = Distance to the goal
7
0
Robot Navigation
34
f(N) = g(N)+h(N), with h(N) = Distance to goal
0
2
1
1
5
8
7
7
3
4
7
6
7
6
3
2
8
6
4
5
2
3
3
3
6
5
2
4
4
3
5
5
4
6
5
6
4
5
7+0
6+1
6+1
8+1
7+0
7+2
6+1
7+2
6+1
8+1
7+2
8+3
7+2
6+3
6+3
5+4
5+4
4+5
4+5
3+6
3+6
2+7
8+3
7+4
7+4
6+5
5+6
6+3
5+6
2+7
3+8
4+7
5+6
4+7
3+8
4+7
3+8
3+8
2+9
2+9
3+10
2+9
3+8
2+9
1+10
1+10
0+11
Robot Navigation
35
Cost of one horizontal/vertical step = 1
Cost of one diagonal step = √2
f(N) = g(N) + h(N), with h(N) = straight-line distance from N to goal
8-Puzzle
36
1
2
3
4
5
6
7
8
1
2
3
4
5
6
7
8
N
goal
is admissible