You are on page 1of 18

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/364921310

Comparative Analysis of Search Algorithms in AI

Research · October 2022


DOI: 10.13140/RG.2.2.29282.61123

CITATION READS
1 1,469

3 authors, including:

Ayesha Shafique Ayesha Islam Qadri


University of Engineering and Technology, Lahore University of Engineering and Technology, Lahore
1 PUBLICATION 1 CITATION 1 PUBLICATION 1 CITATION

SEE PROFILE SEE PROFILE

All content following this page was uploaded by Ayesha Shafique on 30 October 2022.

The user has requested enhancement of the downloaded file.


Comparative Analysis of Search Algorithms in AI
Ayesha Shafique Fatima Sohail Shaukat Ayesha Islam Qadri
B. Sc Computer Engineering B. Sc Computer Engineering B. Sc Computer Engineering
Student At Student At Student At
University of Engineering University of Engineering University of Engineering
and Technology, Lahore and Technology, Lahore and Technology, Lahore
Pakistan Pakistan Pakistan

Abstract:

Solving a problem entail seeking the best solution among those available. In computer science and artificial
intelligence, finding a solution to a problem is prevalently thought of as a process of searching through space for
possible solutions. In Engineering and Mathematics, on the other hand, it is thought of as an optimization process,
determining the most effective or optimal solution to a problem. These narrow the search space and increase its
efficiency. It chooses which has the least futility at each step of the search. In this paper, we classify the various
AI search and optimization techniques based on their pros and cons. To make it easier to select a technique for a
specific problem.

Keywords: Artificial Intelligence, Complexity, Optimization, Searching, Informed Search, Uniformed


Search.

1. INTRODUCTION
Artificial intelligence is the intelligence of machines
and the branch of computer sciences that aims to create
it. Many authors have different perceptions of AI like.
i. It is the science and engineering of making
intelligent machines, especially intelligent computer
programs. It is related to the similar task of using
computers to understand human intelligence, but AI
does not have to confine itself to methods that are
biologically observable [1].
Figure 1 Artificial Intelligence Trends
ii. The study and design of intelligence agents [2].
Where an intelligent agent is a system that perceives 1.1 Search and Artificial Intelligence:
its environment and takes action that maximizes its
chances of success [3]. The last 50 years of research witnessed the
iii. As a system that thinks like humans: - This is the development of a large number of AI tools for solving
exciting new effort to make computers think --- the most difficult problems in computer science and
machines with minds, in the full and literal sense. The engineering. These tools are; Search and optimization,
automation of activities that we associate with human Logic, Probabilistic methods for uncertain reasoning,
thinking, activities such as decision-making, problem- Classifiers and statistical learning methods, Neural
solving, and learning --- [4]. networks, Control theory, and, Languages.
iv. As a system that acts like a human: - This is the act Search algorithms are being used for a multitude of AI
of creating machines that perform functions that tasks, one of which is pathfinding. The field of search
require intelligence when performed by people. Also, in AI is closely connected to real-world problem-
it is the study of how to make computers do things at solving. AI has researched search methods for solving
which at the moment, people are better [5]. path-planning problems in large domains. After
v. As a system that thinks rationally: - this is the study formulating problems, we must solve them, which is
of mental faculties, through the use of computational accomplished by searching through the state space
models [6]. during this process.

1|Page
2.2 AI-Powered Search:

Figure 1.1 Types of Nodes in Searching

The majority of research on search methods has


focused on how to solve one-shot path planning
problems. Since search is mostly a repetitive process,
many AI systems re-plan from scratch to solve the path
planning problem on their own. The engineers are
required to design new, better, more efficient, less
complex, and less expensive systems as well as to
devise plans and procedures for the improved
operation of existing systems in both industrial and the
scientific world. [5].

2. PLACE OF SEARCH IN AI Figure 2.1.2 AI-Powered Search Components

2.1 Definition Of Search in AI: 2.2 Classification Of Searching


Techniques:
This is a central concept in artificial intelligence. It is
inherent to artificial intelligence problem-solving
techniques. Fundamentally, artificial intelligence
problems are inherently complex. Attempting to solve
problems that humans handle by applying innate
cognitive abilities, pattern recognition, etc using
computers invariably must turn to considerations of
search [4].
Figure 2.2.1 Romania Map Problem with cost in km

All search techniques can be found to belong to one of


two categories of search methods which are:
2.2.1 Uniformed (Blind) Search Method:
An uninformed Search is a blind search or brute force
search which includes search techniques such as
Breadth First Search, Depth First Search, Depth-
limited search, Iterative Deepening, Uniform Cost
Search, and Bidirectional Search. An uninformed the
search does not contain any information about the
number of steps to reach the current state to the goal
Figure 2.1.1 Cluster of Nodes state. The uninformed search will consider the path,

2|Page
which is most promising at that moment, it will not The uninformed and informed search strategies which
consider the optimum path to reach the goal. are considered in this research paper has evaluated
based on the following four criteria: completeness,
2.2.2 Heuristic or Informed Search Method:
optimality, time complexity, and space complexity.
Informed search is the Heuristic search that uses a
heuristic function (To estimate how close a given state Completeness: This property intends to check
is from the goal state) to solve a problem. The whether the algorithm guarantees to find the solution
informed search uses to generate and test the approach. to the problem if any exists.
It includes hill climbing, A*, AO*, Best First Search, Optimality: This property investigates whether or not
and Greedy Best First Search algorithms. An informed the strategy provides the optimal solution.
search is more efficient than an uninformed search. In
informed search heuristic function is used as a model Time complexity: This property evaluates the time
that will lead us to the goal state. The informed search required to find the solution to the problem.
will not traverse the search tree blindly. It will
consider the next node to traverse based on some Space complexity: This property evaluates the
evaluation function (Heuristic Function) to reach the memory, and space required to run the search
goal state from the current state. algorithm.

Key terms being used in evaluation and their


description are given below

 b -> branching factor


 d -> depth of the shallowest solution
 m -> max. depth of search tree
 l -> depth limit
 a -> complete if b is finite
 b -> complete if step cost >=E for E>0
 c -> optimal if step costs are same
Figure 2.2.2 Eight puzzle search tree fragment  d -> if both directions use BFS

2.3 Evaluation Criteria


3. UNIFORMED SEARCH
ALGORITHMS
3.1 Breath First Search
Breadth-first search expands nodes in order of their
depth from the root, generating one level of the tree at
a time until a solution is found. It is most easily
implemented by maintaining a first-in-first-out queue
of nodes, initially containing just the root, and always
removing the node at the head of the queue, expanding
it, and adding its children to the tail of the queue. Since
it never generates a node in the tree until all the nodes
at shallower levels have been generated, breadth-first
search always finds the shortest path to a goal. Since
each node can be generated in constant time, the
amount of time used by the breadth-first search is
proportional to the number of nodes generated, which
is a function of the branching factor b and the solution
depth d. Since the number of nodes in a uniform tree
at level d is bd , the total number of nodes generated in
the worst case is b+b2+b3+· · ·+bd, which is O(bd), the
Figure 2.3 Evaluation Criteria four Components asymptotic time complexity of the breadth-first
search.

3|Page
3.1.1 Implementation 3.1.5 Evaluation of Algorithm
The breadth-first search has the following properties:

Figure 3.1.1 Graphical representation of breadth-first


search

3.1.2 Advantages
The breadth-first search always finds a solution to the
problem if any exists. If the problem has more than one
solution, then the algorithm finds the solutions in
ascending order of their costs which means that the
cheapest solution will be found first. Since this search
strategy is traversal, a situation where the algorithm Figure 3.1.2 Evaluation of Breath First Search
will explore a branch that is indefinitely deep can
never occur. 3.2 Depth First Search
3.1.3 Disadvantages Depth-first search removes the space limitation of
breadth-first and uniform-cost search by always
The main drawback of breadth-first search is its
generating next a child of the deepest unexpanded
memory requirement. Since each level of the tree must
be stored to generate the next level, and the amount of node. BFS and DFS - Both algorithms can be
memory is proportional to the number of nodes stored, implemented using a list of unexpanded nodes, with
the space complexity of the breadth-first search is also the difference that breadth-first search manages the list
O(bd). As a result, breadth-first search is severely as a first-in-first-out queue, whereas depth-first search
space-bound in practice and will exhaust the memory treats the list as a last-in-first-out stack. More
available on typical computers in a matter of minutes. commonly, depth-first search is implemented
recursively, with the recursion stack taking the place
3.1.4 Applications & Limitations
of an explicit node stack.
Breadth First Search is used for:
3.2.1 Implementation:
 For unweighted graph minimum spanning
tree and shortest path.
 Shared network.
 Social Networking Websites.
 Global Positioning System Navigation
systems.
 For testing whether the graph is bipartite or
not.

Breadth First Search is applicable when:

 You need to discover the solution to the


problem containing the least curves.
 Few solutions may exist, and at least one has
Figure 3.2.1 Graphical representation of depth-first search
a short path length.
 Memory is not an issue.

4|Page
3.2.2 Advantages:
The advantage of depth-first search is that its space
requirement is only linear in the maximum search
depth, as opposed to exponential for breadth-first
search. The reason is that the algorithm only needs to
store a stack of nodes on the path from the root to the
current node. The time complexity of a depth-first
search to depth d is O(bd) since it generates the same
set of nodes as a breadth-first search, but simply in a
different order. Thus, as a practical matter, depth-first
search is time-limited rather than space-limited.
3.2.3 Disadvantage:
The primary disadvantage of the depth-first search is
that it may not terminate on an infinite tree, but simply
go down the left-most path forever. For example, even
though there are a finite number of states in the eight-
game puzzle, the tree fragment shown in Figure 2.1
can be infinitely extended down any path, generating
an infinite number of duplicate nodes representing the Figure 3.2.2 Evaluation of Depth First Search
same states. The usual solution to this problem is to
impose a cutoff depth on the search. Although the
3.3 Depth Limited Search
ideal cutoff is the solution depth d, this value is rarely Depth-first search removes the space limitation of
known in advance of actually solving the problem. If breadth-first and uniform-cost search by always
the chosen cutoff depth is less than d, the algorithm generating next a child of the deepest unexpanded
will fail to find a solution, whereas if the cutoff depth node. Both algorithms can be implemented using a list
is greater than d, a large price is paid in execution time, of unexpanded nodes, with the difference that breadth-
and the first solution found may not be an optimal one. first search manages the list as a first-in-first-out
queue, whereas depth-first search treats the list as a
3.2.4 Applications & Limitations last-in-first-out stack. More commonly, depth-first
search is implemented recursively, with the recursion
Depth First Search is used for: stack taking the place of an explicit node stack.
 Identifying loops in a graph. 3.3.1 Implementation
 Identifying components that are strongly
connected in a graph.
 Finding the solution to the puzzle in which
only one solution exists.

Depth First Search is applicable when:

 Memory is limited.
 The order of the neighbors of a node added to
the stack can be tuned so that solutions are
found on the first attempt.
 It is a poor technique when it is conceivable
to get captured in endless ways, this happens
when the graph is endless or at the point when
there are cycles in the graph.

3.2.5 Evaluation of Algorithm: Figure 3.3.1 Graphical representation of depth-limited


search.
Depth-first search has the following properties:

5|Page
3.3.2 Advantages 3.2 Iterative Deepening Search
Depth-limited search is more efficient than Depth First This search method is also known as iterative
search, using less time and memory. If a solution deepening depth-first search. The method is a
exists, the Depth First search guarantees that it will be combination of two search techniques: the breadth-
found in a finite amount of time. To address the first search and the depth-first search. The limit of the
drawbacks of the Depth First search, we set a depth depth is changed iteratively to best fit the problem
limit and run our search technique repeatedly through definition and the goal sought.
the search tree.
3.4.1 Implementation:
3.3.3 Disadvantages
For this method to work, it must have a depth limit. If
the target node does not exist inside the chosen depth
limit, the user will be forced to iterate again, increasing
execution time. If the goal node does not exist within
the specified limit, it will not be discovered.

3.3.4 Applications & Limitation


Depth-limited search is used for

 When you choose d as the depth limit and you


know that the solution lies within that depth
limit.
 Game theory.

Depth-limited search can be terminated with two


Conditions of failure:

 Standard failure value: It indicates that the


problem does not have any solution.
 Cutoff failure value: It defines no solution for
the problem within a given depth limit.

3.3.5 Evaluation of Algorithm


Depth-limited search has the following properties:

Figure 3.4.1 Graphical representation of iterative


deepening search

3.4.2 Advantages
When the solutions are found at the lower depths say
n, then the algorithm proves to be efficient and in time.
The great advantage of iterative deepening depth-first
search is found in-game tree searching where the
iterative deepening depth-first search operation tries to
improve the depth definition, heuristics, and scores of
searching nodes so as to enable efficiency in the search
algorithm. Another major advantage of the iterative
deepening depth-first search is its quick
responsiveness.

3.4.3 Disadvantages

Figure 3.3.2 Evaluation of Depth Limited Search The time taken is exponential to reach the goal node.
The main problem with iterative deepening depth-first

6|Page
search is the time and wasted calculations that take from the root, uniform-cost search expands nodes in
place at each depth. The situation is not as bad as we order of their cost from the root. At each step, the next
may think of especially when the branching factor is node n to be expanded is one whose cost g(n) is lowest,
found to be high. When we are to find multiple where g(n) is the sum of the edge costs from the root
answers from the iterative deepening depth-first to node n. The nodes are stored in a priority queue.
search, it gives back the success nodes and its path This algorithm is similar to Dijkstra’s single-source
once even if it needs to be found again after multiple shortest-path algorithm.
iterations. To stop the depth bound is not increased
further. 3.5.1 Difference in UCS & Dijkstra
3.4.4 Applications & Limitation The main difference is that uniform-cost search runs
until a goal node is chosen for expansion, while
Iterative Deepening Search is used for:
Dijkstra’s algorithm runs until every node in a finite
 Artificial Intelligence and Data Science- graph is chosen for expansion. Whenever a node is
analyzing network chosen for expansion by uniform-cost search, the
 Puzzle-solving with a unique solution lowest-cost path to that node has been found. The
(example: sudoku) worst-case time complexity of the uniform-cost search
 Detecting cycle in a graph. is O(bc/e), where c is the cost of an optimal solution,
 Sorting Directed Acyclic Graph (DAG) and e is the minimum edge cost. Unfortunately, it also
 N- Queens problem suffers the same memory limitation as breadth-first
search.
Iterative deepening search is applicable when:
3.5.2 Implementation:
 BFS is valid

3.4.5 Evaluation of Algorithm


Iterative deepening search has the following
properties:

Figure 3.5.1 Graphical Representation of Uniform Cost


search

The uniform cost search steps are used as follows:


Initial step: {[𝑁1, 0]};
Step 1: {[𝑁1 𝑁2, 3], [𝑁1 𝑁5, 14]};
Step 2: {[𝑁1 𝑁2 𝑁3, 8], [𝑁1 𝑁2 𝑁4, 6],
[𝑁1 𝑁5, 14]};
Step 3: {[𝑁1 𝑁2 𝑁3 𝑁5, 13], [𝑁1 𝑁2
𝑁4 𝑁5, 10], [𝑁1 𝑁5, 14]};
Step 4 (Final result): The shortest path from node 𝑁1
to node 𝑁5 is defined as
Figure 3.4.2 Evaluation of Iterative Deepening Search 𝑁1 𝑁2 𝑁4 𝑁5
3.5 Uniform Cost Search 3.5.3 Advantages
If all edges do not have the same cost, then the breadth- It will help you find the path with the most reduced
first search generalizes to a uniform-cost search. cumulative cost in a weighted graph having a different
Instead of expanding nodes in order of their depth cost associated with each of its edges from the start

7|Page
node to the end node. Due to the least path being 3.6 Bidirectional Search
followed at each state, It is considered an optimal
solution.

3.5.4 Disadvantages
You are required to keep the empty list sorted as
priorities in the priority queue need to be protected.
The storage requirement is hilariously large. You are
to stop it from going on an infinite loop as it considers
every possible path going from the start node to the
end node. Figure 3.6 Semantic View of Bidirectional
Search
3.5.5 Applications & Limitations
Uniform Cost Search is used for: In this method, the search has a running technique in
two directions. Indeed, two searches run
 Solving Maze problem. simultaneously. One of them is done in a forward
 Pathfinding. direction from the initial state, and another one is done
backward from the goal state. The aim is that these
Uniform Cost Search is applicable when: two searches should join midway. The motivation for
implementing such a search method is the following:
 Space requirement is less. if a search algorithm requires a complexity of “bd” to
 Intelligence is not required or when reach the goal, splitting it into two sub-algorithms will
evaluation function (Heuristic function) is require “bd/2 + bd/2” of complexity which is
not required. significantly less than “bd”, especially when the values
3.5.6 Evaluation of Algorithm of b and d increase. The goal is used as the starting
state of the backward search. Therefore, the goal test
Uniform Cost Search Algorithm has the following is replaced by a flag with the rule to check whether two
properties: searches have expanded up to their intersection point.
Although the bidirectional search seems to be good in
terms of complexity, difficulties occur in
implementing the backward search.

3.6.1 Implementation

Figure 3.6.1 Graphical representation of bidirectional


search

3.6.2 Advantages
For instance, for the branching factor b = 8 and depth
d = 4, the breadth-first search needs time which is
proportional to 84 = 4096 whereas the bidirectional
search is more effective because of time which is
Figure 3.5.2 Evaluation of Uniform Cost Search proportional to 2*82 = 128 to reach the goal.

8|Page
3.6.3 Disadvantages to be chosen should have lowest value of the heuristic
function f (n) .
It is also to note that a bidirectional search is not
practical for use if the value of d is large. 4.1.1 Implementation
3.6.4 Evaluation of Algorithm
Bidirectional search has the following properties:

Figure 3.6.2 Evaluation of Bidirectional Search

4. INFORMED SEARCH Figure 4.1.1 Graphical representation of best first search


ALGORITHMS
4.1 Best First Search
4.1.2 Advantages
The best first search is a searching algorithm which
works on the set of defined rules. It uses the concept Best-first search allows us to take the advantages of
of a priority queue and evaluation function. In artificial both algorithms, bfd and dfs. With the help of best-
intelligence, the best first search algorithm is used for first search, at each step we can choose the most
finding the shortest path from a given starting node to promising node.
a goal node in a graph. The algorithm works by 4.1.3 Disadvantages
expanding the nodes of the graph in order of increasing
the distance from the starting node until the goal node There are chances of getting stuck in a loop.
is reached. Sometimes, it covers more distance than our
consideration (worst case scenario). It should be also
Best-first search is created by combining breadth-first noted that the heuristic function can sometimes lead to
and depth-first search techniques. Because of this the costly path.
reason the best-first search gets the advantages of both
breadth-first and depth-first search techniques. The 4.1.4 Applications & Limitation
best-first search does not consider all the possible
Best First Search is used in:
paths in graph, and this strategy finds the path which
has no loop. In best-first search the evaluation  Games.
function f (n) is used for each node to find out the  Web crawlers.
desirability of a node; so the most promising and
desirable unexpanded node is expanded. So the node Best First Search is not reliable as:

9|Page
 It can behave as an unguided depth-first
search in the worst-case scenario.
 This algorithm is not optimal.

4.1.5 Evaluation of Algorithm


Best First Search algorithm has the following
properties:

Figure 4.1.2 Evaluation of Best First Search


Figure 4.2.2 Steps of nodes’ expansion in digraph for the
greedy best-first search
4.2 Greedy Best First Search
Greedy Best First Search is a special case of Best First 4.2.2 Advantages
Search algorithm. In comparison with the best-first It always takes the path which appears best at the
search where the evaluation function f (n) is used, the moment. It is useful only for the best case.
greedy best-first search uses the heuristic function h(n)
and heuristic values to try to obtain the best solution 4.2.3 Disadvantages
of the problem. It targets the goal by trying to expand It is a recursive algorithm hence; it can get stuck in an
the closest node to the goal. infinite loop if it’s not implemented carefully. The
4.2.5 Implementation problem with greedy best-first search is that it’s short-
sighted. Greedy best-first search only maximizes the
short-term advantage which may not be the best in
long-term.

4.2.4 Applications & Limitations


Best First Search is used:

 If the search space is finite, then, similar to


DFS, greedy best-first search can
be complete.

Best First Search is not reliable as:

 In worst case, the time complexity of greedy


Figure 4.2.1 Graphical representation of greedy best first best-first search is , same to DFS
search
 Not Optimal

10 | P a g e
4.2.5 Evaluation of Algorithm 4.3.2 Advantages
It potentially reduces the computation and hence, the
time of search. The memory consumption of beam
search is far less than other search algorithms.

4.3.3 Disadvantages
The search may not result in an optimal goal and may
not result in a goal at all. It’s biggest disadvantage is
that it has potential to be incomplete.

4.3.4 Applications & limitations


Beam Search is used as below:

 A beam search is most often used to maintain


tractability in large systems with insufficient
memory to store the entire search tree. For
example.
 It has been used in many machine
translation systems.

Beam Search has following drawbacks:

 The search may not result in an optimal goal


and may not even reach a goal at all after
Figure 4.2.3 Evaluation of Greedy Best First Search given unlimited time and memory when there
is a path from the start node to the goal node.
4.3 Beam Search
4.3.5 Evaluation of Algorithm
Beam search is a heuristic search algorithm that
explores a graph by expanding the most optimistic
node in a limited set. It progresses level by level and
moves downwards only from the best nodes at each
level. Beam search uses breadth-first search to build
its search tree.

4.3.1 Implementation

Figure 4.3.2 Evaluation of Beam Search

4.4 Dijkstra’s Algorithm


Dijkstra's algorithm is an algorithm that finds the
Figure 4.3.1 Graphical Representation of Beam Search shortest path between two nodes in undirected graph
with non-negative edge weights. This algorithm uses

11 | P a g e
the weights of the edges to find the path that minimizes 4.4.5 Evaluation of Algorithm
the total distance (weight) between the source node
and all other nodes. It expands outwards from the
starting point until it reaches the goal.

4.4.1 Implementation

Figure 4.4.1 Graphical Representation of Dijkstra's


Algorithm for the shortest path

4.4.2 Advantages Figure 4.4.2 Evaluation of Dijkstra Algorithm

The main advantage of Dijkstra's algorithm is its 4.5 Hill Climbing Algorithm
considerably low complexity, which is almost linear.
It has an order of n2 so it is efficient enough to use for Hill climbing is a mathematical optimization
relatively large problems. technique in computer science that belongs to the local
search family. The Hill climbing algorithm is a local
4.4.3 Disadvantages search algorithm that moves in the direction of
It does a blind search there by consuming a lot of time increasing elevation/value to find the mountain's peak
waste of necessary resources. Another disadvantage is or the best solution to the problem. It ends when it
that it cannot handle negative edges. This leads to reaches a maximum value for which no neighbor has
acyclic graphs and most often cannot obtain the right a higher value. A node in a hill climbing algorithm has
shortest route. two components: state and value. When a good
heuristic is available, hill climbing is commonly used.
4.4.4 Applications & Limitations We don't need to maintain and handle the search tree
or graph in this algorithm because it only keeps a
Dijkstra’s Algorithm is used in:
single current state. It does not retrace the search space
 It is used in finding Shortest Path. because it does not remember previous states.
 It is used in geographical Maps.
Heuristic Function
 To find locations of Map which refers to
vertices of graph.
 Distance between the location refers to edges.
 It is used in IP routing to find Open shortest
Path First.

It’s not reliable in some as:

 It can't give proper result for the graphs Figure 4.5 Heuristic Function
having negative weighed edges.
 This leads to acyclic graphs and most often A heuristic function is one that ranks all possible
cannot obtain the right shortest path. alternatives based on the available information at any
branching step in the search algorithm. It assists the

12 | P a g e
algorithm in selecting the best route from among those pure optimization problems in which the goal is to find
available. the best state given the objective function.

4.5.1 Implementation 4.5.3 Disadvantages


State space Diagram: If hill climbing enters any of the following regions, it
will be unable to reach the optimal/best state (global
The state-space diagram depicts the set of states that maximum).
our search algorithm can reach in relation to the value
of our objective function (the function which we wish Local Maxima
to maximize).
At a local maximum, all neighboring states have
The X-axis represents the state space, or the possible values that are lower than the current state. Because
states or configurations for our algorithm. hill-climbing is greedy, it will not progress to the worst
state and terminate itself. Even if a better solution
The Y-axis represents the values of the objective exists, the process will come to an end.
function that correspond to a specific state.
Use the backtracking technique to solve the local
maximum problem. Keep track of the states you've
visited. If the search reaches an unfavorable point, it
can revert to the previous configuration and try again.

Plateau

All neighbors on the plateau have the same value. As


a result, choosing the best direction is impossible.

To break through a plateau, take a big leap. Choose a


state that is far from the current state at random. We
are likely to land in a non-plateau region.

Ridge
Figure 4.5.1 Graphical Representation of Hill Climbing
Algorithm Because movement is downward in all directions, any
point on a ridge can appear to be a peak. As a result,
Local maximum: It is a state that is better than its the algorithm terminates when it reaches this state.
neighboring state, but there is another state that is
better than it (global maximum). This state is To overcome Ridge, use two or more rules before
preferable because the objective function's value is testing. It implies moving in several directions at the
higher here than in its neighbors. same time.

Global Maxima: The best possible state in the state 4.5.4 Applications
space diagram is called the global maximum. This is Hill Climbing Algorithm is used in:
because the objective function has the highest value at
this stage.  Hill climbing is commonly used in robotics
to assist their systems in working as a team
Local maximum plateau/flat: It is a flat region of
and maintaining coordination.
state space in which adjacent states have the same
 The algorithm can be useful in team
value.
management in various marketing domains
Ridge: A region that is higher than its neighbors but where hill climbing can be used to find an
has a slope to it. It is a particular type of local optimal solution. This algorithm can be used
maximum. to optimise a sales member's travel time or
the places he visits per day.
4.5.2 Advantages
4.6 A* Algorithm
Hill climbing can be used in both continuous and
domain contexts. This method is extremely useful in The A* Search algorithm is one of the most effective
job shop scheduling, automatic programming, circuit and widely used techniques in pathfinding and graph
design, and vehicle routing. It is also useful in solving traversal. Informally, unlike other traversal
techniques, A* Search algorithms have "brains." It is

13 | P a g e
a smart algorithm, which distinguishes it from other which A* search is executed is highly dependent on
conventional algorithms. It is also worth noting that the accuracy of the heuristic algorithm used to
many games and web-based maps use this algorithm compute h(n). It does not always find the shortest path
to efficiently find the shortest path. This makes A* because it relies heavily on heuristics and
intelligent and puts it far ahead of traditional approximation. There are some complexity issues with
algorithms. The most well-known type of best-first the A* search algorithm. The main disadvantage of A*
search is A* search. It employs the heuristic function is its memory requirement, as it keeps all generated
h(n) and the cost to reach the node n from the initial nodes in memory, making it unsuitable for a variety of
state g(n). large-scale problems.

It combines UCS and greedy best-first search features 4.6.4 Applications & Limitations
to efficiently solve the problem. The heuristic function
A* Algorithm is used in:
is used by the A* search algorithm to find the shortest
path through the search space. This search algorithm  It is used to determine the shortest path. You
expands fewer search trees and returns optimal results can use this to find a path to the goal for each
more quickly. The A* algorithm is similar to the UCS enemy. One example is the extremely
algorithm except that it uses g(n)+h(n) instead of g(n), popular game Warcraft III.
and the sum of these two numbers is known as the  It can be used in map-based applications as a
fitness number. path-finding algorithm.
4.6.1 Implementation  This can also be used by string searching
applications to determine the goal state. NLP
We can use any data structure to implement open list uses this to check for parsing errors.
and closed list but for best performance, we use a set
data structure of C++ STL (implemented as Red-Black It’s not reliable in some as:
Tree) and a Boolean hash table for a closed list. The
 Despite being the best path finding algorithm
implementations are similar to Dijkstra’s algorithm
available, A* Search Algorithm does not
except we add in a heuristic. If we use a Fibonacci
always produce the shortest path because it
heap to implement the open list instead of a binary
heavily relies on heuristics / approximations
heap/self-balancing tree, then the performance will
to calculate - h
become better (as Fibonacci heap takes O (1) average
time to insert into open list and to decrease key). 4.6.5 Evaluation of Algorithm

Figure 4.6.1 Graphical Representation of A* Algorithm for


the shortest path between

4.6.2 Advantages
The A* search algorithm outperforms all other search
algorithms. The search algorithm A* is both optimal
and complete. This algorithm can resolve extremely
complex problems.

4.6.3 Disadvantages
If the branching factor is finite and every action has a Figure 4.6.2 Evaluation of A* Algorithm
fixed cost, this algorithm is complete. The speed with

14 | P a g e
4.6.1 8 Puzzle Game & A* The game principle is described as follows: there are 8
sliding tiles which are numbered by digits from 1 to 8
A* search technique is also used to solve the 8-puzzle
to be located in an array with three rows and three
game. This game was invented by Loyd in 1870. The
columns; the number 0 represents the empty cell
8-puzzle game is a well-known game used for the
(blank space), and any numbered tile can slide into an
evaluation and showcase of the power of Artificial
empty sell. It means that the digit 0 can simply be
Intelligence in general and search methods in
replaced by the void. The initial state is made by a
particular.
random positioning of the digits and the goal state is
usually defined in a way that the numbers from 1 to 8
can be read in ascending or descending order,
following a unique direction. The number of different
possible configurations the 8-puzzle game is equal to
9!=362880. The number of accessible state
configurations in 8-puzzle game is just half of 9!; in
other words 9!/2 is the number of solvable (reachable)
configurations in 8-puzzle sliding game.

The following assumptions, notations and operators


are used: Opr(Row, Column, Direction) with Row &
Column = {1,2,3}; Direction = {U,D,L,R}, where U,
D, L, and R represent Up, Down, Left, and Right,
respectively. Explicitly Opr stands for operator. The
row and column index values range from 1 to 3 (from
the set {1,2,3}). The following are the possible
directions: u = upper; d = down; l = left; r = right. As
summary, the operator ‘Opr(Row, Column,
Direction)’ has three parameters which are the row
index, the column index and the direction toward
which the located element is moved.

4.7 AO* Algorithm


The AO* algorithm performs best-first search. The
AND-OR graph concept is used by the AO*
algorithm to decompose any complex problem given
into a smaller set of problems that are then solved.
AND-OR graphs are specialized graphs that are used
in problems that can be broken down into
subproblems, where the AND side of the graph
represents a set of tasks that must be completed in
order to achieve the main goal, and the or side of the
graph represents the various ways in which tasks can
be completed in order to achieve the same main goal.

4.7.1 Implementation

Figure 4.6.3 Optimal solution of the 8-puzzle game for the


given initial and goal states Figure 4.7.1 Graphical Representation of AO* Algorithm

15 | P a g e
4.7.2 Advantages 4.8.1 Implementation
It is the best algorithm. If you traverse according to the To be honest, it doesn't really matter in terms of data
node ordering. It can be applied to both the OR and structures because the cost of managing the tree is
AND graphs. It is an easy-to-understand step-by-step negligible in comparison to the cost of everything else
representation of a solution to a given problem. An in a branch-and-bound algorithm, particularly in C++.
algorithm follows a specific procedure. It is not Only when solving 1-2 variable problems will you
dependent on any programming language, making it notice the cost of sorting or inserting nodes, and even
simple to understand even for those with no then, it will be very small.
programming experience. Each step in an algorithm
has its own logical sequence, making debugging
simple. Because the problem is broken down into
smaller pieces or steps by using an algorithm, it is
easier for a programmer to convert it into an actual
programme.

4.7.3 Disadvantages
Algorithms take time to develop. It is difficult to
demonstrate Branching and Looping in Algorithms.
Algorithms struggle to handle large tasks. It can't
always find the best path for unsolvable nodes. Its
complexity is greater than that of other algorithms.

4.7.4 Applications & Limitations


AO* Algorithm is used in:

 To my knowledge, AO* has rarely been used


in practical applications. It is useful for
searching game trees, problem solving, and
so on, but more domain specific search
algorithms (e.g., alpha-beta pruning for game
trees, general or domain specific planning
algorithms) are typically used instead.

It’s not reliable in some as:

 It can't always find the best path for


unsolvable nodes. Its complexity is greater Figure 4.8.1 Flowchart for Branch and Bound
than that of other algorithms.

4.8 Branch and Bound Technique


The branch and bound technique is one of the
problem-solving techniques. It is similar to
backtracking in that it uses the state space tree (A state
space tree is a tree in which the solution is built by
adding elements one by one, beginning at the root). It
is worth noting that the root contains no elements).
This method works best for combinatorial problems
with exponential time complexity because it provides
a more efficient solution. It is used to solve
optimization and minimization problems. If we are
given a maximization problem, we can convert it using
the Branch and bound technique by simply changing Figure 4.8.2 Graphical Representation of branch and
the problem to a maximization problem. bound technique

16 | P a g e
View publication stats

4.8.2 Advantages * Goal State: The desired resulting condition in a


given problem and the kind of search algorithm we are
In a branch and bound algorithm, we do not explore all
looking for.
of the nodes in the tree. As a result, the time
complexity of the branch and bound algorithm is lower * Goal Test: The test to determine whether a
when compared to other algorithms. The branch and particular state is a goal state.
bound algorithm seeks the shortest path to the best
solution for a given problem. It does not repeat nodes * Path/Step Cost: These are integers that represent
while traversing the tree. Finds the best solution (if the the cost to move from one node to another node.
problem is of limited size and enumeration can be * Space Complexity: A function describing the
done in reasonable time). Because it finds the shortest amount of space(memory) an algorithm takes in terms
path rather than the shortest successor, there should be of input to the algorithm.
no repetition.
* Time Complexity: A function describing the
4.8.3 Disadvantages amount of time the algorithm takes in terms of input to
The branch and bound algorithm take a long time to the algorithm.
complete. The number of nodes in the tree may be too
* Optimal: Extent of preference of the algorithm
large in the worst-case scenario, depending on the size
of the given problem. Parallelization of the Branch and * ‘b‘ – maximum branching factor in a tree.
Bound algorithm is difficult due to the load balancing
aspects. * ‘d‘ – the depth of the least-cost solution.

4.8.4 Applications & Limitations * ‘m‘ – maximum depth state space(maybe infinity)

Branch and Bound Algorithm is used in:


6. REFERENCES
 Applied computing. Enterprise computing.
[1] P. H. Winston, Artificial Intelligence. Reading,
 Computing methodologies. Artificial
Massachusetts: Addison-Wesley, 1984.
intelligence. Search methodologies.
[2] D. Poole, A. Mackworth and R. Goebel, Randy,
Heuristic function construction. Computational Intelligence: A logical Approach New
 Theory of computation. Design and analysis York: Oxford University Press, 1998.
of algorithms. Approximation algorithms [3] P. McCorduck, Machines Who Think, (2nd ed)
analysis. Natick, MA: A.K. Peters Ltd, 2004.
 The branch and bound approach is based on [4]. Ashwani chandel,Manu Sood,” Searching and
the idea that the total set of feasible solutions Optimization Techniques in Artificial Intelligence: A
can be divided into smaller subsets. These Comparative Study & Complexity
smaller subsets can then be systematically Analysis”,International Journal of Advanced Research
evaluated until the best solution is in Computer Engineering & Technology (IJARCET)
Volume 3 Issue 3, March 2014.
discovered.
[5] Retrieved on 7.10.2022 from http://i-
It’s not reliable in some as: rep.emu.edu.tr:8080/jspui/handle/11129/4714
[6] Retrieved on 4.10.2022 from
 The Branch and Bound algorithm is only https://dl.acm.org/doi/pdf/10.5555/1882723.1882745
applicable to small networks. In the case of [7] Retrieved on 5.10.2022 from
large networks, where the solution search https://www.researchgate.net/publication/333262471
space grows exponentially with network size, _Comparative_Analysis_of_Search_Algorithms
the approach becomes prohibitively [8] ] Retrieved on 5.10.2022 from
https://www.researchgate.net/publication/326039952
expensive.
_Search_In_Artificial_Intelligence_Problem_Solving
[9] Retrieved on 6.10.2022 from
5. COMMON TERMS USED https://editor.analyticsvidhya.com/uploads/20497Scre
enshot 2021-02-06 at 6.36.23 PM.png
* State: It provides all the information about the
environment.

17 | P a g e

You might also like