Uninformed Search Strategies
When To Use Iterative Deepening Search?
"In general, Iterative Deepening is the preferred uninformed search method when there is a large search space and the depth of the solution is not known."
Step 2 of implementing basic search strategy
After initializing open set, step 2. is to Choose/remove a state from Open
DFS vs BFS data structure
DFS: stack LIFO BFS: queue FIFO
True/False: The closed set is the most important part of Depth Limited Search
False: DLS => no closed set without closed set, guaranteed to be complete
True/False: If BFS returns solution, it is optimal.
False: In general, shallowest may not be optimal path cost - Optimal if path cost non-decreasing function of node depth
"In general, ________ __________ is the preferred uninformed search method when there is a large search space and the depth of the solution is not known."
Iterative Deepening
Depth-limited search limits...
Limits how deep a depth-first search can go
Recursive DFS
Possible to implement DFS (and related) as recursive functions; Recursive implementation is typical - Think of child states as "new" initial states • Reduces space cost to O(m) • Loops: Only need to store/check current path (previous recursion levels) - No additional space cost
loop
Returning to a node previously visited on path - don't avoid, costly, instead keep set of visited nodes (closed set)
True/False; Order child nodes "alphabetically" left to right
True
True/False: In BFS, All nodes at level d are expanded before level d+1
True! root node => d=0 BFS: Expand root node, then expand all successors, then their successors, and so on. So, expand shallowest unexpanded node first
True/False: Root node is level d = 0
True: In BFS, All nodes at level d are expanded before level d+1
True/False: Search strategy chooses which open state to expand next
True: This choice/state is then removed from the open set.
True/False: Finding good depth limit is difficult for most problems
True: iterative deepening search sidesteps issue of choosing best depth limit with depth-limited search
True/False: Depth-limited search is guaranteed to find solution, but not guaranteed to find shortest solution
True; given solution exists
Guaranteed to be the cheapest solution
Uniform-Cost search (modified BFS) - Otherwise it would have been expanded later
___________ strategies use only the information available in the problem definition
Uninformed - also called "blind search" - No info on number of steps or path cost from "current state to goal state" - Only distinguish goal state from non-goal state - no preference of which to choose first between the states
type of strategy that can only distinguish goal state from non-goal state
Uninformed/Blind These strategies use only the information available in the problem definition and have no preference or info on number of steps or path cost from "current state to goal state"
Depth-first search expands _______ node first
deepest
BFS space is ____________
exponential -> bad
Uniform-cost search expands __________ (additive) leaf node first
least-cost
Group of states that are children of nodes that have been expanded are in the open/close set?
open
Group of states that haven't been expanded yet
open set
BFS open set is a _______ (FIFO)
queue -> Put new nodes at end, remove from front
collection of objects
set
Breadth-first search expands ____________ node in tree first
shallowest
In BFS, method finds the _________ goal state
shallowest
BFS is complete if .....
the branching factor b is finite
True/False: Uninformed search has no preference of which to choose first between the states
true
Depth-First Search
- Always expand deepest unexpanded node (on the fringe) first - Left-to-right or right-to-left ordering) - Only when hit "dead-end" (leaf) does search go back and expand nodes at next shallower level Open set - Put new nodes at end, remove from end - Stack, last-in first-out (LIFO) Properties: Space -(ok) linear, keep nodes as you go Time- (bad) when max depth > goal depth Optimal - (bad) returns deepest solution Complete- (bad) fails in loops or infinite depth
Iterative deepening search combines....
- Combines benefits of BFS and DFS - Depth-limited search with increasing limits until goal is found
Properties of Uniform Cost Search
- Complete (good) - Optimal (good) - Time and space (can be bad): Additional cost of priority queue Can be much greater than b^d Can explore large subtrees of small steps before exploring large (and perhaps useful) steps
"Depth-Limited" Search
- Depth-first search with depth limit of l - Avoids pitfalls of depth-first search by imposing a cutoff (stop) depth - Finding good depth limit is difficult for most problems Implementation - Depth-first stack with nodes at depth l having no successors - Guaranteed to find solution (if exists), but not guaranteed to find shortest solution Properties: - Complete (if depth limit big enough) - Not optimal - Time and space complexity of depth-first search (Space -(ok) linear; Time- (bad) when max depth > goal depth)
Iterative Deepening Search
- Finding good depth limit is difficult for most problems => sidesteps issue of choosing best depth limit • Try all possible depth limits- First depth 0, then depth 1, then depth 2, ... - May seem wasteful, but overhead is not very costly - Because most of the nodes are toward bottom of tree - Not costly to generate upper nodes multiple times *Preferred method with large search space and depth of solution not known* Properties: • Complete (good) • Time (not too bad) - O(b^d), where d is depth of shallowest solution - Breadth-first finds shallowest (good for path cost when is non-decreasing function of the depth) • Space (good) - O(bd) - linear as in depth-first • Optimality (good) - Yes (Same as BFS)
Closed set
- Group of states that have been expanded - Often neglected (for space reasons)
Open Set
- Group of states that haven't been expanded yet - Group of states that are children of nodes that have been expanded - Search strategy chooses which open state to expand next - "set" as in collection of objects, not strictly mathematical set - Data structure depends on search strategy
examples of uninformed search methods
- bfs - uniform-cost - dfs - depth limited - iterative deepening Strategies differ by the order in which nodes are expanded (i.e., removed from Open set)
8 basics steps for implementing search strategies
1. Initialize Open to contain initial state 2. Choose/remove one state from Open 3. (Optional) Jump to (8) if already in Closed 4. Check if state is a goal state (done if so) 5. Get child states using successor function 6. Insert children into Open 7. (Optional) Insert original state into Closed 8. Repeat from (2)
Step 1 of implementing basic search strategy
1. Initialize open to contain initial set
Uniform-Cost Search is a modified ______
BFS
Breadth First Search
BFS: Expand root node, then expand all successors, then their successors, and so on - Expand shallowest unexpanded node first - Left to Right or Right to Left ordering - All nodes at level d are expanded before level d+1 - root node at depth d = 0 - Method finds the shallowest goal state - Open set -> Put new nodes at end, remove from front -> Queue, first-in first-out (FIFO) Properties: - complete (good if branching factor is finite) - space (exponential-bad) - time (bad) - optimality (good, but shallowest may not be optimal)
True/False: In the 8 basic steps for implementing search strategies, we should get the child states using the successor function before checking if the state is a goal state
False: This flipped steps 4 and 5. The correct implementation is: 1. Initialize Open to initial state 2. Remove from Open 3. (Optional) Jump to (8) if already in Closed *4. Check if state is a goal state (done if so) 5. Get child states using successor function* 6. Insert children into Open 7. (Optional) Insert original state into Closed 8. Repeat from (2)
____ combines benefits of depth-first and BFS
IDS
The open set for DFS uses a _______
Stack LIFO
___________ strategies have no preference of which to choose first between the states
uninformed
Uniform-Cost Search is guaranteed to be the ___________ solution
cheapest
set
collection of objects
Properties of BFS
• Complete (good) - If branching factor b is finite • Space -nodes generated (exponential-bad) - O(b^(d+1)) = b + b^2 + ... + b^d + (b^(d+1) - b) , d = goal depth - Assume goal is last node (e.g.,rightmost) at depth d - Goal state is not expanded - Big limitation (need lots of space) - Depth=10, branching=10, space=1000bytes/node 101 terabytes! • Time(bad) - Same as space • Optimality (good) - Not in general, shallowest may not be optimal path cost - Optimal if path cost non-decreasing function of node depth
Uniform-Cost Search
• Expand least-cost unexpanded leaf node first (rather than lowest-depth as in BFS) - General additive cost function (i.e. cost from initial state to current state) - *Not* cost from current state to goal! - not "informed" search!! • Guaranteed to be the cheapest solution - Otherwise it would have been expanded later • Open set - Remove nodes in order of increasing path cost - Priority queue • Properties - complete - good - time/space - can be bad - optimal - good
In Uniform-cost search, nodes are removed from the open set in order of _____________ path cost, and are stored in a __________
• Open set - Remove nodes in order of *increasing* path cost - *Priority queue*
Properties of DFS
• Potentially not complete (can be bad) - Fails in infinite-depth spaces or with loops • Time (bad) - O(b^m), m=maximum depth - Bad if m is larger than depth of goal (d) - Good if multiple solutions (hit one) • Space (better) - O(mb), linear space (keep only leaf nodes "as you go") - <= b leaf nodes at each level stored (up to level m) • Optimality (bad) - No, it returns the first deepest solution, so it could miss a shallower solution it has not yet seen (even at low depth)
How to Uninformed search strategies differ?
• Strategies differ by the order in which nodes are expanded (i.e., removed from Open set) examples: bfs, dos, depth limited, iterative deepening, uniform-cost
Uninformed Search Methods
• Types - Breadth-first search - Uniform-cost search - Depth-first search - Depth-limited search - Iterative deepening search • Strategies differ by the order in which nodes are expanded (i.e., removed from Open set)