1 / 68

Problem Solving and Search in AI Part II

Problem Solving and Search in AI Part II. Search Strategies. Uninformed (blind, exhaustive) strategies use only the information available in the problem definition Breadth-first search Depth-first search Uniform-cost search

Télécharger la présentation

Problem Solving and Search in AI Part II

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. Problem Solving and Search in AI Part II

  2. Search Strategies • Uninformed (blind, exhaustive) strategies use only the information available in the problem definition • Breadth-first search • Depth-first search • Uniform-cost search • Heuristic strategies use “rules of thumb” based on the knowledge of domain to pick between alternatives at each step Graph Searching Applet: http://www.cs.ubc.ca/labs/lci/CIspace/Version4/search/index.html

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  33. Search Exercise Traffic Graph: Start Node: A Goal Node: M

  34. Exercise: Breadth-First A G B D L C E K H B E F I D O I I J M • Order of node expansion: A, B, D, G, C, E, K, L, B, E, F, I, O, D, H, I, I, J, M Solution Found: A  D  E  I  M (optimal)

  35. Exercise: Breadth-First(with duplicate detection) A G B D L C E K F I O H J M • Order of node expansion: A, B, D, G, C, E, K, L, F, I, O, H, J, M

  36. Exercise : Depth-First A G B D C E B E F I M • Order of node expansion: A, B, D, C, B, E, I, M Solution Found: A  D  C  E  I  M (not optimal)

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

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

  39. Example: 8-Puzzle – Depth First Search

  40. Example: 8-Puzzle – Depth First Search

  41. Example: 8-Puzzle – Depth First Search

  42. Example: 8-Puzzle – Depth First Search

  43. Example: 8-Puzzle – Depth First Search

  44. Example: 8-Puzzle – Depth First Search

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

  46. A 1 10 S B G 5 5 C 15 5 C 15 G G 10 11 Uniform-Cost Search • Each move has some cost • The cost of the path to each node N is g(N) = sum of the move costs • The goal is to generate a solution path of minimal cost • The queue is sorted in increasing cost order • So, lower cost nodes go to the front S 0 1 A B 5

  47. Uniform-Cost Search

  48. Uniform-Cost Search • Always expand the least-cost unexpanded node • Queue = insert in order of increasing path cost Arad 75 118 140 Zerind Sibiu Timisoara <== Zerind, Timisoara, Sibiu <==

  49. Uniform-Cost Search Arad 75 118 140 Zerind Sibiu Timisoara 71+75 75+75 Arad Oradea <== Timisoara, Sibiu, Oradea, Arad <==

  50. Uniform-Cost Search Arad 75 118 140 Zerind Sibiu Timisoara 75+75 118+118 71+75 111+118 Arad Arad Oradea Lugoi <== Sibiu, Oradea, Arad, Lugoi, Arad <==

More Related