Uniform Cost Search Method - PowerPoint PPT Presentation

1 / 14
About This Presentation
Title:

Uniform Cost Search Method

Description:

Uniform Cost Search Method Remedies space limitation of breadth first by always generating a child of the deepest unexpanded node. Implementation Depth First ... – PowerPoint PPT presentation

Number of Views:83
Avg rating:3.0/5.0
Slides: 15
Provided by: hasa
Category:

less

Transcript and Presenter's Notes

Title: Uniform Cost Search Method


1
Uniform Cost Search Method
2
A Z75 T118 S140 T118 S140
O146 S140 O146 L229
O146 L229 R230 F239 O291 L229 R230 F239
O291 R230 F239 O291 M299
3
Depth-First Search
  • Remedies space limitation of breadth first by
    always generating a child of the deepest
    unexpanded node.

http//www.rci.rutgers.edu/cfs/472_html/AI_SEARCH
/SearchAnimations.html
4
Implementation
  • Maintain a list of unexpanded nodes treated as a
    LIFO stack (as opposed to FIFO for breadth first
  • Usually implemented recrsively- with the
    recursion stack taking the place of an explicit
    node stack
  • Time complexity is O (bd)-Practically DF is time
    limited and BF is space limited
  • Disadvantage does not terminate if tree infinite
    or cycles in graph
  • Solution cutoff depth (d)
  • d small?
  • d large?

5
Simple Algorithm
Use a stack data structure. 1. Push root node of
tree on the stack. 2. Pop the top node off the
stack. Call this node N. 3. Push children
of node N onto the stack in right-to-left
order (so they are popped in left-to-right
order). 4. Repeat steps 2 and 3 until stack is
empty or goal is reached.
6
Depth First Iterative Deepening
  • The problem with depth-limited search is
    determining an appropriate depth for the search.
    We have a search method called depth first
    iterative deepening search (IDS) that tries all
    possible depth limits 0, 1, 2 , until a
    solution is found.
  • At first it seems wasteful as it is expanding
    nodes multiple times. But the overhead is small
    in comparison to the growth of an exponential
    search tree
  • For huge search spaces- the depth of the solution
    unknown, IDS is preferred.

7
Depth First Iterative Deepening
Combines best features of DF and BF
Performs a depth first to depth 1 then starts
over executing a complete depth first to depth 2
and continues to run depth first searches to
successive greater depths until a solution is
found.
Optimal in terms of time and space among all
brute force algorithms on a tree.
8
(No Transcript)
9
Iterative deepening search L 3
10
Initial state
A
A
C
D
E
F
B
Goal state
G
H
I
J
K
L
M
N
O
P
L
Q
R
S
T
U
V
W
X
Y
Z
11
We begin with our initial state the node labeled
A. This node is added to the queue. Press space
to continue
Node A is then expanded and removed from the
queue. Press space.
A
A
As this is the 0th iteration of the search, we
cannot search past any level greater than zero.
This iteration now ends, and we begin the 1st
iteration.
Press space to begin the search
Size of Queue 0
Queue Empty
Queue A
Size of Queue 1
Queue Empty
Size of Queue 0
Nodes expanded 0
Current Action Expanding
Current level n/a
Current level 0
Nodes expanded 1
ITERATIVE DEEPENING SEARCH PATTERN (0th ITERATION)
12
We again begin with our initial state the node
labeled A. Note that the 1st iteration carries on
from the 0th, and therefore the nodes expanded
value is already set to 1. Press space to continue
Node A is expanded, then removed from the queue,
and the revealed nodes are added to the front .
Press space.
A
A
The search now moves to level one of the node
set. Press space to continue
Node B is expanded and removed from the queue.
Press space.
We now back track to expand node C, and the
process continues. Press space.
C
D
E
F
B
B
C
D
E
F
As this is the 1st iteration of the search, we
cannot search past any level greater than level
one. This iteration now ends, and we begin a 2nd
iteration.
Press space to begin the search
Press space to continue the search
Press space to continue the search
Press space to continue the search
Size of Queue 0
Queue Empty
Queue A
Size of Queue 1
Queue B, C, D, E, F
Size of Queue 5
Queue C, D, E, F
Size of Queue 4
Queue D, E, F
Size of Queue 3
Queue E, F
Size of Queue 2
Queue F
Queue Empty
Size of Queue 1
Size of Queue 0
Nodes expanded 1
Current Action
Current level n/a
Nodes expanded 2
Current level 0
Current Action Expanding
Nodes expanded 3
Current level 1
Current Action Backtracking
Current level 0
Current level 1
Nodes expanded 4
Current Action Expanding
Current Action Backtracking
Current level 0
Current level 1
Nodes expanded 5
Current Action Expanding
Current Action Backtracking
Current level 0
Current level 1
Current Action Expanding
Current Action Backtracking
Current level 0
Current Action Expanding
Current level 1
Current level 0
Current level 1
Nodes expanded 6
Nodes expanded 7
ITERATIVE DEEPENING SEARCH PATTERN (1st ITERATION)
13
We again begin with our initial state the node
labeled A. Note that the 2nd iteration carries
on from the 1st, and therefore the nodes
expanded value is already set to 7 (16). Press
space to continue the search
Again, we expand node A to reveal the level one
nodes. Press space.
Node A is removed from the queue and each
revealed node is added to the front of the queue.
Press space.
The search then moves to level one of the node
set. Press space to continue
Node B is expanded and the revealed nodes added
to the front of the queue. Press space to
continue.
A
A
We now move to level two of the node set. Press
space to continue.
After expanding node G we backtrack to expand
node H. The process then continues until goal
state. Press space
C
D
E
F
B
B
C
D
G
H
I
J
K
L
G
H
I
J
K
L
L
L
L
L
Node L is located on the second level and the
search returns a solution on its second
iteration. Press space to end.
Press space to continue the search
Press space to continue the search
Press space to continue the search
Press space to continue the search
Press space to continue the search
Press space to continue the search
Size of Queue 0
Queue Empty
Queue A
Size of Queue 1
Queue B, C, D, E, F
Queue G, H, C, D, E, F
Size of Queue 5
Queue H, C, D, E, F
Queue C, D, E, F
Size of Queue 6
Size of Queue 5
Size of Queue 4
Queue I, J, D, E, F
Size of Queue 5
Queue J, D, E, F
Size of Queue 4
Queue D, E, F
Size of Queue 3
Queue K, L, E, F
Size of Queue 4
Queue L, E, F
Size of Queue 3
Queue Empty
Size of Queue 0
Nodes expanded 7
Current Action
Current level n/a
Current level 0
Nodes expanded 8
Current level 1
Nodes expanded 9
Current level 2
Current Action Expanding
Nodes expanded 10
Current Action Backtracking
Current Action Expanding
Nodes expanded 11
Current Action Backtracking
Current Action Expanding
Nodes expanded 12
Current level 1
Current level 2
Current level 1
Current level 0
Current level 1
Current level 2
Nodes expanded 13
Current Action Backtracking
Current level 1
Current level 2
Current Action Expanding
Nodes expanded 14
Current Action Backtracking
Current level 1
Current level 0
Current level 1
Current Action Expanding
Nodes expanded 15
Current level 2
Nodes expanded 16
Current Action Expanding
Current level 1
Current level 2
Current Action Backtracking
SEARCH FINISHED
ITERATIVE DEEPENING SEARCH PATTERN (2nd ITERATION)
14
  • Algorithm
  • Do DFS to depth 1
  • Treat all children of the start node as leafs
  • If no solution found, do DFS to depth 2
  • Repeat by increasing depth until a solution found
  • Start node is at depth 0
Write a Comment
User Comments (0)
About PowerShow.com