Presentation is loading. Please wait.

Presentation is loading. Please wait.

ICS-171:Notes 4: 1 Notes 4: Optimal Search ICS 171 Summer 1999.

Similar presentations


Presentation on theme: "ICS-171:Notes 4: 1 Notes 4: Optimal Search ICS 171 Summer 1999."— Presentation transcript:

1 ICS-171:Notes 4: 1 Notes 4: Optimal Search ICS 171 Summer 1999

2 ICS-171:Notes 4: 2 Summary Optimal search strategies – path costs examples –now we want to search for the minimum cost path to goal G –optimality –exhaustive search –uniform-cost search

3 ICS-171:Notes 4: 3 Searching for the Minimum Cost Path Previously we only cared about finding a path to any goal G Now we want the minimum cost path to a goal G –Cost of a path = sum of individual transitions along path –“best” = minimum cost path –Note: 2 different types of cost 1. cost of traversing the path to goal (“path-cost”/online cost) –cost from start S to node –cost from node to goal G 2.. the space and time complexity of the search algorithm (“search-cost”/offline cost) –Path-cost = sum of individual node-to-node costs individual costs assumed positive –otherwise an algorithm could “cycle” forever adding loops

4 ICS-171:Notes 4: 4 Examples of Path-Cost Navigation – path-cost = distance to node in miles OR the time to travel on foot or by car OR number of cities visited - ALL DIFFERENT minimum => minimum time, least fuel VLSI Design –path-cost = length of wires between chips minimum => least clock/signal delay 8-Puzzle –path-cost = number of pieces moved minimum => least time to solve the puzzle

5 ICS-171:Notes 4: 5 Example of Path Costs S G A B D E C F 2 1 2 5 4 2 4 3 5 Optimal (minimum cost) path is S-A-D-E-F-G

6 ICS-171:Notes 4: 6 Completeness and Optimality A search procedure is complete if –it is guaranteed to find a goal state, if one exists e.g., DFS is not complete in general (if repeated states exist) but BFS is complete A search procedure is optimal if –it is guaranteed to find the minimum cost path, if multiple paths to a goal state exist e.g., DFS and BFS are not optimal Note that optimal => complete, but not vice-versa

7 ICS-171:Notes 4: 7 Search Method 6: Exhaustive Search Basic idea –find all possible paths to goal states –choose the best one (best = minimum path-cost) For example, –use BFS, modified so that it continues until all goal states are found but BFS scales as O(b d )! Conclusion –it is certainly complete and optimal –but exhaustive search is impractical except for very small problems

8 ICS-171:Notes 4: 8 The Shortest Path Principle We are searching for the minimum cost path to G Suppose the minimum (optimal) path to a goal state G has cost c Shortest Path Principle: –we can ignore any open nodes in the search tree which have path- costs greater than or equal to c why ? because we already have a solution with path-cost c, and expanding these nodes can only increase their costs further –but, we must still explore all other open nodes with path-cost <c why? they could produce a path to goal with path-cost < c We can do this simply by ordering nodes in Q according to path- cost to each node

9 ICS-171:Notes 4: 9 Search Method 7: Uniform Cost Search Initialize: Let Q = {S} While Q is not empty pull Q1, the first element in Q if Q1 is a goal report(success) and quit else child_nodes = expand(Q1) put remaining child_nodes in Q sort Q according to path-cost to each node end Continue Uniform Cost Search orders the nodes on the Q according to path cost from S always expands the node with minimum path cost from S

10 ICS-171:Notes 4: 10 Example of Uniform Cost in action S A D 2 5

11 ICS-171:Notes 4: 11 Example of Uniform Cost in action S A D B D C E E B F G 2 5 3 8 4 6 11 1010 1313 7 D 10 F 1414 E B F G 7 12 11 1414 1414 C 15

12 ICS-171:Notes 4: 12 Properties of Uniform Cost Search Complete? –yes Optimal? –assume that all costs are greater than 0 –when we go to expand a node, we test for goal state if it is a goal state then, it is selected (say with path cost c) if selected, is this path the lowest cost path to a goal? –all other currently open paths have higher cost (by definition) –since all costs >0, all of them must have path costs >c (to goal) – => the selected path is the optimal one –this is basically Dijkstra’s algorithm (ICS 161) applied to search trees Complexity? –worst O(b^d) in both space and time –in practice, run out of space usually before you run out of time

13 ICS-171:Notes 4: 13 Summary Path Cost –in practice we often want the best path to a goal state, e.g., the minimum cost path Optimality –a search algorithm which is guaranteed to find the best path to goal Uniform Cost Search –this is optimal –but it can have exponential complexity (especially memory) in practice Reading: Chapter 3, page 70 to 82 All of the search techniques so far are “blind” in that they do not look at how far away the goal may be: next we will look at informed or heuristic search, which directly tries to minimize the distance to the goal.


Download ppt "ICS-171:Notes 4: 1 Notes 4: Optimal Search ICS 171 Summer 1999."

Similar presentations


Ads by Google