Implementation: General Tree Search - PowerPoint PPT Presentation

1 / 35
About This Presentation
Title:

Implementation: General Tree Search

Description:

O( bd 1 ), ie, exp. in d. Space?? O( bd 1 ) (keep every node in memory) Optimal? ... Uninformed strategies use only information available in the problem definition ... – PowerPoint PPT presentation

Number of Views:78
Avg rating:3.0/5.0
Slides: 36
Provided by: systema178
Category:

less

Transcript and Presenter's Notes

Title: Implementation: General Tree Search


1
Implementation General Tree Search
2
Uninformed Search Strategies
  • Uninformed strategies use only information
    available in the problem definition
  • Breadth-first search
  • Uniform-cost search
  • Depth-first search
  • Depth-limited search
  • Iterative deepening search

3
Properties of Breadth-First Search
  • Complete?? Yes (if b is finite)
  • Time?? 1 b b2 b3 bd b(bd 1) O(
    bd1 ), ie, exp. in d
  • Space?? O( bd1 ) (keep 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 10MB/sec, so 24hours 860GB.

4
Properties of Depth-first Search
  • Complete?? No fails in infinite-depth spaces,
    spaces with loops Modify 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.

5
Your chance to review
  • Consider a state space where the start state is
    number 1 and the successor function for state n
    returns two states, numbers 2n and 2n1.
  • Draw the portion of the state space for states 1
    to 15.
  • Suppose the goal state is 11. List the order in
    which nodes will be visited for breadth-first and
    depth-first searches.

6
Solution
  • Breadth First
  • 1, 2, 3, 4, 5, 6, 7, 8 , 9, 10, 11
  • Depth First
  • Trick Question
  • 1, 2, 4, 8, 16, 32, .

7
Uninformed Search Strategies
  • Uninformed strategies use only information
    available in the problem definition
  • Breadth-first search
  • Uniform-cost search
  • Depth-first search
  • Depth-limited search
  • Iterative deepening search

8
Properties of Breadth-First Search
  • Complete?? Yes (if b is finite)
  • Time?? 1 b b2 b3 bd b(bd 1) O(
    bd1 ), ie, exp. in d
  • Space?? O( bd1 ) (keep 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 10MB/sec, so 24hours 860GB.

9
Properties of Breadth-First Search
  • Complete?? Yes (if b is finite)
  • Time?? 1 b b2 b3 bd b(bd 1) O(
    bd1 ), ie, exp. in d
  • Space?? O( bd1 ) (keep 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 10MB/sec, so 24hours 860GB.

10
Problem Solving Agents
11
Uniform-cost Search
  • Expand least-cost unexpanded node
  • Implementation
  • fringe queue ordered by path cost
  • Equivalent to breadth-first if step costs all
    equal

12
Uniform-cost Search
  • Expand least-cost unexpanded node
  • Implementation
  • fringe queue ordered by path cost
  • Equivalent to breadth-first if step costs all
    equal
  • Complete??

13
Uniform-cost Search
  • Expand least-cost unexpanded node
  • Implementation
  • fringe queue ordered by path cost
  • Equivalent to breadth-first if step costs all
    equal
  • Complete?? Yes, if step cost ??

14
Uniform-cost Search
  • Expand least-cost unexpanded node
  • Implementation
  • fringe queue ordered by path cost
  • Equivalent to breadth-first if step costs all
    equal
  • Complete?? Yes, if step cost ??
  • Time??

15
Uniform-cost Search
  • Expand least-cost unexpanded node
  • Implementation
  • fringe queue ordered by path cost
  • 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 cost of optimal
    solution

16
Uniform-cost Search
  • Expand least-cost unexpanded node
  • Implementation
  • fringe queue ordered by path cost
  • 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 cost of optimal
    solution
  • Space??

17
Uniform-cost Search
  • Expand least-cost unexpanded node
  • Implementation
  • fringe queue ordered by path cost
  • 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 cost of optimal
    solution
  • Space?? of nodes with g ? cost of optimal
    solution, O(b ?C/??)

18
Uniform-cost Search
  • Expand least-cost unexpanded node
  • Implementation
  • fringe queue ordered by path cost
  • 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 cost of optimal
    solution
  • Space?? of nodes with g ? cost of optimal
    solution, O(b ?C/??)
  • Optimal??

19
Uniform-cost Search
  • Expand least-cost unexpanded node
  • Implementation
  • fringe queue ordered by path cost
  • 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 cost of optimal
    solution
  • Space?? of nodes with g ? cost of optimal
    solution, O(b ?C/??)
  • Optimal?? Yes nodes expanded in increasing
    order of g(n)

20
Properties of Depth-first Search
  • Complete?? No fails in infinite-depth spaces,
    spaces with loops Modify 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

21
Properties of Depth-first Search
  • Complete?? No fails in infinite-depth spaces,
    spaces with loops Modify 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

22
Depth-limited Search
  • depth-first search with depth limit l, i.e.,
    nodes at depth l have no successors
  • Recursive implementation

23
Iterative Deepening Search
24
Iterative Deepening Search l 0
  • Limit 0

25
Iterative Deepening Search l 1
  • Limit 1

26
Iterative Deepening Search l 2
  • Limit 2

27
Iterative Deepening Search l 3
  • Limit 3

28
Properties of Iterative Deepening Search
  • Complete??

29
Properties of Iterative Deepening Search
  • Complete?? Yes
  • Time??

30
Properties of Iterative Deepening Search
  • Complete?? Yes
  • Time?? (d1)b0 db1 (d-1)b2 bd O(bd)
  • Space??

31
Properties of Iterative Deepening Search
  • Complete?? Yes
  • Time?? (d1)b0 db1 (d-1)b2 bd O(bd)
  • Space?? O(bd)
  • Optimal??

32
Properties of Iterative Deepening Search
  • Complete?? Yes
  • Time?? (d1)b0 db1 (d-1)b2 bd O(bd)
  • Space?? O(bd)
  • Optimal?? Yes, if step cost 1Can be modified
    to explore uniform-cost treeNumerical comparison
    for b10 and d5, solution at far rightN(IDS)
    50 400 3,000 20,000 100,000
    123,450N(BFS) 10 100 1,000 10,000
    100,000 999,990 1,111,100

33
Summary of algorithms
34
So lets try it again
  • Consider a state space where the start state is
    number 1 and the successor function for state n
    returns two states, numbers 2n and 2n1.
  • Suppose the goal state is 11.
  • List the order in which nodes will be visited in
    depth limited search with limit 4
  • For iterative deepening.

35
Solution
  • Depth Limited, l3
  • 1, 2, 4, 8, 16, 17, 9, 18, 19, 5, 10, 20, 21, 11
  • Iterative Deepening
  • 1, 1, 2, 3, 1, 2, 4, 5, 3, 6, 7, 1, 2, 4, 8, 9,
    5, 10, 11
Write a Comment
User Comments (0)
About PowerShow.com