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

Ai Lab Manual Exp

The document outlines various experiments focused on implementing and analyzing different search algorithms in artificial intelligence, including BFS, DFS, IDDFS, A*, and IDA*. Each experiment includes objectives, implementation steps, performance analysis, and post-lab questions to deepen understanding. The document emphasizes the strengths and weaknesses of each algorithm and their applications in problem-solving.

Uploaded by

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

Ai Lab Manual Exp

The document outlines various experiments focused on implementing and analyzing different search algorithms in artificial intelligence, including BFS, DFS, IDDFS, A*, and IDA*. Each experiment includes objectives, implementation steps, performance analysis, and post-lab questions to deepen understanding. The document emphasizes the strengths and weaknesses of each algorithm and their applications in problem-solving.

Uploaded by

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

EXP 1

One case study on AI Application published in IEEE/ACM/ springer or any


prominent journal.

1. Title
2. Objective
3. Tools Required
4. Background
5. Explain the procedure
6. What are the Expected Outcomes?
7. Conclusion

Post lab questions

1. What was the primary goal of the AI application discussed in the case
study?
2. Which deep learning models or algorithms were used in the case study,
and why were they chosen over other models?
3. Describe the dataset used in the case study. What are the key features of
the dataset, and what challenges might arise in working with such data?
4. What evaluation metrics did the researchers used to measure the
performance of their model, and why were they appropriate for the
problem?
5. What challenges might arise when deploying this AI solution in a real-
world environment?

EXP 2

Implementing BFS/DFS Search Algorithms to Reach Goal


Objective:

To implement and compare the Breadth-First Search (BFS) and Depth-First


Search (DFS) algorithms for finding a goal in a graph structure. The task is to
traverse a graph to reach a specific goal node using both search algorithms and
understand their differences in terms of implementation and performance.

Implementing BFS

Steps to Implement BFS:

1. Initialize a queue with the start node and an empty set to track visited
nodes.
2. While the queue is not empty:
a. Dequeue a node from the front of the queue.
b. If the node is the goal node, return the path to reach the goal.
c. Otherwise, enqueue all its unvisited neighbors.
3. Continue until the goal node is found or the queue is empty.

Implementing DFS

Steps to Implement DFS:

1. Initialize a stack with the start node and an empty set to track visited nodes.
2. While the stack is not empty:
a. Pop a node from the top of the stack.
b. If the node is the goal node, return the path to reach the goal.
c. Otherwise, push all its unvisited neighbors to the stack.
3. Continue until the goal node is found or the stack is empty.

Compare BFS AND DFS

Post lab questions


1. In your BFS implementation, why do we use a queue data structure? What
would happen if we used a stack instead?

2. You ran BFS and DFS on a graph to find the path to a goal. What do you
observe about the paths that both algorithms return in an unweighted graph?
Do they always return the same path, and if not, why?

3. In real-world applications, when would you use BFS over DFS and vice
versa? Can you think of an example where one algorithm would clearly
outperform the other in terms of efficiency or correctness?

4. After completing the lab, what aspects of BFS and DFS did you find most
difficult to understand or implement? How did you resolve those challenges?
5. What type of graph structure would you prefer for using BFS, and what
kind of graph would you prefer DFS for? Justify your answers.

CONCLUSION

EXP 3: Implementing IDDFS Search Algorithms to Reach Goal

IDDFS combines depth-first search’s space-efficiency and breadth-first


search’s fast search (for nodes closer to root). Artificial Intelligence
(AI) encompasses various search algorithms to solve problems
efficiently.
One such algorithm, Iterative Deepening Search (IDS) also known as
Iterative Deepening Depth-First Search (IDDFS), combines the
advantages of both Depth-First Search (DFS) and Breadth-First Search
(BFS). It is particularly useful in situations where the depth of the
solution is unknown.

Here’s a step-by-step breakdown of the algorithm:


1. Start at the Root Node: Begin the search from the root node (or
starting point).
2. Perform DFS with Depth Limit (L): In each iteration, perform a
DFS with a depth limit L.
3. Increment Depth: After each iteration, increment L by 1.
4. Repeat: Continue this process until the goal node is found or the
search space is exhausted.

Space Efficiency: IDDFS has a space complexity of O(bd), where


b is the branching factor and d is the depth of the deepest node.

Time Complexity: The time complexity is O(b^d) where b is the


branching factor, and d is the depth of the goal.

POST LAB QUESTIONS:


1. Explain the working of IDDFS. How does it combine the
features of DFS and BFS?
2. How does the depth limit affect the performance of the IDDFS
algorithm?
3. Compare the time and space complexities of IDDFS with BFS
and DFS.
4. Is IDDFS guaranteed to find the goal if it exists? Explain why
or why not.

CONCLUSION
EXP 4: IMPLEMENTING A* SEARCH ALGORITHM TO
REACH GOAL STATE

1. To understand the A* search algorithm and its components.


2. To implement the A* search algorithm to find the shortest path
from a start node to a goal node in a grid-based environment.
3. To analyze the algorithm's performance and output.

A Search Algorithm*
A* is a pathfinding algorithm that combines the advantages of
Dijkstra's algorithm (guaranteed shortest path) and Greedy Best-First
Search (efficiency). It uses a heuristic function to estimate the cost to
reach the goal, making it both optimal and efficient.

Heuristic Function
 The heuristic function h(n) must be admissible (never
overestimates the cost).

Post-Lab Questions

1. What happens if the heuristic function overestimates the cost to the


goal?
2. What is the time complexity of the A algorithm?*
3. How would you extend the A algorithm to handle multiple goals?*
4. What is the role of the heuristic function in the A algorithm?*
Conclusion:

EXP 5: Implement Iterative Deepening A* Algorithm (IDA*) Search Algorithm

Continually Deepening The depth-first search and A* search's greatest qualities


are combined in the heuristic search algorithm known as the A* algorithm
(IDA*). The shortest route between the start state and the objective state in a
network or tree is found using an optimum search method. The IDA* algorithm
uses less memory than the A* algorithm because it simply keeps track of the
present node and its associated cost, rather than the full search space that has been
examined. This article will examine the IDA* algorithm's operation, as well as its
benefits and drawbacks, and practical applications.

IDA* attempts to solve search problems with limited memory by


performing iterative deepening with a heuristic function. It uses a
cost function and a heuristic to guide the search towards the goal.

IDA Search Algorithm* works by:


1. Starting with a threshold based on the initial heuristic (h(start)) +
cost of start node.
2. Searching the graph using DFS, but limiting the search depth to
the current threshold.
3. If the search reaches a solution, it stops. If not, it increases the
threshold and repeats the process.
4. This process continues until the solution is found or the threshold
is sufficiently large to guarantee finding the solution.

Advantages
 Completeness: The IDA* method is a complete search algorithm,
which means that, if an optimum solution exists, it will be
discovered.
 Memory effectiveness: The IDA* method only keeps one path in
memory at a time, making it memory efficient.
 Flexibility: Depending on the application, the IDA* method may
be employed with a number of heuristic functions.
 Performance: The IDA* method sometimes outperforms other
search algorithms like uniform-cost search (UCS) or breadth-first
search (BFS) (UCS).
 The IDA* algorithm is incremental, which means that it may be
stopped at any time and continued at a later time without losing
any progress.
Disadvantages
 Ineffective for huge search areas. IDA* potential for being
incredibly ineffective for vast search spaces is one of its biggest
drawbacks. Since IDA* expands the same nodes using a depth-
first search on each iteration, this might result in repetitive
calculations.
 Get caught in a nearby minima. The ability of IDA* to become
caught in local minima is another drawback.
 Extremely reliant on the effectiveness of the heuristic function.
The effectiveness of the heuristic function utilised heavily
influences IDA* performance.
Conclusion

You might also like