0% found this document useful (0 votes)
23 views

Class 4

The document discusses search algorithms in artificial intelligence, focusing on their role in problem-solving for rational agents. It outlines key concepts such as state space, search trees, and properties of search algorithms, and categorizes them into uninformed and informed searches. Additionally, it details the Breadth First Search algorithm, including its advantages, disadvantages, and various applications.

Uploaded by

Shreya Terwad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Class 4

The document discusses search algorithms in artificial intelligence, focusing on their role in problem-solving for rational agents. It outlines key concepts such as state space, search trees, and properties of search algorithms, and categorizes them into uninformed and informed searches. Additionally, it details the Breadth First Search algorithm, including its advantages, disadvantages, and various applications.

Uploaded by

Shreya Terwad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 13

Search Algorithms

Search Algorithms in Artificial Intelligence

Artificial Intelligence is the study of building agents that act rationally. Most of the time,
these agents perform some kind of search algorithm in the background in order to achieve
their tasks.
Search techniques are universal problem-solving methods. Rational agents or Problem-
solving agents in AI mostly used these search strategies or algorithms to solve a specific
problem and provide the best result. Problem-solving agents are the goal-based agents and
use atomic representation. In this topic, we will learn various problem-solving search
algorithms.

A search problem consists of:


• A State Space. Set of all possible states where you can be.
• A Start State. The state from where the search begins.
• A Goal Test. A function that looks at the current state returns whether or not it is the
goal state.
•The Solution to a search problem is a sequence of actions, called the plan that transforms
the start state to the goal state. This plan is achieved through search algorithms.
Search Algorithm Terminologies:
Search: Searching is a step by step procedure to solve a search-problem in a given search
space. A search problem can have three main factors:
 Search Space: Search space represents a set of possible solutions, which a system may
have.
 Start State: It is a state from where agent begins the search.
 Goal test: It is a function which observe the current state and returns whether the goal
state is achieved or not.
Search tree: A tree representation of search problem is called Search tree. The root of the
search tree is the root node which is corresponding to the initial state.
Actions: It gives the description of all the available actions to the agent.
Transition model: A description of what each action do, can be represented as a transition
model.
Path Cost: It is a function which assigns a numeric cost to each path.
Solution: It is an action sequence which leads from the start node to the goal node.
Optimal Solution: If a solution has the lowest cost among all solutions.
Properties of Search Algorithms:
Following are the four essential properties of search algorithms to compare the
efficiency of these algorithms:
Completeness: A search algorithm is said to be complete if it guarantees to return a
solution if at least any solution exists for any random input.
Optimality: If a solution found for an algorithm is guaranteed to be the best solution
(lowest path cost) among all other solutions, then such a solution for is said to be an
optimal solution.
Time Complexity: Time complexity is a measure of time for an algorithm to complete
its task.
Space Complexity: It is the maximum storage space required at any point during the
search, as the complexity of the problem.
Types of search algorithms:
There are far too many powerful search algorithms out there to fit in a single article. Instead,
this article will discuss six of the fundamental search algorithms, divided into two categories, as
shown below.
Uninformed/Blind Search:
The uninformed search does not contain any domain knowledge such as closeness, the
location of the goal. It operates in a brute-force way as it only includes information about
how to traverse the tree and how to identify leaf and goal nodes. Uninformed search
applies a way in which search tree is searched without any information about the search
space like initial state operators and test for the goal, so it is also called blind search. It
examines each node of the tree until it achieves the goal node.
It can be divided into five main types:
Breadth-first search
Uniform cost search
Depth-first search
Iterative deepening depth-first search
Bidirectional Search
Informed Search (Heuristic search)
Informed search algorithms use domain knowledge. In an informed search, problem
information is available which can guide the search. Informed search strategies can
find a solution more efficiently than an uninformed search strategy. Informed search is
also called a Heuristic search.
A heuristic is a way which might not always be guaranteed for best solutions but
guaranteed to find a good solution in reasonable time.
Informed search can solve much complex problem which could not be solved in
another way.
An example of informed search algorithms is a traveling salesman problem.
Greedy Search
A* Search
A0* algorithm
Problem reduction
Hill climbing
Breadth First Search Algorithm
Breadth First Search Algorithm
Breadth first search algorithm is an algorithm used to find the shortest path from one
node to another in a graph. It begins by searching through the nodes closest to the
starting node, and then expands outward to the more distant nodes. The algorithm is
often used in tree traversal and network routing algorithms.

Working of Breadth First Search Algorithm


The breadth first search algorithm is a method used to traverse a tree or graph. In this
algorithm, the nodes are visited in the order of their distance from the root node. The root
node is expanded first, then the immediate child nodes of the root node are expanded,
and so on. This process continues until all the nodes in the tree or graph have been
visited.
The main advantage of the breadth first search algorithm is that it is simple to implement
and can be easily understood. Moreover, this algorithm can be used to find the shortest
path between two nodes in a graph.
Advantages of Breadth First Search Algorithm

There are many advantages to using the Breadth First Search algorithm:

The main advantage is that it is very simple to implement and understand.


It is guaranteed to find the shortest path from the starting point to the goal.
Breadth First Search tends to find paths with fewer steps than other algorithms, such
as Depth First Search.
Breadth First Search can be easily parallelized, which means that it can take advantage
of multiple processors to speed up the search.
Disadvantages of Breadth First Search Algorithm

There are a few disadvantages to the Breadth First Search algorithm:

It can be very memory intensive since it needs to keep track of all the nodes in the
search tree.
It can be slow since it expands all the nodes at each level before moving on to the next
level.
It can sometimes find sub-optimal solutions since it doesn’t explore all possible paths
through the search tree.
Applications of Breadth First Search Algorithm

The breadth first search algorithm is a powerful tool that can be used to solve various
problems. In this article, we will explore some of the potential applications of this
algorithm.

1. Graph traversal: Breadth first search can be used to traverse a graph. This can be useful
for tasks such as finding the shortest path between two nodes or determining if a graph is
connected.
2. Network routing: Breadth first search can be used to find the shortest path between two
nodes in a network. This can be useful for tasks such as routing traffic or finding the
quickest route between two points.
3. Pattern matching: Breadth first search can be used to match patterns in data. This can be
useful for tasks such as searching for a specific string in a text file or finding all instances of a
particular word in a document.
4. Data mining: Breadth first search can be used to mine data for insights. This can be useful
for tasks such as finding trends in social media data or uncovering hidden relationships in
large datasets.

You might also like