Uninformed Search Strategies
In this post, we will be exploring different search strategies when there is no information about how close a state to the goal is.
Criteria used to choose between a search algorithm:
- Completeness: The algorithm will eventually find the solution if it exists
- Cost optimally: If it finds the solution with the lowest cost
- Time complexity: Time needed to find the solution
- Space complexity: Memory needed
Criterion | Breadth-First | Uniform-Cost | Depth-First | Depth-Limited | Iterative Deepening | Bidirectional |
---|---|---|---|---|---|---|
Completeness | ✅ | ✅ | ⚠️ | ⚠️ | ⚠️ | ⚠️ |
Cost-Optimal | ✅ | ✅ | ❌ | ❌ | ❌ | ⚠️ |
Time | ||||||
Space |
Contents
- Breadth-First Search
- Uniform-Cost Search (Dijkstra’s Algorithm)
- Depth-First Search
- Depth-Limited Search
- Iterative Deepening Search
- Bidirectional Search
Breadth-First Search
This strategy bases on the successive expansion of the nodes by depths: First the root node, then the successors of the root nodes, then the successors of the successors, and so on.
Additional efficiency can be obtained with a first-in-first-out queue.1
Total number of the nodes:
- : Branching factor
- : Depth
Nodes must be kept in memory: Both time and space complexity are
Properties:
- Complete
- Cost-optimal: The first solution found has the least cost (assuming all actions have the same cost)
- Exponential-complexity
Uniform-Cost Search (Dijkstra’s Algorithm)
In uniform-cost, the node with the least path cost is chosen to be expanded.
Time complexity:
- : Cost of the solution. Using the notation of for the optimal solution
- : Lowest step cost
- Can be much greater than of breadth-first search.
- When all costs are equal, the time complexity of the uniform-cost search is
Properties:
- Complete
- Cost-optimal
Depth-First Search
The deepest node in the frontier is expanded first. It’s usually implemented as a tree-like search without keeping a list of reached nodes.
The search proceeds first to the deepest level of the search tree with no successors, then it goes back to the next deepest unexpanded node.
The time and memory complexity are, respectively:
- : Branching factor
- : Maximum depth
Properties:
- Not cost-optimal: Returns the first solution found, not the cheapest
- Generally incomplete
- Efficient and complete for finite state spaces.
- Also complete for acyclic state spaces, but can be expanding the same state via different paths
- In cyclic state spaces, it can get stuck in an infinite loop
- Some implementations check nodes for cycles
- In infinite state space, it’s not systematic: Can’t explore the entire space and can get stuck going down an infinite path
- Very memory efficient
- There is a variant that uses even less memory (backtracking search): Only one successor is generated at a time rather than all successors, with
Depth-Limited Search
In depth-limited, a depth limit is supplied, stopping the expansion at depth . This search solves the problem of infinite path of the depth-first search.
Time and space complexity:
Property:
- An incorrect choice of can make the search incomplete
- The algorithm can be improved by checking cycles at upper nodes, leaving the longer cycles to the depth limit
- can be chosen based on knowledge of the problem. The minimum depth limit that allows the full exploration is known as diameter of the state-space graph
Iterative Deepening Search
With this search we don’t have to pick a nice value for . The algorithm simply tries all values for until finding the solution or failure (no solution).
Iterative deepening search combines benefits of depth-first and breadth-first search:
- Modest memory requirement:
- when there is a solution
- on finite state spaces with no solution
- Optimal when all actions have the same cost
- Complete on finite acyclic state spaces, or on any finite state space by checking for cycles
- The time complexity is:
- when there is a solution
- when there is no solution
Iterative deepening search is slower than breadth-first search, but much more memory efficient. The total number of nodes generated in the worst case is:
with a time complexity of , asymptotically the same as breadth-first search.
Bidirectional Search
In this case we will search simultaneously forward from the initial state and backwards from the goal state(s), expecting both searches to meet. The motivation is based on:
Likewise, the path cost of each search is going to be .
We will have to track two frontiers and two tables of reached states, and have the ability to reason backwards: The parent of a successor in the forward direction is the successor of the parent in the backward direction. Solution is obtained when two frontiers collide.
The underlying search algorithm can be chosen from the strategies listed above.
Footnotes
-
With a FIFO queue, there is no need to evaluate a priority function to choose which successor to expand first. ↩