Presentation is loading. Please wait.

Presentation is loading. Please wait.

Implementation and Evaluation of Search Methods. Use a stack data structure. 1. Push root node of tree on the stack. 2. Pop the top node off the stack.

Similar presentations


Presentation on theme: "Implementation and Evaluation of Search Methods. Use a stack data structure. 1. Push root node of tree on the stack. 2. Pop the top node off the stack."— Presentation transcript:

1 Implementation and Evaluation of Search Methods

2 Use a stack data structure. 1. Push root node of tree on the stack. 2. Pop the top node off the stack. Call this node N. 3. Push children of node N onto the stack in right-to-left order (so they are popped in left-to-right order). 4. Repeat steps 2 and 3 until stack is empty or goal is reached. Simple Algorithm Depth-First Search

3 A General Algorithm

4 Implementation of different algorithms

5 Comparing Search Strategies Completeness – Will a solution be found if there is one? Optimality Will the optimal solution be found? Time Complexity Space Complexity

6 Breadth First Search Complete Finds shallowest goal may be optimal, may not Open list can be quite large O(b^d+1) space complexity Time is equally slow – O(b^d+1) time complexity

7 Depth First Search Not Complete – May get stuck on an infinite path Not Optimal – Unclear where the goal will be found Open list is relatively restricted O(b^m) space complexity Time is slow, perhaps slower than BFS O(b^m) time complexity

8 Uniform Cost Search Complete – Will find a solution if it exists at finite depth Optimal – Expansion order guarantees optimal solution Complexity difficult to pin down, O (b c/m)

9 Iterative Deepening Search Complete? Yes Optimal? Yes, if step cost = 1 db + (d-1)b^2 + (d-2)b^3 + … + (1)b^d BFS: b + b^2 + b^3 + … + b^d + b^d+1 – b

10 Bidirectional Search  Requires an explicit goal state  Simultaneously search forward from initial state and backwards from the goal state until the two meet  Concatenate the path from initial state to the inverse of the path from the goal state to form a complete solution  Use two queues to implement- for the halves Guarantees optimal solution Time complexity is O (b d/2 ) since the search only proceeds to half solution depth. Space complexity is also O (b d/2 ) as at least one of the searches has to be breadth first to find a common state

11 Bi-Directional Search Complete – If we use breadth first from both directions Optimal – With same caveats as breadth first Complexity better than breadth first, O(b^d/2) space complexity Time is also better – O(b^d/2) time complexity


Download ppt "Implementation and Evaluation of Search Methods. Use a stack data structure. 1. Push root node of tree on the stack. 2. Pop the top node off the stack."

Similar presentations


Ads by Google