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

cs 730 830 intro ai
SMART_READER_LITE
LIVE PREVIEW

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 /


slide-1
SLIDE 1

CS 730/830: Intro AI

Search Basic Algorithms A Clever Algorithm EOLQs

Wheeler Ruml (UNH) Lecture 2, CS 730 – 1 / 25

1 handout: slides

slide-2
SLIDE 2

EOLQs

Search Basic Algorithms A Clever Algorithm EOLQs

Wheeler Ruml (UNH) Lecture 2, CS 730 – 2 / 25

slide-3
SLIDE 3

Search

Search ■ Contents ■ Cognitive Science ■ Problem Solving ■ Representation Basic Algorithms A Clever Algorithm EOLQs

Wheeler Ruml (UNH) Lecture 2, CS 730 – 3 / 25

slide-4
SLIDE 4

Contents

Search ■ Contents ■ Cognitive Science ■ Problem Solving ■ Representation Basic Algorithms A Clever Algorithm EOLQs

Wheeler Ruml (UNH) Lecture 2, CS 730 – 4 / 25

This particular pattern of molecules known as a ’human being’ has evolved an amazing depth of consciousness: an ability to internally model the reality beyond the senses, to imagine futures that have never happened, to use language, to use rationality to build and test theories about our universe, to become self-aware. —Jeff Lieberman (artist, roboticist)

slide-5
SLIDE 5

Cognitive Science

Search ■ Contents ■ Cognitive Science ■ Problem Solving ■ Representation Basic Algorithms A Clever Algorithm EOLQs

Wheeler Ruml (UNH) Lecture 2, CS 730 – 5 / 25

The ability to think is perhpas the most distinctive of human

  • capacities. Typically, thinking involves mentally representing

some aspects of the world (including aspects of ourselves) and manipulating these representations or beliefs so as to yield new beliefs, where the latter may aid in accomplishing a goal. —Edward E. Smith (Psychology, U Michigan) 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)

slide-6
SLIDE 6

Formalizing Problem Solving

Search ■ Contents ■ Cognitive Science ■ Problem Solving ■ Representation Basic Algorithms A Clever Algorithm EOLQs

Wheeler Ruml (UNH) Lecture 2, CS 730 – 6 / 25

State: hypothetical world state Operators: actions that modify world Goal: desired state or test (Herbert Simon and Allen Newell, “Computer simulation of human thinking and problem solving”, 1961)

slide-7
SLIDE 7

Representation

Search ■ Contents ■ Cognitive Science ■ Problem Solving ■ Representation Basic Algorithms A Clever Algorithm EOLQs

Wheeler Ruml (UNH) Lecture 2, CS 730 – 7 / 25

VW search space VW state space MC representation

slide-8
SLIDE 8

Basic Algorithms

Search 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 – 8 / 25

slide-9
SLIDE 9
  • First Search

Search 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 – 9 / 25

  • pen ← an ordered list containing just the initial state.

Loop If open is empty, then return failure. Node ← Pop(open). If Node is a goal, then return Node (or path to it). else Children ← Expand (Node). Add Children to front of open.

slide-10
SLIDE 10

Evaluating DFS

Search 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 – 10 / 25

Assume branching factor b and solution at depth d. Completeness: Time: Space: Admissibility:

slide-11
SLIDE 11

Breadth-First Search

Search 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 – 11 / 25

  • pen ← an ordered list containing just the initial state.

Loop If open is empty, then return failure. Node ← Pop(open). If Node is a goal, then return Node (or path to it). else Children ← Expand (Node). Add Children to end of open. ←

slide-12
SLIDE 12

Evaluating BrFS

Search 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 – 12 / 25

Assume branching factor b and solution at depth d. Completeness: Time: Space: Admissibility:

slide-13
SLIDE 13

Uniform-Cost Search

Search 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 – 13 / 25

  • pen ← an ordered list containing just the initial state.

Loop If open is empty, then return failure. Node ← Pop(open). If Node is a goal, then return Node (or path to it). else Children ← Expand (Node). Merge Children into open, keeping sorted by path cost. ←

slide-14
SLIDE 14

Dealing with Graphs

Search 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

1. Check for cycles with ancestors 2. Maintain closed list (hash table) to detect duplicates

slide-15
SLIDE 15

Comparison

Search 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 – 15 / 25

Algorithm Time Space Complete Admissible Depth-first bm bm If m ≥ d No Breadth-first bd bd Yes If ops cost 1 Uniform-cost bd bd Yes Yes branching factor b maximum depth m solution depth d

slide-16
SLIDE 16

Time and Space for BrFS/UCS

Search 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 – 16 / 25

Assume b = 10; 100,000 nodes/sec; 100 bytes/node.

  • Sol. depth

Nodes Time Space 1 11 .11 msec 1.1 Kb 2 111 1.1 msec 11 Kb 4 11,111 .11 sec 1 Mb 6 106 11 sec 111 Mb 8 108 18 min 11 Gb 10 1010 31 hours 1 Tb 12 1012 128 days 111 Tb 14 1014 35 yrs 11 Pb

slide-17
SLIDE 17

Search Conundrum

Search 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 – 17 / 25

Breadth-first uses bd space but complete and admissible Depth-first complete only if limit > d, not admissible but bd space How can we get the best of both?

slide-18
SLIDE 18

Break

Search 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 – 18 / 25

textbook

piazza

asst 1

recitation

slide-19
SLIDE 19

A Clever Algorithm

Search Basic Algorithms A Clever Algorithm ■ IDS ■ Evaluating IDS ■ IDS time EOLQs

Wheeler Ruml (UNH) Lecture 2, CS 730 – 19 / 25

slide-20
SLIDE 20

Iterative Deepening Search

Search Basic Algorithms A Clever Algorithm ■ IDS ■ Evaluating IDS ■ IDS time EOLQs

Wheeler Ruml (UNH) Lecture 2, CS 730 – 20 / 25

for d = 1 to ∞ do depth-first search to level d if it succeeds then return solution Could this possibly be efficient?

slide-21
SLIDE 21

Evaluating IDS

Search Basic Algorithms A Clever Algorithm ■ IDS ■ Evaluating IDS ■ IDS time EOLQs

Wheeler Ruml (UNH) Lecture 2, CS 730 – 21 / 25

Assume branching factor b and solution at depth d. Completeness: Time: Space: Admissibility:

slide-22
SLIDE 22

Nodes Generated by IDS

Search Basic Algorithms A Clever Algorithm ■ IDS ■ Evaluating IDS ■ IDS time EOLQs

Wheeler Ruml (UNH) Lecture 2, CS 730 – 22 / 25

b = 2 d at d in prev. total IDS % of opt. 1 1 1 100.0 1 2 1 3 4 133.3 2 4 3 7 11 157.1 4 16 15 31 57 183.9 b = 10 d at d in prev. total IDS % of opt. 1 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

slide-23
SLIDE 23

Nodes Generated by IDS

Search Basic Algorithms A Clever Algorithm ■ IDS ■ Evaluating IDS ■ IDS time EOLQs

Wheeler Ruml (UNH) Lecture 2, CS 730 – 23 / 25

bd + 2bd−1 + 3bd−2 + ... + (d − 1)b2 + db ≈ bd( b b − 1)2

slide-24
SLIDE 24

EOLQs

Search Basic Algorithms A Clever Algorithm EOLQs ■ EOLQs

Wheeler Ruml (UNH) Lecture 2, CS 730 – 24 / 25

slide-25
SLIDE 25

EOLQs

Search Basic Algorithms A Clever Algorithm EOLQs ■ EOLQs

Wheeler Ruml (UNH) Lecture 2, CS 730 – 25 / 25

Please write down the most pressing question you have about the course material covered so far and put it in the box on your way out. Thanks!