You are on page 1of 5

Search Algorithms in Artificial Intelligence

One of the most significant aspects of Artificial Intelligence is search algorithms. Searching is a
strategy for solving a search issue in a given search space in a step-by-step manner.

A search problem can have three major components:

 A State Space. The set of all conceivable states in which you may be.
 A Start State. The location where the search begins.
 A Goal Test. A function that examines the current state returns whether it is the desired
state or not.

Search Algorithm Properties

 Completeness: A search algorithm is said to be complete if it delivers a solution for any


input if at least one solution exists for that input.
 Optimality: If the algorithm's solution is the best solution, i.e. it has the lowest route
cost, that solution is deemed the optimum solution.
 Time and Space Complexity: Time complexity refers to the amount of time it takes an
algorithm to perform its work, while space complexity refers to the amount of storage
space required throughout the search process.

Types of search algorithms:


There are two types of search algorithms based on the search difficulties.

1. Uninformed/Blind Search.
2. Informed Search.

1. Uninformed/Blind Search:

An uninformed search lacks domain knowledge such as proximity and goal location. It
functions in a brute-force manner since it only has information on how to traverse the
tree and find leaf and target nodes. Uninformed search uses a method in which the
search tree is searched without any knowledge about the search space, such as initial
state operators and tests for the objective, and is also known as blind search. It goes
through each node of the tree until it reaches the desired node.

It is classified into five major types:

1. Breadth-first search
2. Uniform cost search
3. Depth-first search
4. Iterative deepening depth-first search
5. Bidirectional Search

 Breadth-first Search:

The most frequent search for traversing a tree or graph is BFS. This algorithm looks forIt
is termed breadthwise in a tree or graph. breadth first search. In BFS, the search begins
with the root node and progresses from there.Before progressing to the following level,
all successors mustThe current level's node is expanding.It exemplifies a general-graph
search.algorithm.It use the queue data structure.

 Depth-first Search:

Depth-first search is a recursive technique for exploring a data structure such as a tree
or graph.The depth-first search is so named because it begins at the root node and
follows each path to its maximum depth node before going on to the next path.DFS's
implementation makes use of a stack data structure.The DFS algorithm's procedure is
similar to the BFS algorithm's.
Backtracking is an algorithm approach that uses recursion to locate all feasible solutions.
Advantage.DFS utilises extremely little memory since it merely stores a stack of nodes
on the route from the root node to the current node.It takes less time than the BFS
method to reach the objective node.

 Depth-Limited Search Algorithm:

It can address the endless route problem in the Depth-first search. • The node at the depth
limit will be considered as if it has no successor.nodes further.A depth-limited search algorithm
is similar to a depth-first search but with a fixed limit. Depth-limited search can overcome the
disadvantage of the endless path in Depth-first search. In this approach, the node at the depth
limit is treated as if it had no additional successor nodes.A depth-limited search can be ended
by one of two failure conditions:

 The standard failure value implies that the problem has no solution.
 Cutoff failure value: It indicates that there is no solution to the problem within a
particular depth limit.

 .Uniform-cost Search Algorithm:

In this algorithm at every state the path with the least cost is selected. A searching algorithm
for traversing a weighted tree or graph is uniform-cost search. When a separate cost is
provided for each edge, this method is used. The uniform-cost search's main purpose is to
discover the shortest path to the goal node with the lowest cumulative cost. Uniform-cost
search grows nodes from the root node based on their path costs. It may be used to solve any
graph or tree in which the best cost is required. The priority queue employs a uniform-cost
search method. It gives the lowest total cost the highest priority. If the route cost of all edges is
the same, uniform cost search is comparable to BFS algorithm.

1. Informed Search Algorithms

The informed search algorithm is more useful for large search space. Because the
informed search algorithm is based on the concept of heuristics, it is also known as
heuristic search.Heuristics function: A heuristic is a function that identifies the most
promising path in Informed Search. It takes the agent's current state as input and
outputs an estimate of how near the agent is to the objective. The heuristic technique,
on the other hand, may not always provide the optimum answer, but it guarantees that
a decent solution will be found in a fair amount of time. A heuristic function determines
how near a state is to the desired outcome. It determines the cost of an ideal path
between two states and is represented by h(n). The heuristic function's value is always
positive.
The heuristic function's admissibility is provided as:
h(n) <= h*(n)
Here h(n) is heuristic cost, and h*(n) is the estimated cost. Hence heuristic cost should
be less than or equal to the estimated cost.

It is mainly of two types:


 Greedy Best First Search
 A* Search

 Greedy Best First Search


In this algorithm the nearest node to the goal node is expanded in this approach. The
heuristic function h is used to compute the proximity factor (x). When f (n) = h, the
node is enlarged or explored (n). The priority queue is used to implement this
technique. It isn't the best algorithm. It is prone to become trapped in loops. Expand
the node closest to the goal state, i.e. expand the node with a lower h value. The greedy
best first algorithm is implemented by the priority queue.

 A* Search:
A* search is a hybrid of greedy and uniform cost search methods. The overall cost
(heuristic) in this algorithm is equal to the sum of the costs of uniform cost search (g(x)) and
greedsearch (h) (x).

f (x) = g (x) + h (x)

g(x) represents the backward cost, which is the total cost from the root node to the current
node, and h(x) represents the forward cost, which is an estimate of the distance between the
destination node and the current node.

You might also like