1 / 23

Uniform-Cost Search

Uniform-Cost Search. Edges have different costs Instead of expanding nodes in order of their depth from root expand in order of cost from root At each step, expand a node whose cost g(n) is lowest where g(n) is sum of costs of edges from root to node n Nodes are stored in a priority queue

clodia
Download Presentation

Uniform-Cost Search

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. Uniform-Cost Search • Edges have different costs • Instead of expanding nodes in order of their depth from root expand in order of cost from root • At each step, expand a node whose cost g(n) is lowest where g(n) is sum of costs of edges from root to node n • Nodes are stored in a priority queue • Worst case time complexity: • O (bc/m)where c is the cost of an optimal solution and m is the minimum edge cost Problem: Memory- similar to breadth first Search

  2. A Z75T118S140 T118S140O146 S140O146L229 O146L229R230 F239O291 L229R230F239O291 R230 F239O291M299 Search

  3. Depth-First Search • Remedies space limitation of breadth first by always generating a child of the deepest unexpanded node. Search

  4. Implementation • Maintain a list of unexpanded nodes treated as a LIFO stack (as opposed to FIFO for breadth first) • Usually implemented recursively- with the recursion stack taking the place of an explicit node stack • Time complexity is O (bd)-Practically DF is time limited and BF is space limited • Disadvantage: does not terminate if tree infinite or cycles in graph • Solution: cutoff depth (d) • d small? • d large? Search

  5. Depth First Iterative Deepening Combines best features of DF and BF Successive depth-first searches are conducted – each with depth bounds increasing by 1 Performs a depth first to depth 1 then starts over executing a complete depth first to depth 2 and continues to run depth first searches to successive greater depths until a solution is found. Search Optimal in terms of time and space (O(bd))among all brute force algorithms on a tree.

  6. Search

  7. Iterative deepening search L =3 Search

  8. Iterative Deepening Search • Complete? Yes • Optimal? Yes, if step cost = 1 Search

  9. 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 (bd/2) since the search only proceeds to half solution depth. Space complexity is also O (bd/2)as at least one of the searches has to be breadth first to find a common state Search

  10. Exponential Growth Time and memory requirements for breadth-first search, assuming a branching factor of 10, 100 bytes per node and searching 1000 nodes/second Search

  11. Combinatorial explosion • The problem with brute–force search algorithms is that their time complexity grows with problem size- combinatorial explosion • The size of the problems that can be solved with these methods is limited • Eight puzzle with 105 is easily solved by brute- force search • Fifteen puzzle contains 1013 states and cannot be solved by brute-force techniques on current machines Search

  12. Implementation of Search Algorithms Function GENERAL-SEARCH (problem, queing-fn) returns a solution or failure queue MAKE-QUEUE (MAKE-NODE(INITIAL-STATE[problem])) loop do ifqueueis empty, then return failure node Remove-Front(queue) if GOAL-TEST [problem] applied to STATE(node) succeeds then return node else queueQUEING-FN(queue,EXPAND(node,operators[problem])) end Search

  13. Heuristic Search To solve larger problems we need to add domain specific knowledge to improve efficiency Heuristic General: Any advice that is often effective but not guaranteed to work in every case. Heuristics are only approximately correct. Their purpose is to minimize search on average. Technical AI: Heuristic evaluation function used- h(n) cost estimate from node n to goal In a single agent path finding problem a heuristic function estimates the cost of an optimal path between a pair of states- example: Euclidean or airline distance is an estimate of distance between two cities. In the tiles problem it may be the number of moves needed to put a tile in its goal position Properties of valuation function: gives an estimate not actual cost inexpensive to compute more natural to be a lower bound on actual cost- referred to as admissibility- guarantees finding the optimal solution first, Monotonicity along the path from root the cost never decreases Search

  14. estimate of total cost along path through n estimate of cost to reach goal from n actual cost to reach n Best-First Search When nodes are ordered so that the one with the best evaluation is expanded first the resulting search strategy is called best first search. • An algorithm is a best-first search algorithm if it aims at minimizing the total cost of a path from start to goal. f(n) = g(n) + h(n) Search

  15. estimate of cost to reach goal from n- straight line distance to a city actual (unknown) cost to reach goal from n- highway distance • A heuristic is (globally) optimistic or admissible if the estimated cost of reaching a goal is always less than the actual cost. h(n) ≤ h*(n) • A heuristic is monotonic(locally optimistic) if the estimated cost of reaching any node is always less than the actual cost. h(n1)–h(n2)≤ h*(n1)–h*(n2) Search

  16. 8-puzzle: Manhattan distance • Sydney to Melb.: straight-line distance • Chess: Weighted sum of chessmen values Search

  17. Greedy best-first search • Evaluation function f(n) = h(n)(heuristic) = estimate of cost from n to goal • hSLD(n)= straight-line distance from n to goal • Greedy best-first search expands the node thatappearsto be closest to goal Search

  18. Romania with step costs in km Search

  19. Greedy best-first search Search

  20. Greedy best-first search Search

  21. Greedy best-first search Search

  22. Greedy best-first search Search

  23. greedy best-first search • Complete?No – loops • Time?O(bm)- a good heuristic can make great improvement • Space?O(bm)- keeps all nodes in memory • Optimal? No Search

More Related