1 / 39

Basic Search Procedure

Basic Search Procedure. 1. Start with the start node (root of the search tree) and place in on the queue 2. Remove the front node in the queue and If the node is a goal node , then we are done; stop.

willardm
Download Presentation

Basic Search Procedure

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. Basic Search Procedure • 1. Start with the start node (root of the search tree) and place in on the queue • 2. Remove the front node in the queue and • If the node is a goal node, then we are done; stop. • Otherwise expand the node  generate its children using the successor function (other states that can be reached with one move) • 3. Place the children on the queue according to the search strategy • 4. Go back to step 2.

  2. Search Strategies • Search strategies differ based on the order in which new successor nodes are added to the queue • Breadth-first  add nodes to the end of the queue • Depth-first  add nodes to the front • Uniform cost  sort the nodes on the queue based on the cost of reaching the node from start node

  3. Breadth-First Searchadd nodes to the end of the queue

  4. Breadth-First Search A B I E C D M K F H N O G Q R T goal P S Queue:  A

  5. Breadth-First Search A B I E C D M K F H N O G Q R T goal P S Queue:  B I E

  6. Breadth-First Search A B I E C D M K F H N O G Q R T goal P S Queue:  I E C D

  7. Breadth-First Search A B I E C D M K F H N O G Q R T goal P S Queue:  E C D M K

  8. Breadth-First Search A B I E C D M K F H N O G Q R T goal P S Queue:  C D M K F H

  9. Breadth-First Search A B I E C D M K F H N O G Q R T goal P S Queue:  D M K F H N

  10. Breadth-First Search A B I E C D M K F H N O G Q R T goal P S Queue:  M K F H N

  11. Breadth-First Search A B I E C D M K F H N O G Q R T goal P S Queue:  K F H N O G

  12. Breadth-First Search A B I E C D M K F H N O G Q R T goal P S Queue:  F H N O G

  13. Breadth-First Search A B I E C D M K F H N O G Q R T goal P S Queue:  H N O G Q

  14. Breadth-First Search A B I E C D M K F H N O G Q R T goal P S Queue:  N O G Q R T

  15. Breadth-First Search A B I E C D M K F H N O G Q R T goal P S Queue:  O G Q R T P S

  16. Breadth-First Search A B I E C D M K F H N O G Q R T goal P S Queue:  G Q R T P S

  17. Breadth-First Search A B I E C D M K F H N O G Q R T goal P S DONE!!! Solution: A  I  M  G Queue:  Q R T P S

  18. Depth-First Searchadd nodes to the front of the queue

  19. Breadth-First Search A B I E C D M K F H N O G Q R T goal P S Queue:  A

  20. Breadth-First Search A B I E C D M K F H N O G Q R T goal P S Queue:  B I E

  21. Breadth-First Search A B I E C D M K F H N O G Q R T goal P S Queue:  C D I E

  22. Breadth-First Search A B I E C D M K F H N O G Q R T goal P S Queue:  N D I E

  23. Breadth-First Search A B I E C D M K F H N O G Q R T goal P S Queue:  P S D I E

  24. Breadth-First Search A B I E C D M K F H N O G Q R T goal P S Queue:  S D I E

  25. Breadth-First Search A B I E C D M K F H N O G Q R T goal P S Queue:  D I E

  26. Breadth-First Search A B I E C D M K F H N O G Q R T goal P S Queue:  I E

  27. Breadth-First Search A B I E C D M K F H N O G Q R T goal P S Queue:  M K E

  28. Breadth-First Search A B I E C D M K F H N O G Q R T goal P S Queue:  O G K E

  29. Breadth-First Search A B I E C D M K F H N O G Q R T goal P S Queue:  G K E

  30. Breadth-First Search A B I E C D M K F H N O G Q R T goal P S DONE!!! Solution: A  I  M  G Queue:  K E

  31. Example: The 8-Puzzle • States? integer location of tiles • Operators? move blank left, right, up, down • Goal Test? = goal state (given) • Path Cost? One per move

  32. Example: 8-Puzzle – Depth First Search We will assume that we can do repeated state checking (i.e., we will not generate nodes that have been previously expanded)

  33. Example: 8-Puzzle – Depth First Search

  34. Example: 8-Puzzle – Depth First Search

  35. Example: 8-Puzzle – Depth First Search

  36. Example: 8-Puzzle – Depth First Search

  37. Example: 8-Puzzle – Depth First Search

  38. Example: 8-Puzzle – Depth First Search

  39. . . . Example: 8-Puzzle – Depth First Search

More Related