cs 380: artificial intelligence problem solving ...santi/teaching/2013/cs... · artificial...

54
CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 Santiago Ontañón [email protected] https://www.cs.drexel.edu/~santi/teaching/2013/CS380/intro.html

Upload: others

Post on 08-Sep-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH

10/2/2013 Santiago Ontañón [email protected] https://www.cs.drexel.edu/~santi/teaching/2013/CS380/intro.html

Page 2: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

• Problem Solving: •  Problem Formulation •  Finding a solution

Page 3: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Outline • Problems and Problem Solving • Example Problems • Solving Problems

Page 4: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Uninformed Search • Recall:

•  Initial state: initial configuration of the problem •  Actions: set of actions the agent can perform to solve the problem •  State space: set of possible states that are reachable form the

initial space by any sequence of actions

• Uninformed Search: •  Family of strategies to find solutions •  Based on systematically exploring the state space until finding a

sequence of actions that achieves the goal

Page 5: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Illustration 8 1

3 2 6

7 4 5

Initial state

Page 6: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Illustration 8 1

3 2 6

7 4 5

8 1

3 2 6

7 4 5

8 2 1

3 6

7 4 5

8 1

3 2 6

7 4 5

Initial state

Set of states reachable by executing only one action

Page 7: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Illustration 8 1

3 2 6

7 4 5

8 1

3 2 6

7 4 5

8 2 1

3 6

7 4 5

8 1

3 2 6

7 4 5

Initial state

Set of states reachable by executing only two actions

3 8 1

2 6

7 4 5

8 1

3 2 6

7 4 5

8 1

3 2 6

7 4 5

8 1 6

3 2

7 4 5

Page 8: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Illustration 8 1

3 2 6

7 4 5

8 1

3 2 6

7 4 5

8 2 1

3 6

7 4 5

8 1

3 2 6

7 4 5

Initial state

Set of states reachable by executing only two actions

3 8 1

2 6

7 4 5

8 1

3 2 6

7 4 5

8 1

3 2 6

7 4 5

8 1 6

3 2

7 4 5

This is a SEARCH TREE

If the problem has a solution, it will be one of the branches of the tree.

Uninformed search

strategies are different ways to explore the

search tree.

Page 9: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

The rest of these slides are borrowed from the slides in Russell and Norvig’s website

Page 10: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Implementation: states vs. nodes

A state is a (representation of) a physical configurationA node is a data structure constituting part of a search tree

includes parent, children, depth, path cost g(x)States do not have parents, children, depth, or path cost!

1

23

45

6

7

81

23

45

6

7

8

State Node depth = 6

g = 6

state

parent, action

The Expand function creates new nodes, filling in the various fields andusing the SuccessorFn of the problem to create the corresponding states.

Chapter 3 29

Page 11: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Search strategies

A strategy is defined by picking the order of node expansion

Strategies are evaluated along the following dimensions:completeness—does it always find a solution if one exists?time complexity—number of nodes generated/expandedspace complexity—maximum number of nodes in memoryoptimality—does it always find a least-cost solution?

Time and space complexity are measured in terms ofb—maximum branching factor of the search treed—depth of the least-cost solutionm—maximum depth of the state space (may be !)

Chapter 3 31

Page 12: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Uninformed search strategies

Uninformed strategies use only the information availablein the problem definition

Breadth-first search

Uniform-cost search

Depth-first search

Depth-limited search

Iterative deepening search

Chapter 3 32

Page 13: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Breadth-first search

Expand shallowest unexpanded node

Implementation:fringe is a FIFO queue, i.e., new successors go at end

A

B C

D E F G

Chapter 3 33

Page 14: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Breadth-first search

Expand shallowest unexpanded node

Implementation:fringe is a FIFO queue, i.e., new successors go at end

A

B C

D E F G

Chapter 3 34

Page 15: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Breadth-first search

Expand shallowest unexpanded node

Implementation:fringe is a FIFO queue, i.e., new successors go at end

A

B C

D E F G

Chapter 3 35

Page 16: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Breadth-first search

Expand shallowest unexpanded node

Implementation:fringe is a FIFO queue, i.e., new successors go at end

A

B C

D E F G

Chapter 3 36

Page 17: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Properties of breadth-first search

Complete??

Chapter 3 37

Page 18: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Properties of breadth-first search

Complete?? Yes (if b is finite)

Time??

Chapter 3 38

Page 19: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Properties of breadth-first search

Complete?? Yes (if b is finite)

Time?? 1 + b + b2 + b3 + . . . + bd + b(bd ! 1) = O(bd+1), i.e., exp. in d

Space??

Chapter 3 39

Page 20: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Properties of breadth-first search

Complete?? Yes (if b is finite)

Time?? 1 + b + b2 + b3 + . . . + bd + b(bd ! 1) = O(bd+1), i.e., exp. in d

Space?? O(bd+1) (keeps every node in memory)

Optimal??

Chapter 3 40

Page 21: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Properties of breadth-first search

Complete?? Yes (if b is finite)

Time?? 1 + b + b2 + b3 + . . . + bd + b(bd ! 1) = O(bd+1), i.e., exp. in d

Space?? O(bd+1) (keeps every node in memory)

Optimal?? Yes (if cost = 1 per step); not optimal in general

Space is the big problem; can easily generate nodes at 100MB/secso 24hrs = 8640GB.

Chapter 3 41

Page 22: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Uniform-cost search

Expand least-cost unexpanded node

Implementation:fringe = queue ordered by path cost, lowest first

Equivalent to breadth-first if step costs all equal

Complete?? Yes, if step cost ! !

Time?? # of nodes with g " cost of optimal solution, O(b!C!/!")

where C# is the cost of the optimal solution

Space?? # of nodes with g " cost of optimal solution, O(b!C!/!")

Optimal?? Yes—nodes expanded in increasing order of g(n)

Chapter 3 42

Page 23: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Depth-first search

Expand deepest unexpanded node

Implementation:fringe = LIFO queue, i.e., put successors at front

A

B C

D E F G

H I J K L M N O

Chapter 3 43

Page 24: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Depth-first search

Expand deepest unexpanded node

Implementation:fringe = LIFO queue, i.e., put successors at front

A

B C

D E F G

H I J K L M N O

Chapter 3 44

Page 25: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Depth-first search

Expand deepest unexpanded node

Implementation:fringe = LIFO queue, i.e., put successors at front

A

B C

D E F G

H I J K L M N O

Chapter 3 45

Page 26: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Depth-first search

Expand deepest unexpanded node

Implementation:fringe = LIFO queue, i.e., put successors at front

A

B C

D E F G

H I J K L M N O

Chapter 3 46

Page 27: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Depth-first search

Expand deepest unexpanded node

Implementation:fringe = LIFO queue, i.e., put successors at front

A

B C

D E F G

H I J K L M N O

Chapter 3 47

Page 28: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Depth-first search

Expand deepest unexpanded node

Implementation:fringe = LIFO queue, i.e., put successors at front

A

B C

D E F G

H I J K L M N O

Chapter 3 48

Page 29: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Depth-first search

Expand deepest unexpanded node

Implementation:fringe = LIFO queue, i.e., put successors at front

A

B C

D E F G

H I J K L M N O

Chapter 3 49

Page 30: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Depth-first search

Expand deepest unexpanded node

Implementation:fringe = LIFO queue, i.e., put successors at front

A

B C

D E F G

H I J K L M N O

Chapter 3 50

Page 31: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Depth-first search

Expand deepest unexpanded node

Implementation:fringe = LIFO queue, i.e., put successors at front

A

B C

D E F G

H I J K L M N O

Chapter 3 51

Page 32: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Depth-first search

Expand deepest unexpanded node

Implementation:fringe = LIFO queue, i.e., put successors at front

A

B C

D E F G

H I J K L M N O

Chapter 3 52

Page 33: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Depth-first search

Expand deepest unexpanded node

Implementation:fringe = LIFO queue, i.e., put successors at front

A

B C

D E F G

H I J K L M N O

Chapter 3 53

Page 34: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Depth-first search

Expand deepest unexpanded node

Implementation:fringe = LIFO queue, i.e., put successors at front

A

B C

D E F G

H I J K L M N O

Chapter 3 54

Page 35: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Properties of depth-first search

Complete??

Chapter 3 55

Page 36: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Properties of depth-first search

Complete?? No: fails in infinite-depth spaces, spaces with loopsModify to avoid repeated states along path

! complete in finite spaces

Time??

Chapter 3 56

Page 37: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Properties of depth-first search

Complete?? No: fails in infinite-depth spaces, spaces with loopsModify to avoid repeated states along path

! complete in finite spaces

Time?? O(bm): terrible if m is much larger than dbut if solutions are dense, may be much faster than breadth-first

Space??

Chapter 3 57

Page 38: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Properties of depth-first search

Complete?? No: fails in infinite-depth spaces, spaces with loopsModify to avoid repeated states along path

! complete in finite spaces

Time?? O(bm): terrible if m is much larger than dbut if solutions are dense, may be much faster than breadth-first

Space?? O(bm), i.e., linear space!

Optimal??

Chapter 3 58

Page 39: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Properties of depth-first search

Complete?? No: fails in infinite-depth spaces, spaces with loopsModify to avoid repeated states along path

! complete in finite spaces

Time?? O(bm): terrible if m is much larger than dbut if solutions are dense, may be much faster than breadth-first

Space?? O(bm), i.e., linear space!

Optimal?? No

Chapter 3 59

Page 40: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Depth-limited search

= depth-first search with depth limit l,i.e., nodes at depth l have no successors

Recursive implementation:

function Depth-Limited-Search(problem, limit) returns soln/fail/cuto!Recursive-DLS(Make-Node(Initial-State[problem]),problem, limit)

function Recursive-DLS(node,problem, limit) returns soln/fail/cuto!cuto!-occurred?! falseif Goal-Test(problem,State[node]) then return node

else if Depth[node] = limit then return cuto!

else for each successor in Expand(node,problem) do

result!Recursive-DLS(successor,problem, limit)if result = cuto! then cuto!-occurred?! trueelse if result "= failure then return result

if cuto!-occurred? then return cuto! else return failure

Chapter 3 60

Page 41: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Iterative deepening search

function Iterative-Deepening-Search(problem) returns a solutioninputs: problem, a problem

for depth! 0 to " do

result!Depth-Limited-Search(problem, depth)if result #= cuto! then return result

end

Chapter 3 61

Page 42: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Iterative deepening search l = 0

Limit = 0 A A

Chapter 3 62

Page 43: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Iterative deepening search l = 1

Limit = 1 A

B C

A

B C

A

B C

A

B C

Chapter 3 63

Page 44: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Iterative deepening search l = 2

Limit = 2 A

B C

D E F G

A

B C

D E F G

A

B C

D E F G

A

B C

D E F G

A

B C

D E F G

A

B C

D E F G

A

B C

D E F G

A

B C

D E F G

Chapter 3 64

Page 45: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Iterative deepening search l = 3

Limit = 3

A

B C

D E F G

H I J K L M N O

A

B C

D E F G

H I J K L M N O

A

B C

D E F G

H I J K L M N O

A

B C

D E F G

H I J K L M N O

A

B C

D E F G

H I J K L M N O

A

B C

D E F G

H I J K L M N O

A

B C

D E F G

H I J K L M N O

A

B C

D E F G

H I J K L M N O

A

B C

D E F G

H I J K L M N O

A

B C

D E F G

H I J K L M N O

A

B C

D E F G

H J K L M N OI

A

B C

D E F G

H I J K L M N O

Chapter 3 65

Page 46: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Properties of iterative deepening search

Complete??

Chapter 3 66

Page 47: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Properties of iterative deepening search

Complete?? Yes

Time??

Chapter 3 67

Page 48: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Properties of iterative deepening search

Complete?? Yes

Time?? (d + 1)b0 + db1 + (d ! 1)b2 + . . . + bd = O(bd)

Space??

Chapter 3 68

Page 49: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Properties of iterative deepening search

Complete?? Yes

Time?? (d + 1)b0 + db1 + (d ! 1)b2 + . . . + bd = O(bd)

Space?? O(bd)

Optimal??

Chapter 3 69

Page 50: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Properties of iterative deepening search

Complete?? Yes

Time?? (d + 1)b0 + db1 + (d ! 1)b2 + . . . + bd = O(bd)

Space?? O(bd)

Optimal?? Yes, if step cost = 1Can be modified to explore uniform-cost tree

Numerical comparison for b = 10 and d = 5, solution at far right leaf:

N(IDS) = 50 + 400 + 3, 000 + 20, 000 + 100, 000 = 123, 450

N(BFS) = 10 + 100 + 1, 000 + 10, 000 + 100, 000 + 999, 990 = 1, 111, 100

IDS does better because other nodes at depth d are not expanded

BFS can be modified to apply goal test when a node is generated

Chapter 3 70

Page 51: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Summary of algorithms

Criterion Breadth- Uniform- Depth- Depth- IterativeFirst Cost First Limited Deepening

Complete? Yes! Yes! No Yes, if l ! d YesTime bd+1 b"C

!/!# bm bl bd

Space bd+1 b"C!/!# bm bl bd

Optimal? Yes! Yes No No Yes!

Chapter 3 71

Page 52: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Repeated states

Failure to detect repeated states can turn a linear problem into an exponentialone!

A

B

C

D

A

BB

CCCC

Chapter 3 72

Page 53: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Graph search

function Graph-Search(problem, fringe) returns a solution, or failure

closed! an empty setfringe! Insert(Make-Node(Initial-State[problem]), fringe)loop do

if fringe is empty then return failurenode!Remove-Front(fringe)if Goal-Test(problem,State[node]) then return node

if State[node] is not in closed then

add State[node] to closed

fringe! InsertAll(Expand(node,problem), fringe)end

Chapter 3 73

Page 54: CS 380: ARTIFICIAL INTELLIGENCE PROBLEM SOLVING ...santi/teaching/2013/CS... · ARTIFICIAL INTELLIGENCE PROBLEM SOLVING: UNINFORMED SEARCH 10/2/2013 ... parent, action e pand on es

Summary

Problem formulation usually requires abstracting away real-world details todefine a state space that can feasibly be explored

Variety of uninformed search strategies

Iterative deepening search uses only linear spaceand not much more time than other uninformed algorithms

Graph search can be exponentially more e!cient than tree search

Chapter 3 74