0% found this document useful (0 votes)
31 views8 pages

Answer Key - CT1 - AI - Set A

This document outlines an examination for the Artificial Intelligence course at SRM Institute of Science and Technology, detailing the test structure, including course outcomes and questions related to AI techniques such as state space search, Uniform Cost Search, and graph traversal methods. It includes specific problem-solving scenarios like the banana transportation problem, the missionaries and cannibals puzzle, and the 8-puzzle problem using A* search. The exam is designed to assess students' understanding and application of AI concepts and algorithms.

Uploaded by

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

Answer Key - CT1 - AI - Set A

This document outlines an examination for the Artificial Intelligence course at SRM Institute of Science and Technology, detailing the test structure, including course outcomes and questions related to AI techniques such as state space search, Uniform Cost Search, and graph traversal methods. It includes specific problem-solving scenarios like the banana transportation problem, the missionaries and cannibals puzzle, and the 8-puzzle problem using A* search. The exam is designed to assess students' understanding and application of AI concepts and algorithms.

Uploaded by

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

Reg No.

SRM Institute of Science and Technology


College of Engineering and Technology SET A
School of Computing
SRM Nagar, Kattankulathur – 603203, Chengalpattu District, Tamil Nadu
Academic Year: 2024-25 (EVEN) (Common to All Branches)
Test: FT2 Date: 25.02.2025
Course Code & Title: 21CSC206T Artificial Intelligence Duration: 100 Minutes
Year & Sem: II Year / IV Sem Max. Marks: 50
Course Articulation Matrix:
S. Course
PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12 PSO1 PSO2 PSO3
No Outcome
1 CO1 1 2
2 CO2 1 2 3
3 CO3 2 2
4 CO4 1 2
5 CO5 3 2 3 2
CO1: Formulate a problem as a state space search method and its solution using various AI techniques
CO2: Apply appropriate searching techniques to solve a real-world problem
PO1: Engineering Knowledge: Apply the knowledge of basic sciences and engineering fundamentals to solve engineering problems.
PO2: Problem Analysis: Analyze complex engineering problems and give solutions related to chemical & allied industries.
PO3: Design/Development of solutions: Identify the chemical engineering problems, design and formulate solutions to solve both industrial & social related
problems.
PO9: Individual and team work: Function effectively as a member or a leader in diverse teams and be competent to carry out multidisciplinary tasks.

Part – B (3 x 8 = 24 Marks)
Ques. No. 11 – Compulsory
Ques. No. 12 to 14 (Any 2 out of 3)
Qn. Question Mark B C P PI
No. L O O

11 A person has 3000 bananas and a camel. The person wants to transport the maximum number 8 3 1 3 3.5.1
of bananas to a destination which is 1000 KMs away, using only the camel as a mode of
transportation. The camel cannot carry more than 1000 bananas at a time and eats a banana
every km it travels. What is the maximum number of bananas that can be transferred to the
destination using only camel (no other mode of transportation is allowed) and opt for the
possible optimal solution to solve this classic optimization problem

(8 Marks)

12 Describe Uniform Cost Search (UCS). How does it differ from Best First Search, and in what 8 2 2 1 1.7.1
scenarios is UCS preferred?
Uniform Cost Search (UCS) explores the least-cost path first by expanding nodes in increasing
order of cost. It uses a priority queue to store nodes based on cumulative path cost. (2Marks)
Differences from BFS: (3Marks)
BFS expands nodes level by level (assumes uniform edge costs).
UCS expands the least-cost node first, making it suitable for weighted graphs.
When UCS is preferred: (3Marks)
Pathfinding problems with varying costs (e.g., Google Maps shortest path calculation).
Applications like robot navigation and network routing.

13 Consider a maze represented as a directed graph where each intersection is a node, and edges 8 3 2 2 2.5.2
represent possible paths between intersections. The maze is structured as follows: There are 6
intersections labeled A, B, C, D, E, and F.
The paths between intersections are as follows:
A → B,
A → C,
B → D,
B → E,
C → F,
D → F,
E → F.
The starting point is intersection A, and the goal is to reach intersection F.
Apply BFS to find the shortest path from A to F and show the step-by-step exploration of nodes.
Apply DFS on the same graph and show a possible traversal order. Compare BFS and DFS in
terms of time complexity, space complexity, and path optimality for this problem.

Graph Representation:
The directed graph based on the maze structure is as follows:

A→B→D→F (2Marks)
| ↓ ↑
C→E→F
The paths are:
• A→B
• A→C
• B→D
• B→E
• C→F
• D→F
• E→F
Problem: Find the shortest path from A to F using BFS, and a possible traversal using
DFS.

1. BFS (Breadth-First Search) for Shortest Path from A to F: (2 marks)

BFS explores the graph level by level, visiting all neighbors of a node before moving to the next
level. It is optimal for finding the shortest path in an unweighted graph.
Step-by-Step BFS from A to F:
1. Start at node A:
o Queue: [A]
o Explored: {A}
o Neighbors of A: B, C (enqueue B, C)
2. Visit node B (dequeue A, enqueue B):
o Queue: [B, C]
o Explored: {A, B}
o Neighbors of B: D, E (enqueue D, E)
3. Visit node C (dequeue B, enqueue C):
o Queue: [C, D, E]
o Explored: {A, B, C}
o Neighbors of C: F (enqueue F)
4. Visit node D (dequeue C, enqueue D):
o Queue: [D, E, F]
o Explored: {A, B, C, D}
o Neighbors of D: F (F is already in the queue, no new nodes to enqueue)
5. Visit node E (dequeue D, enqueue E):
o Queue: [E, F]
o Explored: {A, B, C, D, E}
o Neighbors of E: F (F is already in the queue)
6. Visit node F (dequeue E, enqueue F):
o Queue: [F]
o Explored: {A, B, C, D, E, F}
o Neighbors of F: None (end reached)
BFS Shortest Path from A to F:
• The path from A to F is: A → B → E → F.
• This is the shortest path in terms of the number of edges.

2. DFS (Depth-First Search) Traversal Order: (2 Marks)

DFS explores as far as possible along each branch before backtracking. In DFS, there is no
guarantee of finding the shortest path, but it will explore the graph deeply and backtrack when
necessary.
Step-by-Step DFS from A:
1. Start at node A:
o Stack: [A]
o Explored: {A}
o Neighbors of A: B, C (choose B)
2. Visit node B (push B onto the stack):
o Stack: [A, B]
o Explored: {A, B}
o Neighbors of B: D, E (choose D)
3. Visit node D (push D onto the stack):
o Stack: [A, B, D]
o Explored: {A, B, D}
o Neighbors of D: F (choose F)
4. Visit node F (push F onto the stack):
o Stack: [A, B, D, F]
o Explored: {A, B, D, F}
o Neighbors of F: None (end reached)
5. Backtrack (pop F, then D):
o Stack: [A, B]
o All neighbors of D are visited.
6. Backtrack (pop B):
o Stack: [A]
o Neighbors of B: E (choose E)
7. Visit node E (push E onto the stack):
o Stack: [A, E]
o Explored: {A, B, D, F, E}
o Neighbors of E: F (F is already visited)
8. Backtrack (pop E, then A):
o Stack: []
o All neighbors of A are visited.
DFS Traversal Order:
• The DFS traversal order is: A → B → D → F → E.

(2 Marks)
14 In the figure given below, if the initial node is Src, find the path to reach the goal node dest, 8 3 2 2 2.6.3
using best first search. Write a step-by-step algorithm for the same.

Applying Best-First Search to the Given Graph

We will select nodes based on their heuristic values (from the table):

Start at Src (20) (8 marks)


Children: 1 (22), 2 (21), 3 (10)
Pick 3 (smallest heuristic value: 10)
Move to 3 (10)
Children: 7 (5), 8 (12)
Pick 7 (5)
Move to 7 (5)
Children: dest (0)
Pick dest (0) → Goal reached

Part – C (1 x 16 = 16 Marks)
Instructions: Answer any one question
15 a) Three missionaries and three cannibals need to cross a river safely using a boat. The boat 10 + 4 2 2 2.6.3
can hold a maximum of two people at a time. The challenge is to transport all individuals to
the other side without ever having more cannibals than missionaries on either bank, as the 6
missionaries would be eaten.
Constraints:
● The boat cannot travel empty.
● The boat can carry a maximum of two people at a time.
● The number of cannibals must never exceed the number of missionaries on either side unless
there are no missionaries left on that side.
● The goal is to transport all six individuals across the river safely while following the
constraints.
What is the safest way to move everyone to the right bank? List the step-by-step moves with
reasoning. Find the minimum number of crossings needed to transport everyone safely using a
search algorithm.

The "Missionaries and Cannibals" problem is a classic puzzle involving a river crossing, where
we need to move three missionaries (M) and three cannibals (C) across a river using a boat that
can carry a maximum of two people. The goal is to do this without violating the constraint that
at any point, on either bank, the number of cannibals cannot exceed the number of missionaries
(unless there are no missionaries on that side).
We'll solve this problem step by step and find the minimum number of crossings needed.
Step-by-Step Explanation and Reasoning (8marks)
Let’s represent the state of the puzzle as a tuple of 4 values:
• (M_left, C_left, M_right, C_right), where:
o M_left = number of missionaries on the left bank,
o C_left = number of cannibals on the left bank,
o M_right = number of missionaries on the right bank,
o C_right = number of cannibals on the right bank.
Initially, all people are on the left bank:
• (3, 3, 0, 0).
The goal is to reach:
• (0, 0, 3, 3).

b) A traveling salesman needs to visit four cities: A, B, C, and D. The distances between cities
are given in the table below:

The salesman starts from City A and must visit all cities exactly once before returning to A.
What is the shortest possible route?

Steps to Solve: (8 Marks)

1. List all possible routes starting from A


Since there are 3 remaining cities to visit in any order, the number of possible routes is (3!) =
6.

2. Calculate the total distance for each route:

o A→B→C→D→A
Distance = 10 + 35 + 30 + 20 = 95

o A→B→D→C→A
Distance = 10 + 25 + 30 + 15 = 80

o A→C→B→D→A
Distance = 15 + 35 + 25 + 20 = 95

o A→C→D→B→A
Distance = 15 + 30 + 25 + 10 = 80

o A→D→B→C→A
Distance = 20 + 25 + 35 + 15 = 95

o A→D→C→B→A
Distance = 20 + 30 + 35 + 10 = 95

3. Find the shortest route:


The two shortest routes have a total distance of 80:

o A→B→D→C→A

o A→C→D→B→A

Thus, the shortest possible route is either:

1. A → B → D → C → A (80)

2. A → C → D → B → A (80)

(OR)
16 Solve the 8-Puzzle Problem Using A* Search Algorithm. 16 4 2 2 2.6.3

A robot is trying to solve an 8-puzzle game where tiles need to be rearranged to match the final
state. The blank tile (represented as -) can move up, down, left, or right to swap positions with
adjacent tiles.
(The blank space - is at position
The initial state (2,1))
of the puzzle is: The final goal state is:

2 8 3 1 2 3

1 6 4 8 - 4

7 - 5 7 6 5

1. Using A search*, find the optimal path from the initial state to the final state.
2. What will be the sequence of moves with f(n) calculation taken by the blank tile (-) to
reach the final goal state?

Initial State: (10 Marks)


2 8 3
1 6 4
7 - 5
• g(n) = 0 (initial move count)
• h(n) = 8 (sum of Manhattan distances for all tiles)
• f(n) = g(n) + h(n) = 0 + 8 = 8

Possible Moves from Initial State:


The blank tile can move:
• Up (swap with 6)
• Down (swap with 5)
• Left (swap with 7)
• Right (swap with 4)
We'll evaluate each move:
• Move Blank Right (swap with 4):

2 8 3
1 6 -
7 4 5
o g(n) = 1
o h(n) = 7
o f(n) = 1 + 7 = 8
• Move Blank Left (swap with 7):
diff

2 8 3
1 6 4
- 7 5
o g(n) = 1
o h(n) = 9
o f(n) = 1 + 9 = 10
• Move Blank Up (swap with 6):

2 8 3
1 - 4
7 6 5
o g(n) = 1
o h(n) = 6
o f(n) = 1 + 6 = 7
• Move Blank Down (swap with 5):

2 8 3
1 6 4
7 5 -
o g(n) = 1
o h(n) = 8
o f(n) = 1 + 8 = 9
The move with the lowest f(n) is moving the blank Up (swap with 6).
Next State After Moving Blank Up:

2 8 3
1 - 4
7 6 5
• g(n) = 1
• h(n) = 6
• f(n) = 7
Possible moves:
• Up (swap with 8)
• Down (swap with 6)
• Left (swap with 1)
• Right (swap with 4)
Evaluating these moves:
• Move Blank Right (swap with 4):

2 8 3
1 4 -
7 6 5
o g(n) = 2
o h(n) = 7
o f(n) = 2 + 7 = 9
• Move Blank Left (swap with 1):
Diff

2 8 3
- 1 4
7 6 5
o g(n) = 2
o h(n) = 5
o f(n) = 2 + 5 = 7
• Move Blank Up (swap with 8):

2 - 3
1 8 4
7 6 5
o g(n) = 2
o h(n) = 6
o f(n) = 2 + 6 = 8
• Move Blank Down (swap with 6):
(Reverts to previous state)
o g(n) = 2
o h(n) = 8
o f(n) = 2 + 8 = 10
The move with the lowest f(n) is moving the blank Left (swap with 1).
Next State After Moving Blank Left: (6 Marks)

2 8 3
- 1 4
7 6 5
• g(n) = 2
• h(n) = 5
• f(n) = 7
Possible moves:
• Up (swap with 2)
• Down (swap with 7)
• Left (invalid move)
• Right (swap with 1)
Evaluating these moves:
• Move Blank Right (swap with 1):
(Reverts to previous state)
o g(n) = 3
o h(n) = 6
o f(n) = 3 + 6 = 9
• Move Blank Up (swap with 2):
diff
- 8 3
2 1 4
7 6 5
o g(n) = 3
o h(n) = 4
o f(n) = 3 + 4 = 7
• Move Blank Down (swap with 7):

2 8 3
7

Course Outcome (CO) and Bloom’s level (BL) Coverage in Questions

CO Coverage Bloom's Level


100% 70% BL1,
7% BL2,
50% 30% BL4, 18%
43%
0% BL3,
CO1 CO2 CO3 CO4 CO5 32%

Approved by

Audit Professor Course Coordinator

You might also like