Professional Documents
Culture Documents
5 - C UnInformed Search Strategies
5 - C UnInformed Search Strategies
Level 0
Level 1
Level 2
Level 3
5
Breadth-first search - Analysis
Complete - if the shallowest goal node is at some finite depth
d, breadth-first search will eventually find it
optimal - shallowest goal node is not necessarily the optimal
one - the same cost
Time Complexity - O(bd)
every state has b successors,
Space Complexity – O(bd)
O(bd−1) nodes in the explored set and O(bd) nodes in the
frontier
the memory requirements are a bigger problem for breadth-
first search than is the execution time
Depth-first search
expands the deepest node in the current frontier of the search
tree
uses a LIFO queue
most recently generated node is chosen for expansion
Depth-first search - Analysis
Complete - not complete
loop forever (or) fail if an infinite non-goal path is encountered
optimal - not optimal
Time Complexity - O(bm)
m itself can be much larger than d (the depth of the shallowest solution)
is infinite if the tree is unbounded
Space Complexity – O(bm)
to store only a single path from the root to a leaf node
remaining unexpanded sibling nodes for each node on the path
Depth-first search
Uniform-cost search
When all step costs are equal, breadth-first search is optimal
algorithm that is optimal with any step-cost function
Instead of expanding the shallowest node, expands the node n
with the lowest path cost.
uses a Priority queue
does not care about the number of steps a path has, but only
about their total cost
goal test is applied to a
node when it is selected
for expansion
Uniform-cost search - Analysis
Complete – yes, if, step cost is non-zero, positive
infinite - if there is a path with an infinite sequence of zero-cost actions
optimal - Yes, expands nodes in order of their optimal path cost
Time Complexity – O(b1+[C∗/ϵ])
Space Complexity –
C∗ be the cost of the optimal solution, and assume that every
action costs at least ϵ
When all step costs are equal, b1+C∗/ When all step costs are
equal, b1+[C∗/ϵ] is just bd+1
Depth-limited search
The failure of depth-first search in infinite state spaces can be
alleviated by a predetermined depth limit l.
nodes at depth l are treated as if they have no successors.
The depth limit solves the infinite-path problem.
In-completeness, if we choose l < d, the shallowest goal is
beyond the depth limit.
Non-optimal, if we choose l > d
Its time complexity is O(bl) and space complexity is O(bl).
Depth-first search can be viewed as a special case of depth-
limited search with l=∞.
depth limits can be based on knowledge of the problem
Iterative deepening DFS
depth-first tree search that finds the best depth limit.
gradually increase the limit — first 0, then 1, then 2, and so
on—until a goal is found.
This will occur when the depth limit reaches d, the depth of the
shallowest goal node
IDS combines the benefits of depth-first and breadth-first
search
Like DFS, its memory requirements are modest: O(bd)
Like BFS,
complete when the branching factor is finite and
optimal when the path cost is a non-decreasing function of the depth
of the node.
number of nodes generated in the worst case
Iterative deepening DFS
b complete if step costs ≥ for positive
c optimal if step costs are all identical
The End…
16