Informed Searches: Associate Professor Email
Informed Searches: Associate Professor Email
4
A* (A Star)
g(n)
f(n) = g(n)+h(n) n
h(n)
5
Approach 3: f measures the total
cost of the solution path
(Admissible Heuristic Functions)
• A heuristic function f(n) = g(n) + h(n) is admissible if h(n) never
overestimates the cost to reach the goal.
– Admissible heuristics are “optimistic”: “the cost is not that much …”
• However, g(n) is the exact cost to reach node n from the initial state.
• Therefore, f(n) never over-estimate the true cost to reach the goal
state through node n.
• Theorem: A search is optimal if h(n) is admissible.
– I.e. The search using h(n) returns an optimal solution.
• Given h2(n) > h1(n) for all n, it’s always more efficient to use h2(n).
– h2 is more realistic than h1 (more informed), though both are optimistic.
6
A* Search
A* Search
A* Search
A* Search
A* Search
1) Can it go wrong?
Note: Greedy best first
Arad --- Sibiu --- Fagaras ---
Bucharest
A Start
14
A* Search: Tree Search
A Start
118 75
140
E [393] B [449]
[447] C
15
A* Search: Tree Search
A Start
118 75
140
E [393] B [449]
[447] C
80 99
[413] G F [417]
16
A* Search: Tree Search
A Start
118 75
140
E [393] B [449]
[447] C
80 99
[413] G F [417]
97
[415] H
17
A* Search: Tree Search
A Start
118 75
140
E [393] B [449]
[447] C
80 99
[413] G F [417]
97
[415] H
101
Goal I [418]
18
A* Search: Tree Search
A Start
118 75
140
E [393] B [449]
[447] C
80 99
[413] G F [417]
97
[415] H I [450]
101
Goal I [418]
19
A* Search: Tree Search
A Start
118 75
140
E [393] B [449]
[447] C
80 99
[413] G F [417]
97
[415] H I [450]
101
Goal I [418]
20
A* Search: Tree Search
A Start
118 75
140
E [393] B [449]
[447] C
80 99
[413] G F [417]
97
[415] H I [450]
101
Goal I [418]
21
A* Algorithm
A* with systematic checking for repeated
states …
1. Search queue Q is empty.
2. Place the start state s in Q with f value h(s).
3. If Q is empty, return failure.
4. Take node n from Q with lowest f value.
(Keep Q sorted by f values and pick the first element).
5. If n is a goal node, stop and return solution.
6. Generate successors of node n.
7. For each successor n’ of n do:
a) Compute f(n’) = g(n) + cost(n,n’) + h(n’).
b) If n’ is new (never generated before), add n’ to Q.
c) If node n’ is already in Q with a higher f value, replace it with
current f(n’) and place it in sorted order in Q.
End for
8. Go back to step 3.
22
A* Search: Analysis
A Start
27
A* Search: Tree Search
A Start
118 75
140
E [393] B [449]
[447] C
28
A* Search: Tree Search
A Start
118 75
140
E [393] B [449]
[447] C
80 99
[413] G F [417]
29
A* Search: Tree Search
A Start
118 75
140
E [393] B [449]
[447] C
80 99
[413] G F [417]
97
[455] H
30
A* Search: Tree Search
A Start
118 75
140
E [393] B [449]
[447] C
80 99
[413] G F [417]
211
97
[455] H Goal I [450]
31
A* Search: Tree Search
A Start
118 75
140
E [393] B [449]
[447] C
80 99
32
A* Search: Tree Search
A Start
118 75
140
E [393] B [449]
[447] C
80 99
33
A* Search: Tree Search
A Start
118 75
140
E [393] B [449]
[447] C
80 99
34
A* Search: Tree Search
A Start
118 75
140
E [393] B [449]
[447] C
80 99
97
[455] H Goal I [450=140+99+211]
101
I A* not
[418=140+80+97+101] optimal !!!
optimal !!! 35
Heuristics: (2) Consistency
• A heuristic is consistent (or monotone) if for every node n, every successor n' of n generated by any action
a,
• h(n) ≤ c(n,a,n') + h(n')
•
•
sequence of nodes expanded by A* is in
• nondecreasing order of f(n)
• the first goal selected for expansion must be
an optimal goal.
•
•
Desired properties heuristics:
• (1) consistent (admissible)
(2) As close to opt as we can get (sometimes go a bit over…)
(3) Easy to compute! We want to explore many nodes.
A* on 8-Puzzle with h(n) = # misplaced
tiles
Conclusions
• Frustration with uninformed search led to the idea
of using domain specific knowledge in a search so
that one can intelligently explore only the relevant
part of the search space that has a good chance of
containing the goal state. These new techniques
are called informed (heuristic) search strategies.
40