Download presentation
Presentation is loading. Please wait.
Published byThomasina Townsend Modified over 9 years ago
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
3 Breadth-first search Expand shallowest unexpanded node Implementation: o Frontier is a FIFO queue, i.e., new successors go at end
4
4 Breadth-first search Expand shallowest unexpanded node Implementation: o Frontier is a FIFO queue, i.e., new successors go at end
5
5 Breadth-first search Expand shallowest unexpanded node Implementation: o Frontier is a FIFO queue, i.e., new successors go at end
6
6 Breadth-first search Expand shallowest unexpanded node Implementation: o Frontier is a FIFO queue, i.e., new successors go at end
7
7 Properties of breadth-first search Complete? Yes (if b is finite) Time? 1+b+b 2 +b 3 +… +b d = O(b d ) Space? O(b d ) (O(b d-1 ) nodes in the explored set and O(b d ) nodes in the frontier) Optimal? Yes (if cost = 1 per step)
8
Properties of breadth-first search O(b d ) is scary. Assuming b=10 Space is the bigger problem (more than time) DepthNodesTimeMemory 10 3 hours10 terabytes 1210 12 13 days1 petabyte 1410 14 3.5 years99 petabytes 1610 16 350 years10 exabytes
9
9 Uniform-cost search Expand least-cost unexpanded node (Cheapest search) Implementation: o Frontier = queue ordered by path cost
10
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(b ceiling(C*/ ε) ) where C * is the cost of the optimal solution Space? # of nodes with g ≤ cost of optimal solution, O(b ceiling(C*/ ε) ) Optimal? Yes – nodes expanded in increasing order of g(n)
12
12 Depth-first search Expand deepest unexpanded node Implementation: o Frontier = LIFO queue, i.e., put successors at front
13
13 Depth-first search Expand deepest unexpanded node Implementation: o Frontier = LIFO queue, i.e., put successors at front
14
14 Depth-first search Expand deepest unexpanded node Implementation: o Frontier = LIFO queue, i.e., put successors at front
15
15 Depth-first search Expand deepest unexpanded node Implementation: o Frontier = LIFO queue, i.e., put successors at front
16
16 Depth-first search Expand deepest unexpanded node Implementation: o Frontier = LIFO queue, i.e., put successors at front
17
17 Depth-first search Expand deepest unexpanded node Implementation: o Frontier = LIFO queue, i.e., put successors at front
18
18 Depth-first search Expand deepest unexpanded node Implementation: o Frontier = LIFO queue, i.e., put successors at front
19
19 Depth-first search Expand deepest unexpanded node Implementation: o Frontier = LIFO queue, i.e., put successors at front
20
20 Depth-first search Expand deepest unexpanded node Implementation: o Frontier = LIFO queue, i.e., put successors at front
21
21 Depth-first search Expand deepest unexpanded node Implementation: o Frontier = LIFO queue, i.e., put successors at front
22
22 Depth-first search Expand deepest unexpanded node Implementation: o fringe = LIFO queue, i.e., put successors at front
23
23 Depth-first search Expand deepest unexpanded node Implementation: o Frontier = LIFO queue, i.e., put successors at front
24
24 Properties of depth-first search Complete? No: fails in infinite-depth spaces, spaces with loops o Modify to avoid repeated states along path complete in finite spaces Time? O(b m ): terrible if m is much larger than d o 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
27 Iterative deepening search l =0
28
28 Iterative deepening search l =1
29
29 Iterative deepening search l =2
30
30 Iterative deepening search l =3
31
31 Properties of iterative deepening search Complete? Yes Time? d b 1 + (d-1)b 2 + … + (1)b d = O(b d ) Space? O(bd) Optimal? Yes
32
32 Summary of algorithms
33
Informed Search Strategies uses problem-specific knowledge beyond the definition of the problem itself
35
Best-first search Idea: use an evaluation function f(n) for each node o estimate of "desirability" Expand most desirable unexpanded node Implementation: Order the nodes in frontier in decreasing order of desirability Special cases: o greedy best-first search o A * search
36
Romania with step costs in km
37
Greedy best-first search Evaluation function f(n) = h(n) (heuristic) = estimate of cost from n to goal e.g., h SLD (n) = straight-line distance from n to Bucharest Greedy best-first search expands the node that appears to be closest to goal
38
Greedy best-first search example
42
Properties of greedy best- first search Complete? No – can get stuck in loops, e.g., Iasi Neamt Iasi Neamt Time? O(b m ) Space? O(b m ) -- keeps all nodes in memory Optimal? No
43
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
44
Romania with step costs in km
45
A * search example
51
Admissible heuristics A heuristic h(n) is admissible if for every node n, h(n) ≤ h * (n), where h * (n) is the true cost to reach the goal state from n. An admissible heuristic never overestimates the cost to reach the goal, i.e., it is optimistic Example: h SLD (n) (never overestimates the actual road distance)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.