Search

Search
 Exhaustive/Blind Search Methods


Depth First Search
Breadth First Search
 Heuristic Methods



Hill Climbing
Beam Search
Best First Search…
Goal
 You should be able to tell if search is the best
way to solve a problem and
 If so, which search method is most suitable
Find a Path
3
4
A
B
5
s
4
C
5
G
4
D
2
E
4
F
3
Find a Path
 Shortest Path
 Any Path
 Blind Search


BFS
DFS
Search Tree
 List all possible paths
 Eliminate cycles from paths
 Result: A search tree

A special kind of semantic tree where each node
denotes a path
Search Tree – Terminology
 Root Node
 Leaf Node
 Ancestor/Descendant
 Branching factor
 Complete path/Partial path
 Expanding open nodes results in closed
nodes
Search Trees - Analysis
 Exponential explosion of possible paths
 Branching factor b, Depth d, how many
possible paths?
Depth First Search (DFS)
 Form a one element queue consisting of a zerolength path that only contains root
 Until the first path in the queue terminates at the
goal node or the queue is empty



Remove the first path from the queue; create new paths
by extending the first path to all neighbors of the
terminal node
Reject all new paths with loops
Add the new paths if any to the FRONT of the queue
 If the goal node is foundsuccess; else failure
Breadth First Search (BFS)
 Form a one element queue consisting of a zerolength path that only contains root
 Until the first path in the queue terminates at the
goal node or the queue is empty



Remove the first path from the queue; create new paths
by extending the first path to all neighbors of the
terminal node
Reject all new paths with loops
Add the new paths if any to the BACK of the queue
 If the goal node is foundsuccess; else failure
BFS or DFS
 DFS is good when partial paths quickly reach
dead ends or become complete paths. DFS is
bad when there are long paths (infinite)
 BFS works on trees that are effectively
infinitely deep, bad when all paths lead to the
goal node at more or less the same depth.
BFS is not good when b is large
NonDeterministic Search
 Form a one element queue consisting of a zerolength path that only contains root
 Until the first path in the queue terminates at the
goal node or the queue is empty



Remove the first path from the queue; create new paths
by extending the first path to all neighbors of the
terminal node
Reject all new paths with loops
Add the new paths at RANDOM places in the queue
 If the goal node is foundsuccess; else failure
NDFS
 When you do not have enough information to
choose between BFS and DFS