Artificial Intelligence "Search": Lecture Note
Artificial Intelligence "Search": Lecture Note
Artificial Intelligence "Search": Lecture Note
2012-11-15
An Overview of Search Algorithm
Depth-first search (DFS) is an algorithm for traversing
or searching a tree, tree structure, or graph.
1 1 2 3
2 3 4
G G
0 Iterative Deepening
code for threshold in 1, 2,
3,…
threshold = 1 1 2 3
depth-
first(threshold)
threshold = 2 4 memory Low
optimal Yes
threshold = 3 G
manage Stack(or
ment Transposition Table)
Using Heuristic
• What’s Heuristic
– Something not proven to be optimal
– evaluation, knowledge, estimation
• What’s Cost
– Number of edges
– Length of the path
– Speed for the path
– Etc.
Theoretical Estimation
0 (10)
Iterative Deepening
threshold = 1 1 2 1 A/A*
1 (7) 3 (8) 2 (5) code for threshold in 1, 2, 3,…
1
threshold = 2
2 1 1 3
heuristicSearch(threshold
(inf) 5 4 (6) (3) )
threshold = 3 2 1 memory Low
6 5 3 D
7 4 B 2
Loops/Transpostions:
h’ ( ) = MH() =
1 2 3 4 N S E W
5 6 7 8
Goal
9 A B C N W
D E F 0
h’( ) = MH = 0
Demo in 15 Puzzle
• Size 3 (rand 1000)
– Depth, Breadth(10^6), ID
– Best, A, IDA
• Size 4 (rand 500)
– A(10^6), IDA
Remarks
Optimal
Less Memory
IDA
A