search strategies (slides 3) Flashcards
how is a search strategy defined?
by picking the order of node expansion
Strategy evaluation criterion
completeness-does it always find a solution?
time complexity-number of nodes generated
space complexity-max # of nodes in memory
optimality-does it always find a least cost soln?
time and space complexity measurement
b: maximum branching factor of the search tree
d: dept of the least-cost solution
m: maximum depth of the state space
uninformed search
use only the information available in the problem definition
- generate successors
- distinguish goals
uninformed search strategies
Breadth-first search Uniform-cost search Depth-first search Depth-limited search Iterative deepening search
breadth first search
expand shallowest unexpanded node
fringe is a FIFO queue
breadth-first search properties
completeness: yes
time: O(b^(d+1)) if goal test is performed at expansion time, O(b^d) otherwise
- d = depth
space: O(b^(d+1)) if goal test is performed at expansion time, O(b^d) otherwise
optimality: yes if cost = 1 per step
space is its biggest problem
uniform-cost search
expand least-cost unexpanded node
implentation:
- fringe = priority queue ordered by path cost g(x)
- goal test performed at expansion time
equivalent to breadth-first if step costs all equal
uniform-cost search properties
completeness: Yes, if step cost => e
- if there are some 0-cost edges it may get stuck on an infinite loop
time: # of nodes with g<= cost of optimal solution, O(b^(floor(C/e) + 1) where C is the cost of the optimal solution
space: same as time
optimality: yes, nodes are expanded in increasing order of g(n)
depth-first search(problem)
expand deepest unexpanded node
implementation:
-fringe = LIFO queue
depth-first search properties
completeness: no: fails in infinite depth spaces, spaces with loops
- Modify to avoid repeated states on path
- -> complete in finite spaces
time: O(b^m): terrible if m is much larger than d
- if solns are fast, may be much better than breadth first
space: O(bm) Linear!! (node along the path + unexpanded siblings)
optimal: no
depth-limited search(problem,l)
depth first search with depth limit L.
implementation of depth first search in eclipse
iterative deepening search(problem)
depth limited search with consecutively increasing depth limit
iterative deepening search
completeness: yes
time: O(b^d)
space: O(bd)
optimal: Yes, if step cost = 1 (or generally non decreasing function of depth)
Graph search
tree search with additional data structure containing visited nodes to prevent from revisiting them