Uniform Cost Search
Uniform Cost Search
let
C* be the cost of optimal solution.
ε is possitive constant (every action cost)
Depth-first search
• Always expands one of the nodes at the deepest
level of the tree
• Only when the search hits a dead end
• goes back and expands nodes at shallower levels
• Dead end leaf nodes but not the goal
• Backtracking search
• only one successor is generated on expansion
• rather than all successors
• fewer memory
Depth-first search
Expand deepest unexpanded node
• Implementation:
• fringe = LIFO queue, i.e., put successors at front
•
Depth-first search
Expand deepest unexpanded node
• Implementation:
• fringe = LIFO queue, i.e., put successors at front
•
Depth-first search
Expand deepest unexpanded node
• Implementation:
• fringe = LIFO queue, i.e., put successors at front
•
Depth-first search
Expand deepest unexpanded node
• Implementation:
• fringe = LIFO queue, i.e., put successors at front
•
Depth-first search
Expand deepest unexpanded node
• Implementation:
• fringe = LIFO queue, i.e., put successors at front
•
Depth-first search
Expand deepest unexpanded node
• Implementation:
• fringe = LIFO queue, i.e., put successors at front
•
Depth-first search
Expand deepest unexpanded node
• Implementation:
• fringe = LIFO queue, i.e., put successors at front
•
Depth-first search
Expand deepest unexpanded node
• Implementation:
• fringe = LIFO queue, i.e., put successors at front
•
Depth-first search
Expand deepest unexpanded node
• Implementation:
• fringe = LIFO queue, i.e., put successors at front
•
Depth-first search
Expand deepest unexpanded node
• Implementation:
• fringe = LIFO queue, i.e., put successors at front
•
Depth-first search
Expand deepest unexpanded node
• Implementation:
• fringe = LIFO queue, i.e., put successors at front
•
Depth-first search
Expand deepest unexpanded node
• Implementation:
• fringe = LIFO queue, i.e., put successors at front
•
Depth-first search
S
A D
B D A E
C E E B B F
11
D F B F C E A C G
14 17 15 15 13
G C G F
19 19 17 G 25
Depth-first search (Analysis)
• Not complete
• because a path may be infinite or looping
• then the path will never fail and go back try another
option
• Not optimal
• it doesn't guarantee the best solution
• It overcomes
• the time and space complexities
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
C E E B B F
11
D F B F C E A C G
14 17 15 15 13
G C G F
19 19 17
G 25
Iterative deepening search
• No choosing of the best depth limit
• It tries all possible depth limits:
• first 0, then 1, 2, and so on
• combines the benefits of depth-first and breadth-first search
Iterative deepening search
Iterative deepening search
(Analysis)
• optimal
• complete
• Time and space complexities
• reasonable
• suitable for the problem
• having a large search space
• and the depth of the solution is not known
Properties of iterative deepening search
Complete? Yes
•
• Time? (d+1)b0 + d b1 + (d-1)b2 + … + bd = O(bd)
•
• Space? O(bd)
•
• Optimal? Yes, if step cost = 1
Iterative lengthening search
• IDS is using depth as limit
• ILS is using path cost as limit
• an iterative version for uniform cost search
has the advantages of uniform cost search
• while avoiding its memory requirements
• but ILS incurs substantial overhead
• compared to uniform cost search
Bidirectional search
• Run two simultaneous searches
• one forward from the initial state another backward from the
goal
• stop when the two searches meet
• However, computing backward is difficult
• A huge amount of goal states
• at the goal state, which actions are used to compute it?
• can the actions be reversible to computer its predecessors?
Bidirectional Strategy
2 fringe queues: FRINGE1 and FRINGE2
B D A E
C E E B B F
11
D F B F C E A C G
14 17 15 15 13
G C G F
19 19 17
G 25
Comparing search strategies
Avoiding repeated states
• for all search strategies
• There is possibility of expanding states
• that have already been encountered and expanded before, on some
other path
• may cause the path to be infinite loop forever
• Algorithms that forget their history
• are doomed to repeat it
Avoiding repeated states
• Three ways to deal with this possibility
• Do not return to the state it just came from
• Refuse generation of any successor same as its parent state
• Do not create paths with cycles
• Refuse generation of any successor same as its ancestor states
• Do not generate any generated state
• Not only its ancestor states, but also all other expanded states have
to be checked against
Avoiding repeated states
• We then define a data structure
• closed list:
a set storing every expanded node so far
• If the current node matches a node on the closed list,
discard it.