Informed (Heuristic) Search: Mona Leeza Email: Monaleeza - Bukc@Bahria - Edu.Pk
Informed (Heuristic) Search: Mona Leeza Email: Monaleeza - Bukc@Bahria - Edu.Pk
Mona Leeza
Email : [email protected]
Outline
• Informed Search
• Uninformed Versus Informed Search
• Best First Search
• Greedy Search
• A* Search
Informed Search
• Informed searches use domain knowledge
to guide selection of the best path to continue
searching
• Heuristics are used, which are informed
guesses
• Heuristic means "serving to aid discovery“
• A heuristic is a function that estimates the
cost of reaching a goal from a given state
Informed Search
• Define a heuristic function, h(n)
– uses domain-specific information in some way
– is computable from the current state description
– it estimates
• the "goodness" of node n
• how close node n is to a goal
• the cost of minimal cost path from node n to a goal
state
Informed Search
• h(n) ≥ 0 for all nodes n
• h(n) close to 0 means we think n is close to a goal state
• h(n) very big means we think n is far from a goal state
• A* search
• Best first search using an “admissible” heuristic function f
that takes into account the current cost g
• Always returns the optimal solution path
Greedy Best First Search
eval-fn: f(n) = h(n)
Greedy Best-First Search
• Greedy best-first search tries to expand the node
that is closest to the goal, on the grounds that it is
likely to lead to a solution quickly.
• Thus, it evaluates nodes by using just the heuristic
function; that is, f(n)=h(n).
• Evaluation function
f(n) = h(n) (heuristic) = estimate of cost from n to goal
C 140 B B 374
111 C 329
E
D 80 99 D 244
E 253
G F
F 178
97 G 193
H 211 H 98
101 I 0
I
Goal f(n) = h (n) = straight-line distance heuristic
Greedy Search
Start State Heuristic: h(n)
A 75
118 A 366
C 140 B B 374
111 C 329
E
D 80 99 D 244
E 253
G F
F 178
97 G 193
H 211 H 98
101 I 0
I
Goal f(n) = h (n) = straight-line distance heuristic
Greedy Search
Start State Heuristic: h(n)
A 75
118 A 366
C 140 B B 374
111 C 329
E
D 80 99 D 244
E 253
G F
F 178
97 G 193
H 211 H 98
101 I 0
I
Goal f(n) = h (n) = straight-line distance heuristic
Greedy Search
Start State Heuristic: h(n)
A 75
118 A 366
C 140 B B 374
111 C 329
E
D 80 99 D 244
E 253
G F
F 178
97 G 193
H 211 H 98
101 I 0
I
Goal f(n) = h (n) = straight-line distance heuristic
Greedy Search
Start State Heuristic: h(n)
A 75
118 A 366
C 140 B B 374
111 C 329
E
D 80 99 D 244
E 253
G F
F 178
97 G 193
H 211 H 98
101 I 0
I
Goal f(n) = h (n) = straight-line distance heuristic
Greedy Search
Start State Heuristic: h(n)
A 75
118 A 366
C 140 B B 374
111 C 329
E
D 80 99 D 244
E 253
G F
F 178
97 G 193
H 211 H 98
101 I 0
I
Goal f(n) = h (n) = straight-line distance heuristic
Greedy Search
Start State Heuristic: h(n)
A 75
118 A 366
C 140 B B 374
111 C 329
E
D 80 99 D 244
E 253
G F
F 178
97 G 193
H 211 H 98
101 I 0
I
Goal f(n) = h (n) = straight-line distance heuristic
Greedy Search
Start State Heuristic: h(n)
A 75
118 A 366
C 140 B B 374
111 C 329
E
D 80 99 D 244
E 253
G F
F 178
97 G 193
H 211 H 98
101 I 0
I
Goal f(n) = h (n) = straight-line distance heuristic
Greedy Search
Start State Heuristic: h(n)
A 75
118 A 366
C 140 B B 374
111 C 329
E
D 80 99 D 244
E 253
G F
F 178
97 G 193
H 211 H 98
101 I 0
I
Goal f(n) = h (n) = straight-line distance heuristic
Greedy Search
Start State Heuristic: h(n)
A 75
118 A 366
C 140 B B 374
111 C 329
E
D 80 99 D 244
E 253
G F
F 178
97 G 193
H 211 H 98
101 I 0
I
Goal f(n) = h (n) = straight-line distance heuristic
Greedy Search – Tree Search
Start State Heuristic
A : h(n)
A 366
B 374
C 329
D 244
E 253
F 178
G 193
H 98
I 0
Greedy Search – Tree Search
Start State Heuristic
118
A 75 : h(n)
A 366
[329] 140 [374] B
C B 374
[253] E C 329
D 244
E 253
F 178
G 193
H 98
I 0
Greedy Search – Tree Search
Start State Heuristic
118
A 75 : h(n)
A 366
[329] 140 [374] B
C B 374
[253] E C 329
80 99
D 244
[193] [178] E 253
G F
[366] A F 178
G 193
H 98
I 0
Greedy Search – Tree Search
Start State Heuristic
118
A 75 : h(n)
A 366
[329] 140 [374] B
C B 374
[253] E C 329
80 99
D 244
[193] [178] E 253
G F
[366] A F 178
211
G 193
H 98
[253] I [0]
E I 0
Goal
Greedy Search – Tree Search
Start
A 75
118
State Heuristic
[374] B
[329] C 140 : h(n)
A 366
[253] E
80 99 B 374
C 329
[193] [178]
G F D 244
[366] A
211 E 253
F 178
[253] I [0] G 193
E
H 98
Goal
I 0
Path cost(A-E-F-I) = 253 + 178 + 0 = 431
dist(A-E-F-I) = 140 + 99 + 211 = 450
Greedy Search: Optimal ?
State Heuristic: h(n)
Start A 366
A
118 75 B 374
140 B C 329
C
111 D 244
E
D 80 99 E 253
F 178
G F G 193
97 H 98
H 211 I 0
g(n)
f(n) = g(n)+h(n) n
h(n)
A* Search
State Heuristic: h(n)
Start A 366
A
118 75 B 374
140 B C 329
C
111 D 244
E
D 80 99 E 253
F 178
G F G 193
97 H 98
H 211 I 0
97 G 193
H H 138
211
I 0
101
I f(n) = g(n) + h (n) – (H-I) Overestimated
Goal
g(n): is the exact cost to reach node n from the initial state.
A* Search: Tree Search
A Start
A* Search: Tree Search
A Start
118 75
140
E [393] B [449]
[447] C
A* Search: Tree Search
A Start
118 75
140
E [393] B [449]
[447] C
80 99
[413] G F [417]
A* Search: Tree Search
A Start
118 75
140
E [393] B [449]
[447] C
80 99
[413] G F [417]
97
[455] H
A* Search: Tree Search
A Start
118 75
140
E [393] B [449]
[447] C
80 99
[413] G F [417]
97
[455] H Goal I [450]
A* Search: Tree Search
A Start
118 75
140
E [393] B [449]
[447] C
80 99
A Start
118 75
140
E [393] B [449]
[447] C
80 99
A Start
118 75
140
E [393] B [449]
[447] C
80 99
A Start
118 75
140
E [393] B [449]
[447] C
80 99
Goal
TUTORIAL 04 A 56
B 22
8. Consider the following map (not drawn to scale). C 30
D 29
E 29
F 30
G 14
H 10
I 8
J 5
K 30
L 15
M 0
Use the A* algorithm to work out a route from town A to town M. Use the following cost functions.
•G(n) = The cost of each move as the distance between each town (shown on map).
•H(n) = The Straight Line Distance between any town and town M. These distances are given in the
table to right of map.
•Provide the search tree for your solution, showing the order in which the nodes were expanded
and the cost at each node. You should not re-visit a town that you have just come from.
•State the route you would take and the cost of that route.