Blind Search - PowerPoint PPT Presentation

About This Presentation
Title:

Blind Search

Description:

Blind Search Russell and Norvig: Chapter 3, Sections 3.4 3.6 Blind Search * Depth-First Strategy New nodes are inserted at the front of FRINGE 1 2 3 4 5 Blind ... – PowerPoint PPT presentation

Number of Views:166
Avg rating:3.0/5.0
Slides: 52
Provided by: JeanClaud80
Category:
Tags: blind | depth | first | search

less

Transcript and Presenter's Notes

Title: Blind Search


1
Blind Search
  • Russell and Norvig Chapter 3, Sections 3.4
    3.6

2
?? ????? ????
  • ???? ????? ??? ??? ??, ??? ???
  • ?? ?? ??? kn?? ???
  • ???? Polynomial complexity
  • ?? ????? ?? ? ???, ??? ?? ??
  • ????
  • ???? ??? ? ???, ?????? ?? polynomial?. ??? ?? ??
    ??? ?? ? ??. ?? ???? ????? ??? ?? ??
  • ???? ?? NP ???
  • ??? ?(feasible solution)? ??. ????? ??? ?? ? ? ??.

3
Simple Agent Algorithm
  • Problem-Solving-Agent
  • initial-state ? sense/read state
  • goal ? select/read goal
  • ? goal formulation and test a function for goal
    testing
  • successor ? select/read action models
  • ? successor function to calculate next states
  • problem ? (initial-state, goal, successor)
  • solution ? search(problem)
  • perform(solution)

4
Search of State Space
? search tree
5
Basic Search Concepts
  • Search tree
  • Search node
  • Node expansion
  • Search strategy At each stage it determines
    which node to expand

6
Search Nodes ? States
The search tree may be infinite even when the
state space is finite
7
Node Data Structure
  • STATE
  • PARENT
  • ACTION
  • COST
  • DEPTH

If a state is too large, it may be preferable to
only represent the initial state and
(re-)generate the other states when needed
8
Fringe
  • Set of search nodes that have not been expanded
    yet
  • Implemented as a queue FRINGE
  • INSERT(node,FRINGE)
  • REMOVE(FRINGE)
  • The ordering of the nodes in FRINGE defines the
    search strategy

9
Search Algorithm
  • If GOAL?(initial-state) then return initial-state
  • INSERT(initial-node,FRINGE)
  • Repeat
  • If FRINGE is empty then return failure
  • n ? REMOVE(FRINGE)
  • s ? STATE(n)
  • For every state s in SUCCESSORS(s)
  • Create a node n as a successor of n
  • If GOAL?(s) then return path or goal state
  • INSERT(n,FRINGE)

10
Performance Measures
  • CompletenessIs the algorithm guaranteed to find
    a solution when there is one?

Probabilistic completeness If there is a
solution, the probability that the algorithms
finds one goes to 1 quickly with the running
time
11
Performance Measures
  • CompletenessIs the algorithm guaranteed to find
    a solution when there is one?
  • OptimalityIs this solution optimal?
  • Time complexityHow long does it take?
  • Space complexityHow much memory does it require?

12
Important Parameters
  • Maximum number of successors of any state ?
    branching factor b of the search tree
  • Minimal length of a path in the state space
    between the initial and a goal state? depth d
    of the shallowest goal node in the search tree

13
Blind vs. Heuristic Strategies
  • Blind (or un-informed) strategies do not exploit
    any of the information contained in a state
  • Heuristic (or informed) strategies exploits such
    information to assess that one node is more
    promising than another

14
Example 8-puzzle
For a blind strategy, N1 and N2 are just two
nodes (at some depth in the search tree)
For a heuristic strategy counting the number of
misplaced tiles, N2 is more promising than N1
15
Important Remark
  • Some problems formulated as search problems are
    NP-hard problems (e.g., (n2-1)-puzzle
  • We cannot expect to solve such a problem in less
    than exponential time in the worst-case
  • But we can nevertheless strive to solve as many
    instances of the problem as possible

16
Blind Strategies
  • Breadth-first
  • Bidirectional
  • Depth-first
  • Depth-limited
  • Iterative deepening
  • Uniform-Cost

17
Breadth-First Strategy
  • New nodes are inserted at the end of FRINGE

FRINGE (1)
18
Breadth-First Strategy
  • New nodes are inserted at the end of FRINGE

FRINGE (2, 3)
19
Breadth-First Strategy
  • New nodes are inserted at the end of FRINGE

FRINGE (3, 4, 5)
20
Breadth-First Strategy
  • New nodes are inserted at the end of FRINGE

FRINGE (4, 5, 6, 7)
21
Evaluation
  • b branching factor
  • d depth of shallowest goal node
  • Complete
  • Optimal if step cost is 1
  • Number of nodes generated 1 b b2 bd
    (bd1-1)/(b-1)
    O(bd)
  • Time and space complexity is O(bd)

22
Big O Notation
  • g(n) is in O(f(n)) if there exist two positive
    constants a and N such that
  • for all n gt N, g(n) ? a?f(n)

23
Time and Memory Requirements
d Nodes Time Memory
2 111 .01 msec 11 Kbytes
4 11,111 1 msec 1 Mbyte
6 106 1 sec 100 Mb
8 108 100 sec 10 Gbytes
10 1010 2.8 hours 1 Tbyte
12 1012 11.6 days 100 Tbytes
14 1014 3.2 years 10,000 Tb
Assumptions b 10 1,000,000 nodes/sec
100bytes/node
24
Time and Memory Requirements
d Nodes Time Memory
2 111 .01 msec 11 Kbytes
4 11,111 1 msec 1 Mbyte
6 106 1 sec 100 Mb
8 108 100 sec 10 Gbytes
10 1010 2.8 hours 1 Tbyte
12 1012 11.6 days 100 Tbytes
14 1014 3.2 years 10,000 Tb
Assumptions b 10 1,000,000 nodes/sec
100bytes/node
25
Bidirectional Strategy
2 fringe queues FRINGE1 and FRINGE2
Time and space complexity O(bd/2) ltlt O(bd)
26
Depth-First Strategy
  • New nodes are inserted at the front of FRINGE

1
27
Depth-First Strategy
  • New nodes are inserted at the front of FRINGE

1
28
Depth-First Strategy
  • New nodes are inserted at the front of FRINGE

1
29
Depth-First Strategy
  • New nodes are inserted at the front of FRINGE

1
30
Depth-First Strategy
  • New nodes are inserted at the front of FRINGE

1
31
Depth-First Strategy
  • New nodes are inserted at the front of FRINGE

1
32
Depth-First Strategy
  • New nodes are inserted at the front of FRINGE

1
33
Depth-First Strategy
  • New nodes are inserted at the front of FRINGE

1
34
Depth-First Strategy
  • New nodes are inserted at the front of FRINGE

1
35
Depth-First Strategy
  • New nodes are inserted at the front of FRINGE

1
36
Depth-First Strategy
  • New nodes are inserted at the front of FRINGE

1
37
Evaluation
  • b branching factor
  • d depth of shallowest goal node
  • m maximal depth of a leaf node
  • Complete only for finite search tree
  • Not optimal
  • Number of nodes generated 1 b b2 bm
    O(bm)
  • Time complexity is O(bm)
  • Space complexity is O(bm) or O(m)

38
Depth-Limited Strategy
  • Depth-first with depth cutoff k (maximal depth
    below which nodes are not expanded)
  • Three possible outcomes
  • Solution
  • Failure (no solution)
  • Cutoff (no solution within cutoff)

39
Iterative Deepening Strategy
  • Repeat for k 0, 1, 2,
  • Perform depth-first with depth cutoff k
  • Complete
  • Optimal if step cost 1
  • Time complexity is (d1)(1) db (d-1)b2
    (1) bd O(bd)
  • Space complexity is O(bd) or O(d)

40
Calculation
  • db (d-1)b2 (1) bd
  • bd 2bd-1 3bd-2 db
  • bd(1 2b-1 3b-2 db-d)
  • ? bd(Si1,,? ib(1-i))
  • bd (b/(b-1))2

41
Comparison of Strategies
  • Breadth-first is complete and optimal, but has
    high space complexity
  • Depth-first is space efficient, but neither
    complete nor optimal
  • Iterative deepening is asymptotically optimal

42
Repeated States
43
Avoiding Repeated States
  • Requires comparing state descriptions
  • Breadth-first strategy
  • Keep track of all generated states
  • If the state of a new node already exists, then
    discard the node
  • The cost to find the repeated state (space and
    time)

44
Avoiding Repeated States
  • Depth-first strategy
  • Solution 1
  • Keep track of all states associated with nodes in
    current path
  • If the state of a new node already exists, then
    discard the node
  • ? Avoids loops
  • Solution 2
  • Keep track of all states generated so far
  • If the state of a new node has already been
    generated, then discard the node
  • ? Space complexity of breadth-first

45
Detecting Identical States
  • Use explicit representation of state space
  • Use hash-code or similar representation

46
Revisiting Complexity
  • Assume a state space of finite size s
  • Let r be the maximal number of states that can
    be attained in one step from any state
  • In the worst-case r s-1
  • Assume breadth-first search with no repeated
    states
  • Time complexity is O(rs). In the worst case it
    is O(s2)

47
Example
  • s nx x ny
  • r 4 or 8
  • Time complexity is O(s)

48
Uniform-Cost Strategy
  • Each step has some cost ? ? gt 0.
  • The cost of the path to each fringe node N is
  • g(N) ? costs of all steps.
  • The goal is to generate a solution path of
    minimal cost.
  • The queue FRINGE is sorted in increasing cost.

49
Modified Search Algorithm
  • INSERT(initial-node,FRINGE)
  • Repeat
  • If FRINGE is empty then return failure
  • n ? REMOVE(FRINGE)
  • s ? STATE(n)
  • If GOAL?(s) then return path or goal state
  • For every state s in SUCCESSORS(s)
  • Create a node n as a successor of n
  • INSERT(n,FRINGE)

50
Exercises
  • Adapt uniform-cost search to avoid repeated
    states while still finding the optimal solution
  • Uniform-cost looks like breadth-first (it is
    exactly breadth first if the step cost is
    constant). Adapt iterative deepening in a similar
    way to handle variable step costs

51
Summary
  • Search tree ? state space
  • Search strategies breadth-first, depth-first,
    and variants
  • Evaluation of strategies completeness,
    optimality, time and space complexity
  • Avoiding repeated states
  • Optimal search with variable step costs
Write a Comment
User Comments (0)
About PowerShow.com