8. uninformed search algorithm
8. uninformed search algorithm
Strategies
Introduction
● An uninformed search algorithm is given no clue about how close a state is
to the goal(s).
● For example, consider our agent in Arad with the goal of reaching
Bucharest.
● An uninformed agent with no knowledge of Romanian geography has no
clue whether going to Zerind or Sibiu is a better first step.
● In contrast, an informed agent who knows the location of each city knows
that Sibiu is much closer to Bucharest and thus more likely to be on the
shortest path.
Breadth - first search
•Expands the root node first, then its successors, level by level.
● The memory requirements are a bigger problem for breadth-first search than the
execution time.
•Memory usage grows exponentially, making BFS infeasible for deep searches.
•Example:
•b = 10, depth = 10 → Requires 10 TB memory.
•Depth = 14 → 3.5 years even with infinite memory.
● When all action costs are equal, uniform-cost search is similar to breadth-
first search.
Depth-first Search
● It is called the depth-first search because it starts from the root node and
follows each path to its greatest depth node before moving to the next
path.
● DFS requires very less memory as it only needs to store a stack of the nodes
on the path from root node to the current node.
● It takes less time to reach to the goal node than BFS algorithm (if it traverses
in the right path).
● With the help of this we can store the route which is being tracked in
memory to save time as it only needs to keep one at a particular time.
Disadvantage
● There is the possibility that many states keep re-occurring, and there is no
guarantee of finding the solution.
● DFS algorithm goes for deep down searching and sometime it may go to the
infinite loop.
● The depth-first search (DFS) algorithm does not always find the shortest
path to a solution.
Example
● Where, m= maximum depth of any node and this can be much larger
than d (Shallowest solution depth)
● Space Complexity: DFS algorithm needs to store only single path from the
root node, hence space complexity of DFS is equivalent to the size of the
fringe set, which is O(bm).
Depth-Limited Search Algorithm
Completeness:
● This algorithm is complete is if the branching factor is finite.
Time Complexity:
● Let's suppose b is the branching factor and depth is d then the worst-case time
complexity is O(bd).
Space Complexity:
● The space complexity of IDDFS will be O(bd).
Optimal:
● IDDFS algorithm is optimal if path cost is a non-decreasing function of the
depth of the node.
Bidirectional Search Algorithm
● Bidirectional search replaces one single search graph with two small
subgraphs in which one starts the search from an initial vertex and other
starts from goal vertex. The search stops when these two graphs intersect
each other.
● Bidirectional search can use search techniques such as BFS, DFS, DLS, etc.
Advantages
● The graph can be extremely helpful when it is very large in size and there is
no way to make it smaller. In such cases, using this tool becomes particularly
useful.
● The cost of expanding nodes can be high in certain cases. In such scenarios,
using this approach can help reduce the number of nodes that need to be
expanded.
Disadvantages
● Finding an efficient way to check if a match exists between search trees can
be tricky, which can increase the time it takes to complete the task.
Bidirectional Search Algorithm
▪This algorithm divides one graph/tree
into two sub-graphs.
▪ It starts traversing from node 1 in
the forward direction and starts from
goal node 16 in the backward
direction.
▪The algorithm terminates at node 9
where two searches meet.
Bidirectional Search Algorithm
Completeness: Bidirectional Search is complete if we use BFS in both
searches.