AI notes
AI notes
Problem-solving agents:
In Artificial Intelligence, 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.
1
o 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.
2
Types of search algorithms
Based on the search problems we can classify the search algorithms
into uninformed (Blind search) search and informed search
(Heuristic search) algorithms.
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.
3
o Breadth-first search
o Depth-first search
o Bidirectional Search
Informed 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.
1. Greedy Search
2. A* Search
1. Breadth-first Search:
o Breadth-first search is the most common search strategy for
traversing a tree or graph. This algorithm searches
breadthwise in a tree or graph, so it is called breadth-first
search.
4
o BFS algorithm starts searching from the root node of the tree
and expands all successor node at the current level before
moving to nodes of next level.
o BFS needs lots of time if the solution is far away from the
root node.
5
Example:
6
2. Depth-first Search
o Depth-first search is a recursive algorithm for traversing a
tree or graph data structure.
o With the help of this we can stores the route which is being
tracked in memory to save time as it only needs to keep one
at a particular time.
Disadvantage:
7
Example
Completeness: DFS search algorithm is complete within finite state space as it will
expand every node within a limited search tree.
Time Complexity: Time complexity of DFS will be equivalent to the node
traversed by the algorithm. It is given by:
T(n)= 1+ n2+ n3 +………+ nm=O(nm)
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).
Optimal: DFS search algorithm is non-optimal, as it may generate a large number
of steps or high cost to reach to the goal node.