1 / 51

Search Strategies

Search Strategies. CPS4801. Uninformed Search Strategies. Uninformed search strategies use only the information available in the problem definition Breadth-first search Uniform-cost search Depth-first search Depth-limited search Iterative deepening search. Breadth-first search.

tejana
Download Presentation

Search Strategies

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Search Strategies CPS4801

  2. Uninformed Search Strategies • Uninformed search strategies use only the information available in the problem definition • Breadth-first search Uniform-cost search Depth-first search • Depth-limited search Iterative deepening search

  3. Breadth-first search • Expand shallowest unexpanded node Implementation: • Frontieris a FIFO queue, i.e., new successors go at end

  4. Breadth-first search • Expand shallowest unexpanded node Implementation: • Frontieris a FIFO queue, i.e., new successors go at end

  5. Breadth-first search • Expand shallowest unexpanded node Implementation: • Frontieris a FIFO queue, i.e., new successors go at end

  6. Breadth-first search • Expand shallowest unexpanded node Implementation: • Frontieris a FIFO queue, i.e., new successors go at end

  7. Properties of breadth-first search • Complete?Yes (if b is finite) • Time?1+b+b2+b3+… +bd= O(bd) • Space?O(bd) (O(bd-1) nodes in the explored set and O(bd) nodes in the frontier) • Optimal? Yes (if cost = 1 per step)

  8. Properties of breadth-first search • O(bd) is scary. • Assuming b=10 • Spaceis the bigger problem (more than time)

  9. Uniform-cost search • Expand least-cost unexpanded node • (Cheapest search)Implementation: • Frontier = queue ordered by path cost

  10. Example: Romania

  11. Properties of uniform-cost search • Equivalent to breadth-first if step costs all equal • Complete? Yes, if step cost ≥ εTime? # of nodes with g ≤ cost of optimal solution, O(bceiling(C*/ ε)) where C* is the cost of the optimal solution • Space? # of nodes with g≤ cost of optimal solution, O(bceiling(C*/ ε))Optimal? Yes – nodes expanded in increasing order of g(n)

  12. Depth-first search • Expand deepest unexpanded node Implementation: • Frontier= LIFO queue, i.e., put successors at front

  13. Depth-first search • Expand deepest unexpanded node Implementation: • Frontier= LIFO queue, i.e., put successors at front

  14. Depth-first search • Expand deepest unexpanded node Implementation: • Frontier= LIFO queue, i.e., put successors at front

  15. Depth-first search • Expand deepest unexpanded node Implementation: • Frontier= LIFO queue, i.e., put successors at front

  16. Depth-first search • Expand deepest unexpanded node Implementation: • Frontier= LIFO queue, i.e., put successors at front

  17. Depth-first search • Expand deepest unexpanded node Implementation: • Frontier= LIFO queue, i.e., put successors at front

  18. Depth-first search • Expand deepest unexpanded node Implementation: • Frontier= LIFO queue, i.e., put successors at front

  19. Depth-first search • Expand deepest unexpanded node Implementation: • Frontier= LIFO queue, i.e., put successors at front

  20. Depth-first search • Expand deepest unexpanded node Implementation: • Frontier= LIFO queue, i.e., put successors at front

  21. Depth-first search • Expand deepest unexpanded node Implementation: • Frontier= LIFO queue, i.e., put successors at front

  22. Depth-first search • Expand deepest unexpanded node Implementation: • fringe = LIFO queue, i.e., put successors at front

  23. Depth-first search • Expand deepest unexpanded node Implementation: • Frontier= LIFO queue, i.e., put successors at front

  24. Properties of depth-first search • Complete? No: fails in infinite-depth spaces, spaces with loops • Modify to avoid repeated states along path  complete in finite spaces • Time?O(bm): terrible if m is much larger than d • but if solutions are dense, may be much faster than breadth-first • Space?O(bm), i.e., linear space! • Optimal? No

  25. Depth-limited search • depth-first search with depth limit l, • i.e., nodes at depth l have no successors • 20 cities in map of Romania • l =19 • Any city can be reached from any other city in at most 9 steps. • Diameter gives a better depth limit.

  26. Iterative deepening search • Gradually increases the limit – 0, 1, 2, … • Combines the benefits of depth-first and breadth-first search.

  27. Iterative deepening search l =0

  28. Iterative deepening search l =1

  29. Iterative deepening search l =2

  30. Iterative deepening search l =3

  31. Properties of iterative deepening search • Complete? Yes • Time?d b1 + (d-1)b2 + … + (1)bd= O(bd) • Space?O(bd) • Optimal?Yes

  32. Summary of algorithms

  33. Informed Search Strategies • uses problem-specific knowledge beyond the definition of the problem itself

  34. Best-first search • Idea: use an evaluation functionf(n) for each node • estimate of "desirability" • Expand most desirable unexpanded node • Implementation: Order the nodes in frontier in decreasing order of desirability • Special cases: • greedy best-first search • A*search

  35. Romania with step costs in km

  36. Greedy best-first search • Evaluation function f(n) = h(n) (heuristic) • = estimate of cost from n to goal • e.g., hSLD(n) = straight-line distance from n to Bucharest • Greedy best-first search expands the node that appears to be closest to goal

  37. Greedy best-first search example

  38. Greedy best-first search example

  39. Greedy best-first search example

  40. Greedy best-first search example

  41. Properties of greedy best-first search • Complete? No – can get stuck in loops, e.g., Iasi Neamt Iasi Neamt • Time?O(bm) • Space?O(bm) -- keeps all nodes in memory • Optimal? No

  42. A* search • Idea: avoid expanding paths that are already expensive • Evaluation function f(n) = g(n) + h(n) • g(n) = cost so far to reach n • h(n) = estimated cost from n to goal • f(n) = estimated total cost of path through n to goal

  43. Romania with step costs in km

  44. A* search example

  45. A* search example

  46. A* search example

  47. A* search example

  48. A* search example

  49. A* search example

More Related