1
Heuristic (Informed)
Search
(Wh
t
t h
tl )
1
(Where we try to choose smartly)
R&N: Chap. 4, Sect. 4.1–3
Search Algorithm #2
SEARCH#2
1.
INSERT(initialnode,FRINGE)
Recall that the ordering
of FRINGE defines the
search strategy
2
2.
Repeat:
a.
If empty(FRINGE) then return
failure
b.
N
Å
REMOVE(FRINGE)
c.
s
Å
STATE(
N
)
d.
If GOAL?(
s
) then return
path or goal state
e.
For every state
s’
in SUCCESSORS(
s
)
i.
Create a node
N’
as a successor of
N
ii.
INSERT(
N’
,FRINGE)
BestFirst Search
It exploits
state description
to estimate
how “good” each search node is
An
evaluation function
f maps each node
N of the search tree to a real number
3
f(N)
≥
0
[Traditionally, f(N) is an estimated cost; so, the smaller
f(N), the more promising N]
Bestfirst search
sorts the FRINGE in
increasing f
[Arbitrary order is assumed among nodes with equal f]
BestFirst Search
It exploits
state description
to estimate
how “good” each search node is
An
evaluation function
f maps each node
N of the search tree to a real number
4
f(N)
≥
0
[Traditionally, f(N) is an estimated cost; so, the smaller
f(N), the more promising N]
Bestfirst search
sorts the FRINGE in
increasing f
[Arbitrary order is assumed among nodes with equal f]
“Best” does not refer to the quality
of the generated path
Bestfirst search does not generate
optimal paths in general
Typically, f(N) estimates:
•
either the
cost of a solution path through N
Then f(N) = g(N) + h(N), where
–
g(N) is the cost of the path from the initial node to N
–
h(N) is an estimate of the cost of a path from N to a goal node
How to construct f?
5
•
or the
cost of a path from N to a goal node
Then f(N) = h(N)
Æ
Greedy bestsearch
But there are no limitations on f. Any function
of your choice is acceptable.
But will it help the search algorithm?
Typically, f(N) estimates:
•
either the
cost of a solution path through N
Then f(N) = g(N) +
h(N)
, where
–
g(N) is the cost of the path from the initial node to N
–
h(N) is an estimate of the cost of a path from N to a goal node
How to construct f?
6
•
or the
cost of a path from N to a goal node
Then f(N) =
h(N)
But there are no limitations on f. Any function
of your choice is acceptable.
But will it help the search algorithm?
Heuristic function
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
2
The
heuristic function
h(N)
≥
0 estimates
the cost to go from
STATE
(N) to a goal state
Its value is
independent of the current
search tree
; it depends only on STATE(N)
and the goal test GOAL?
Heuristic Function
7
Example:
h
1
(N)
= number of misplaced numbered tiles = 6
[Why is it an estimate of the distance to the goal?]
1
4
7
5
2
6
3
8
STATE
(N)
6
4
7
1
5
2
8
3
Goal state
Other Examples
1
4
7
5
2
6
3
8
STATE
(N)
6
4
7
1
5
2
8
3
Goal state
8
h
1
(N)
= number of misplaced numbered tiles = 6
h
2
(N) = sum of the (Manhattan) distance of
every numbered tile to its goal position
= 2 + 3 + 0 + 1 + 3 + 0 + 3 + 1 = 13
h
3
(N) = sum of permutation inversions
= n
5
+ n
8
+ n
4
+ n
2
+ n
1
+ n
7
+ n
3
+ n
6
= 4
+ 6
+ 3
+ 1
+ 0 + 2
+ 0
+ 0
= 16
8Puzzle
5
3
4
3
4
3
f(N) = h(N) = number of misplaced numbered tiles
9
4
5
3
4
2
1
2
0
4
3
The white tile is the empty tile
1+5
3+3
3+4
2+3
8Puzzle
f(N) = g(N) + h(N)
This is the end of the preview.
Sign up
to
access the rest of the document.
 Winter '09
 A* search algorithm, Admissible heuristic, Consistent heuristic

Click to edit the document details