11 Performance Measures of Search Algorithms Completeness Is the algorithm guaranteed to find a solution when there is one?Optimality Is this solution optimal?Time complexity How long does it take?Space complexity How much memory does it require?
12 Important ParametersMaximum number of successors of any state branching factor b of the search treeMinimal length of a path in the state space between the initial and a goal state depth d of the shallowest goal node in the search tree
13 Evaluation of Breadth-first Search b: branching factord: depth of shallowest goal nodeCompleteOptimal if step cost is 1Number of nodes generated: 1 + b + b2 + … + bd = (bd+1-1)/(b-1) = O(bd)Time and space complexity is O(bd)
14 Big O Notationg(n) is in O(f(n)) if there exist two positive constants a and N such that:for all n > N, g(n) af(n)
15 Time and Memory Requirements #NodesTimeMemory2111.01 msec11 Kbytes411,1111 msec1 Mbyte6~1061 sec100 Mb8~108100 sec10 Gbytes10~10102.8 hours1 Tbyte12~101211.6 days100 Tbytes14~10143.2 years10,000 TbAssumptions: b = 10; 1,000,000 nodes/sec; 100bytes/node
16 Evaluation of Depth-first Search b: branching factord: depth of shallowest goal nodem: maximal depth of a leaf nodeComplete only for finite search treeNot optimalNumber of nodes generated: 1 + b + b2 + … + bm = O(bm)Time complexity is O(bm)Space complexity is O(bm) or O(m)
17 Depth-Limited Strategy Depth-first with depth cutoff k (maximal depth below which nodes are not expanded)Three possible outcomes:SolutionFailure (no solution)Cutoff (no solution within cutoff)
19 Iterative Deepening Strategy Repeat for k = 0, 1, 2, …:Perform depth-first with depth cutoff kCompleteOptimal if step cost =1Space complexity is: O(bd) or O(d)Time complexity is: (d+1)(1) + db + (d-1)b2 + … + (1) bd = O(bd)Same as BFS! WHY???
21 Comparison of Strategies Breadth-first is complete and optimal, but has high space complexityBad when branching factor is highDepth-first is space efficient, but neither complete nor optimalBad when search depth is infiniteIterative deepening is asymptotically optimal
22 Uniform-Cost Strategy Each step has some cost > 0.The cost of the path to each fringe node N isg(N) = costs of all steps.The goal is to generate a solution path of minimal cost.The queue FRINGE is sorted in increasing cost.SSGABC5115101A5B15CG11G10
23 Repeated States No Few Many 1 2 3 4 5 6 7 8 search tree is finite 8-queensNoassembly planningFew123456788-puzzle and robot navigationManysearch tree is finitesearch tree is infinite
24 Avoiding Repeated States Requires comparing state descriptionsBreadth-first strategy:Keep track of all generated statesIf the state of a new node already exists, then discard the node
25 Avoiding Repeated States Depth-first strategy:Solution 1:Keep track of all states associated with nodes in current pathIf the state of a new node already exists, then discard the node Avoids loopsSolution 2:Keep track of all states generated so farIf the state of a new node has already been generated, then discard the node Space complexity of breadth-first
26 Summary Search strategies: breadth-first, depth-first, and variants Evaluation of strategies: completeness, optimality, time and space complexityAvoiding repeated states