1 / 15

Implementation of Search Algorithms

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 if queue is empty, then return failure node  Remove-Front( queue )

liza
Download Presentation

Implementation of Search Algorithms

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. 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

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

  3. Combinatorial explosion com·bi·na·to·ri·al • 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 statesis easily solved by brute-force search • Fifteen puzzle contains 1013 states and cannot be solved by brute-force techniques on current machines Search

  4. Search

  5. 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 evaluation 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

  6. 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

  7. 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

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

  9. 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

  10. Romania with step costs in km Search

  11. Greedy best-first search Search

  12. Greedy best-first search Search

  13. Greedy best-first search Search

  14. Greedy best-first search Search

  15. 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