13

Click here to load reader

Uninformed Search (2) - University of Southern Californiacsci561b/slides/session05_short.pdf · Uninformed Search (2) Lecture 5 Introduction to Artificial Intelligence 1 ... m –max

  • Upload
    haphuc

  • View
    213

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Uninformed Search (2) - University of Southern Californiacsci561b/slides/session05_short.pdf · Uninformed Search (2) Lecture 5 Introduction to Artificial Intelligence 1 ... m –max

1

Uninformed Search (2)

Lecture 5Introduction to Artificial Intelligence

1

Introduction to Artificial IntelligenceHadi Moradi

[email protected]

Review: BFSCompleteness:Completeness:

Yes, Time complexity:

O(b d), Space complexity:

O(b d), Optimality:

SS

AA DD

2

Optimality:Yes b – max branching factor d – depth of the least-cost solutionm – max depth

BB DD AA EE

CC EE EE BB BB FF

DD FF BB FF CC EE AA CC GG

GGGGGG FFCC

Page 2: Uninformed Search (2) - University of Southern Californiacsci561b/slides/session05_short.pdf · Uninformed Search (2) Lecture 5 Introduction to Artificial Intelligence 1 ... m –max

2

Review: Uniform Cost

Completeness: SSYes,

Time complexity:O(b d),

Space complexity:O(b d),

Optimality:

SS

AA DD

BB DD AA EE

EE BB BB FF

33 44

44 55

55

55 22

55 44

33 44

77 88 99 66

10101111CC EE

44 551111 1212 1313 1313

44

3

Optimality:Yes BB FF CC EE AA CC GG

GGGG FFCC

33DD FF

GG

1313

Review: DFSCompleteness: YesCompleteness: Yes, Time complexity: O(b m), Space complexity:O(bm), Optimality: No

b – max branching factor d – depth of the least-cost solution

BB

SS

AA

4

solutionm – max depth CC EE

DD FF

GG

Page 3: Uninformed Search (2) - University of Southern Californiacsci561b/slides/session05_short.pdf · Uninformed Search (2) Lecture 5 Introduction to Artificial Intelligence 1 ... m –max

3

Depth First Search

Problem: Not remembering the previousProblem: Not remembering the previous states

Time complexity

Solution:Combine the depth first search and breath first

5

psearch

Depth-limited search

It i d th fi t h ith d th li itIt is a depth-first search with depth limit

Implementation: Nodes at depth l have no successors.

Complete:

Optimal:

6

p

Page 4: Uninformed Search (2) - University of Southern Californiacsci561b/slides/session05_short.pdf · Uninformed Search (2) Lecture 5 Introduction to Artificial Intelligence 1 ... m –max

4

Iterative deepening searchFunction Iterative-deepening-Search(problem) returns a solution, or failurep g (p ) ,

for depth = 0 to ∞ doresult Depth-Limited-Search(problem, depth)if result succeeds then return result

endreturn failure

7

Combines the best of breadth-first and depth-first search strategies.• Completeness: • Time complexity:• Space complexity:• Optimality:

Romania with step costs in km

8

Page 5: Uninformed Search (2) - University of Southern Californiacsci561b/slides/session05_short.pdf · Uninformed Search (2) Lecture 5 Introduction to Artificial Intelligence 1 ... m –max

5

9

10

Page 6: Uninformed Search (2) - University of Southern Californiacsci561b/slides/session05_short.pdf · Uninformed Search (2) Lecture 5 Introduction to Artificial Intelligence 1 ... m –max

6

11

12

Page 7: Uninformed Search (2) - University of Southern Californiacsci561b/slides/session05_short.pdf · Uninformed Search (2) Lecture 5 Introduction to Artificial Intelligence 1 ... m –max

7

13

14

Page 8: Uninformed Search (2) - University of Southern Californiacsci561b/slides/session05_short.pdf · Uninformed Search (2) Lecture 5 Introduction to Artificial Intelligence 1 ... m –max

8

15

16

Page 9: Uninformed Search (2) - University of Southern Californiacsci561b/slides/session05_short.pdf · Uninformed Search (2) Lecture 5 Introduction to Artificial Intelligence 1 ... m –max

9

Iterative deepening complexity

Iterative deepening search may seem wastefulIterative deepening search may seem wasteful because so many states are expanded multiple times.

17

Bidirectional search

Both search forward from initial stateBoth search forward from initial state, and backwards from goal.Stop when the two searches meet in the middle.

18

GoalGoalStartStart

Page 10: Uninformed Search (2) - University of Southern Californiacsci561b/slides/session05_short.pdf · Uninformed Search (2) Lecture 5 Introduction to Artificial Intelligence 1 ... m –max

10

Bidirectional search

1 QUEUE1 <1 QUEUE1 < path only containing the root;path only containing the root;1. QUEUE1 <1. QUEUE1 <---- path only containing the root;path only containing the root;QUEUE2 <QUEUE2 <---- path only containing the goal;path only containing the goal;

2. 2. WHILEWHILE both QUEUEs are not emptyboth QUEUEs are not emptyANDAND QUEUE1 and QUEUE2 do NOT share a stateQUEUE1 and QUEUE2 do NOT share a state

DODO remove their first paths;remove their first paths;create their new paths (to all children);create their new paths (to all children);

19

p ( );p ( );reject their new paths with loops;reject their new paths with loops;add their new paths to back;add their new paths to back;

3. 3. IFIF QUEUE1 and QUEUE2 share a stateQUEUE1 and QUEUE2 share a stateTHENTHEN success;success;ELSEELSE failure;failure;

Bidirectional search• Completeness:• Completeness: • Time complexity:• Space complexity:• Optimality:

20

Page 11: Uninformed Search (2) - University of Southern Californiacsci561b/slides/session05_short.pdf · Uninformed Search (2) Lecture 5 Introduction to Artificial Intelligence 1 ... m –max

11

Bidirectional search

Bidirectional search meritsBidirectional search meritsBig difference for problems with branching factor b in both directions

21

Bidirectional searchBidirectional search issues

Predecessors of a node need to be generated

What to do if there is no explicit list of goalstates?

22

What is the best search strategy for the two searches?

Page 12: Uninformed Search (2) - University of Southern Californiacsci561b/slides/session05_short.pdf · Uninformed Search (2) Lecture 5 Introduction to Artificial Intelligence 1 ... m –max

12

Comparing uninformed search strategies

Criterion Breadth Uniform DepthFirst DepthLim Iterative Bidirectional

Time b^d b^d b^m b^l b^d b^(d/2)

Space b^d b^d bm bl bd b^(d/2)

Optimal? Yes Yes No No Yes Yes

23

Complete? Yes Yes No Yes if l≥d Yes Yesb – max branching factor of the search treed – depth of the least-cost solutionm – max depth of the state-space (may be infinity)l – depth cutoff

Summary

Problem formulation usually requiresProblem formulation usually requires abstracting away real-world details to define a state space that can be explored using computer algorithms.

24

Once problem is formulated in abstract form, complexity analysis helps us picking out best algorithm to solve problem.

Page 13: Uninformed Search (2) - University of Southern Californiacsci561b/slides/session05_short.pdf · Uninformed Search (2) Lecture 5 Introduction to Artificial Intelligence 1 ... m –max

13

Summary

Variety of uninformed search strategies;Variety of uninformed search strategies; difference lies in method used to pick node that will be further expanded.

Iterative deepening search only uses

25

Iterative deepening search only uses linear space and not much more time than other uniformed search strategies.