cs 730 830 intro ai
play

CS 730/830: Intro AI 1 handout: slides Search Basic Algorithms A - PowerPoint PPT Presentation

CS 730/830: Intro AI 1 handout: slides Search Basic Algorithms A Clever Algorithm EOLQs Wheeler Ruml (UNH) Lecture 2, CS 730 1 / 25 EOLQs Search Basic Algorithms A Clever Algorithm EOLQs Wheeler Ruml (UNH) Lecture 2, CS 730 2 /


  1. CS 730/830: Intro AI 1 handout: slides Search Basic Algorithms A Clever Algorithm EOLQs Wheeler Ruml (UNH) Lecture 2, CS 730 – 1 / 25

  2. EOLQs Search Basic Algorithms A Clever Algorithm EOLQs Wheeler Ruml (UNH) Lecture 2, CS 730 – 2 / 25

  3. Search ■ Contents ■ Cognitive Science ■ Problem Solving ■ Representation Basic Algorithms A Clever Algorithm EOLQs Search Wheeler Ruml (UNH) Lecture 2, CS 730 – 3 / 25

  4. Contents This particular pattern of molecules known as a ’human being’ Search has evolved an amazing depth of consciousness: an ability to ■ Contents ■ Cognitive Science internally model the reality beyond the senses, to imagine futures ■ Problem Solving ■ Representation that have never happened, to use language, to use rationality to Basic Algorithms build and test theories about our universe, to become self-aware. A Clever Algorithm —Jeff Lieberman (artist, roboticist) EOLQs Wheeler Ruml (UNH) Lecture 2, CS 730 – 4 / 25

  5. Cognitive Science The ability to think is perhpas the most distinctive of human Search capacities. Typically, thinking involves mentally representing ■ Contents ■ Cognitive Science some aspects of the world (including aspects of ourselves) and ■ Problem Solving ■ Representation manipulating these representations or beliefs so as to yield new Basic Algorithms beliefs, where the latter may aid in accomplishing a goal. A Clever Algorithm —Edward E. Smith (Psychology, U Michigan) EOLQs The ability to solve problems is one of the most important manifestations of human thinking. ... We might therefore syspect that problem solving depends on general cognitive abilities that can potentially be applied to an essentially unlimited range of domains. —Keith Holyoak (Psychology, UCLA) Wheeler Ruml (UNH) Lecture 2, CS 730 – 5 / 25

  6. Formalizing Problem Solving State: hypothetical world state Search Operators: actions that modify world ■ Contents ■ Cognitive Science Goal: desired state or test ■ Problem Solving ■ Representation Basic Algorithms A Clever Algorithm EOLQs (Herbert Simon and Allen Newell, “Computer simulation of human thinking and problem solving”, 1961) Wheeler Ruml (UNH) Lecture 2, CS 730 – 6 / 25

  7. Representation VW search space Search VW state space ■ Contents ■ Cognitive Science MC representation ■ Problem Solving ■ Representation Basic Algorithms A Clever Algorithm EOLQs Wheeler Ruml (UNH) Lecture 2, CS 730 – 7 / 25

  8. Search Basic Algorithms ■ Alg 1 ■ Alg 2 ■ Uniform-cost ■ Graphs ■ Comparison ■ Time vs space ■ Both? Basic Algorithms ■ Break A Clever Algorithm EOLQs Wheeler Ruml (UNH) Lecture 2, CS 730 – 8 / 25

  9. -First Search open ← an ordered list containing just the initial state. Search Basic Algorithms Loop ■ Alg 1 If open is empty, ■ Alg 2 ■ Uniform-cost then return failure. ■ Graphs Node ← Pop(open). ■ Comparison ■ Time vs space If Node is a goal, ■ Both? ■ Break then return Node (or path to it). A Clever Algorithm else EOLQs Children ← Expand ( Node ). Add Children to front of open. Wheeler Ruml (UNH) Lecture 2, CS 730 – 9 / 25

  10. Evaluating DFS Assume branching factor b and solution at depth d . Search Basic Algorithms Completeness: ■ Alg 1 ■ Alg 2 Time: ■ Uniform-cost ■ Graphs Space: ■ Comparison Admissibility: ■ Time vs space ■ Both? ■ Break A Clever Algorithm EOLQs Wheeler Ruml (UNH) Lecture 2, CS 730 – 10 / 25

  11. Breadth-First Search open ← an ordered list containing just the initial state. Search Basic Algorithms Loop ■ Alg 1 If open is empty, ■ Alg 2 ■ Uniform-cost then return failure. ■ Graphs Node ← Pop(open). ■ Comparison ■ Time vs space If Node is a goal, ■ Both? ■ Break then return Node (or path to it). A Clever Algorithm else EOLQs Children ← Expand ( Node ). Add Children to end of open. ← Wheeler Ruml (UNH) Lecture 2, CS 730 – 11 / 25

  12. Evaluating BrFS Assume branching factor b and solution at depth d . Search Basic Algorithms Completeness: ■ Alg 1 ■ Alg 2 Time: ■ Uniform-cost ■ Graphs Space: ■ Comparison Admissibility: ■ Time vs space ■ Both? ■ Break A Clever Algorithm EOLQs Wheeler Ruml (UNH) Lecture 2, CS 730 – 12 / 25

  13. Uniform-Cost Search open ← an ordered list containing just the initial state. Search Basic Algorithms Loop ■ Alg 1 If open is empty, ■ Alg 2 ■ Uniform-cost then return failure. ■ Graphs Node ← Pop(open). ■ Comparison ■ Time vs space If Node is a goal, ■ Both? ■ Break then return Node (or path to it). A Clever Algorithm else EOLQs Children ← Expand ( Node ). Merge Children into open, keeping sorted by path cost. ← Wheeler Ruml (UNH) Lecture 2, CS 730 – 13 / 25

  14. Dealing with Graphs 1. Check for cycles with ancestors Search 2. Maintain closed list (hash table) to detect duplicates Basic Algorithms ■ Alg 1 ■ Alg 2 ■ Uniform-cost ■ Graphs ■ Comparison ■ Time vs space ■ Both? ■ Break A Clever Algorithm EOLQs Wheeler Ruml (UNH) Lecture 2, CS 730 – 14 / 25

  15. Comparison Algorithm Time Space Complete Admissible Search b m Depth-first If m ≥ d No bm Basic Algorithms ■ Alg 1 b d b d Breadth-first Yes If ops cost 1 ■ Alg 2 b d b d Uniform-cost Yes Yes ■ Uniform-cost ■ Graphs ■ Comparison ■ Time vs space branching factor b ■ Both? ■ Break maximum depth m A Clever Algorithm solution depth d EOLQs Wheeler Ruml (UNH) Lecture 2, CS 730 – 15 / 25

  16. Time and Space for BrFS/UCS Assume b = 10 ; 100,000 nodes/sec; 100 bytes/node. Search Sol. depth Nodes Time Space Basic Algorithms ■ Alg 1 1 11 .11 msec 1.1 Kb ■ Alg 2 2 111 1.1 msec 11 Kb ■ Uniform-cost ■ Graphs 4 11,111 .11 sec 1 Mb ■ Comparison 10 6 6 11 sec 111 Mb ■ Time vs space ■ Both? 10 8 8 18 min 11 Gb ■ Break 10 10 10 31 hours 1 Tb A Clever Algorithm 10 12 12 128 days 111 Tb EOLQs 10 14 14 35 yrs 11 Pb Wheeler Ruml (UNH) Lecture 2, CS 730 – 16 / 25

  17. Search Conundrum Breadth-first uses b d space Search but complete and admissible Basic Algorithms ■ Alg 1 Depth-first complete only if limit > d , not admissible ■ Alg 2 but bd space ■ Uniform-cost ■ Graphs ■ Comparison ■ Time vs space ■ Both? ■ Break How can we get the best of both? A Clever Algorithm EOLQs Wheeler Ruml (UNH) Lecture 2, CS 730 – 17 / 25

  18. Break textbook ■ Search piazza ■ Basic Algorithms ■ Alg 1 asst 1 ■ ■ Alg 2 recitation ■ ■ Uniform-cost ■ Graphs ■ Comparison ■ Time vs space ■ Both? ■ Break A Clever Algorithm EOLQs Wheeler Ruml (UNH) Lecture 2, CS 730 – 18 / 25

  19. Search Basic Algorithms A Clever Algorithm ■ IDS ■ Evaluating IDS ■ IDS time EOLQs A Clever Algorithm Wheeler Ruml (UNH) Lecture 2, CS 730 – 19 / 25

  20. Iterative Deepening Search for d = 1 to ∞ do Search Basic Algorithms depth-first search to level d A Clever Algorithm if it succeeds ■ IDS then return solution ■ Evaluating IDS ■ IDS time EOLQs Could this possibly be efficient? Wheeler Ruml (UNH) Lecture 2, CS 730 – 20 / 25

  21. Evaluating IDS Assume branching factor b and solution at depth d . Search Basic Algorithms Completeness: A Clever Algorithm ■ IDS Time: ■ Evaluating IDS Space: ■ IDS time Admissibility: EOLQs Wheeler Ruml (UNH) Lecture 2, CS 730 – 21 / 25

  22. Nodes Generated by IDS b = 2 Search at d in prev. total IDS % of opt. d Basic Algorithms 0 1 0 1 1 100.0 A Clever Algorithm ■ IDS 1 2 1 3 4 133.3 ■ Evaluating IDS ■ IDS time 2 4 3 7 11 157.1 EOLQs 4 16 15 31 57 183.9 b = 10 at d in prev. total IDS % of opt. d 0 1 0 1 1 100.0 1 10 1 11 12 109.1 2 100 11 111 123 110.8 4 10000 1111 11,111 12,345 111.1 Wheeler Ruml (UNH) Lecture 2, CS 730 – 22 / 25

  23. Nodes Generated by IDS Search b d + 2 b d − 1 + 3 b d − 2 + ... + ( d − 1) b 2 + db Basic Algorithms A Clever Algorithm ■ IDS ■ Evaluating IDS b ≈ b d ( b − 1) 2 ■ IDS time EOLQs Wheeler Ruml (UNH) Lecture 2, CS 730 – 23 / 25

  24. Search Basic Algorithms A Clever Algorithm EOLQs ■ EOLQs EOLQs Wheeler Ruml (UNH) Lecture 2, CS 730 – 24 / 25

  25. EOLQs Please write down the most pressing question you have about Search the course material covered so far and put it in the box on your Basic Algorithms way out. A Clever Algorithm Thanks! EOLQs ■ EOLQs Wheeler Ruml (UNH) Lecture 2, CS 730 – 25 / 25

Recommend


More recommend