Professional Documents
Culture Documents
PAI Model Answer 2021 22
PAI Model Answer 2021 22
1. (a) You are given the missionaries and cannibals problem, which states that there
are 3 missionaries and 3 cannibals on one side of a river, along with a boat that
can hold one or two people. The problem is to find a way to get everyone to the
other side of the river without ever leaving a group of missionaries in one place
outnumbered by the number of cannibals in the same place. Discuss the state
space representation of this problem and formulate the same as a search problem.
(b) Why are the AO* algorithm do not use the ‘g’ value, which signifies the actual
cost to reach current node from initial node, to calculate overall cost value of a
node? Consider the search problem represented in figure shown below, where a
is the start node and e is the goal node. The pair [f; h] at each node indicates the
value of the f and h functions for the path ending at that node. Is the heuristic
function h admissible? Explain why or why not?
AO * Algorithm always selects a node which is a part of current best path from
Source, so there is no need to compute g value. [ 2 Marks]
A heuristic function h(n) is consistent if for every node n and every successor
n’of n generated by action a, the following inequality holds:
h(a) >= h(b)+ c(a,b) i.e. 3 >= 4 ,which is not true [ 1 Marks]
(c) Analyze the performance of following blind search algorithms in terms of time
and space complexity, completeness and optimality. You may assume average
branching factor as b, solution depth as d, and m as a maximum traversal depth
in case of depth first search to analyze the time and space complexity of
algorithms.
(i) Depth First Search
[ 0.5x4=2 Marks ]
Explanation for time and space complexity [1 Marks ]
Time Complexity :
If branching factor is b and solution is at depth d, then nodes at depth d are
generated once, nodes at depth d-1 are generated twice, etc., and node at depth 1
is generated d times. Hence total number of node to be expanded
2. (a) Can we apply minimax search algorithm for a game in which opponent is
playing sub-optimally? Explain why or why not?
Static evaluation function value calculation for each leaf node : [3 Marks]
Maximizing player will select ‘A’ as best move based on calculation shown below.
[ 2 Marks ]
(c ) Cross out each leaf value that would be pruned by alpha-beta pruning.
3. (a)You are in charge of scheduling for computer science classes that meet Mondays,
Wednesdays and Fridays. There are 5 classes that meet on these days and 3
professors who will be teaching these classes. You are constrained by the fact
that each professor can only teach one class at a time.
The classes are:
Class 1 - Intro to Programming: meets from 8:00-9:00am
Class 2 - Intro to Artificial Intelligence: meets from 8:30-9:30am
Class 3 - Natural Language Processing: meets from 9:00-10:00am
Class 4 - Computer Vision: meets from 9:00-10:00am
Class 5 - Machine Learning: meets from 9:30-10:30am
The professors are:
Professor A, who is available to teach Classes 3 and 4.
Professor B, who is available to teach Classes 2, 3, 4, and 5.
Professor C, who is available to teach Classes 1, 2, 3, 4, 5.
(i) Formulate this problem as a CSP problem in which there is one variable per
class, stating the domains, and constraints. Constraints should be specified
formally and precisely, but may be implicit rather than explicit.
(ii) Draw the constraint graph associated with your CSP.
(iii)Show the domains of the variables after running arc-consistency on this initial
graph (after having already enforced any unary constraints)
(iv) Give one solution to this CSP.
Domains [ 1 Marks]
C1 C
C2 B, C
C3 A, B, C
C4 A, B, C
C5 B, C
Constraints [ 1.5 Marks]
C1 ≠ C2
C2 ≠ C2
C3 ≠ C4
C4 ≠ C5
C2 ≠ C4
C3 ≠ C5
Constraint graph associated with CSP [ 2 Marks]
C2
C1
C5
C4
C3
C1 → C2 (C) → (B, C)
C2 → C1 (B, C) → C [ ‘C’ Deleted]
C2 → C4 (B) → (A, B, C)
C4 → C2 (A, B, C) → (B) [ ‘B’ Deleted ]
C2 → C3 (B) → (A, B, C)
C3 → C2 (A, C) → (B) [ ‘B’ Deleted ]
C3 → C4 (A, C) → (A, C)
C4 → C3 (A, C) → (A, C)
C4 → C5 (A, C) → (B, C)
C5 → C4 (B, C) → (A, C)
C3 → C5 (A, C) → (B, C)
C5 → C3 (B, C) → (A, C)
(b) Draw the constraint hyper graph to solve the following crypt-arithmetic puzzle
using CSP approach.
CROSS + ROADS = DANGER
No two letters can have same value along with following constraints.
S + S = R + 10 X1
X1 + S + D = E + 10 X2
X2 + O + A = G + 10 X3
X3 + R + O = N + 10 X4
X4 + C + R = A + 10 X5
X5 = D [ 2 Marks ]
[ 3 Marks]
D C R A O N G S E
X5 X4 X3 X2 X1
4. (a) What do you mean by conditional independence? (2)
(b)Consider the Bayesian network shown below, which is showing both the
topology and the conditional probability tables (CPTs). In the CPTs, the letters
B, E, A, J and M stand for Burglary, Earthquake, Alarm, John Calls, and Mary
Calls, respectively.
= 0.000001197 [1 Marks ]
[ 05x6=3 Marks]
[1 Marks]
(b) Perform following Fuzzy Arithmetic operations (as given inputs in Figure).
(i) Addition
(ii) Subtraction
, x=2α+3
, x=7-2α
, x=2α+6
, x=10-2α
= x=2α+3
= x=7-2α
= x=2α+6
= x=10-2α
(i) Addition
[1 Marks]
α
0 9 17
0.25 10 16
0.5 11 15
0.75 12 14
1 13 13
(ii) Subtraction
[ 1 Marks ]
α
0 -7 1
0.25 -6 0
0.5 -5 -1
0.75 -4 -2
1 -3 -3
6. (a) Imagine that you are given the following set of training examples. Each feature
can take on one of three nominal values: a, b, or c.
P(+)=2/5=0.4
P(-)=3/5=0.6
Test sample, F1=a, F2=c, F3=c
P(+)=0.4*1/2*1/2*1/2=0.05 [ 2 Marks]
P(-)=0.6*1/3*2/3*1/3=0.044 [2 Marks]
P(+) is higher than P(-), So, test sample is more near to Positive (+) class.[1 Marks ]
(b) Consider a set of five training examples given as ((xi, yi), ci) values, where xi
and yi are the two attribute values (positive integers) and ci is the binary class
label: {((1, 1), −1), ((1, 7), +1), ((3, 3), +1), ((5, 4), −1), ((2, 5), −1)}.
Classify a test example at coordinates (3, 6) using a k-NN classifier with k = 3 and
Manhattan distance defined by d((u, v), (p, q)) = |u − p| + |v − q|. Your answer
should be either +1 or -1.
Individual point distance calculation from test sample. [0.5x5 =2.5 Marks ]
Xi Yi Ci |u-p|+|v-q| K=3
1 1 -1 2+5=7
1 7 +1 2+1=3 3rd nearest
3 3 +1 0+3=3 2nd nearest
5 4 -1 2+2=4
2 5 -1 1+1=2 1st nearest
As number of (+) Label > (-) Label of nearest neighbors , so classified as (+)
[ 1 Marks ]
7. Consider the following initial and goal states of a Block-World problem in FOL and (10)
show how the TWEAK method would solve this problem.
Start: ON(C,A) ʌ ONTABLE(B) ʌ CLEAR(C) ʌ ONTABLE(A) ʌ CLEAR(B)
Goal: ON(A,B) ʌ ON(B,C) ʌ ONTABLE(C) ʌ CLEAR(A)
X1 = 65413532
X2 = 87126601
X3 = 23921285
X4 = 41852094
(i) Fitness value
F(x1)=(6+5)-(4+1)+(3+5)-(3+2) = 9 65 4135 32
F(x2)=(8+7)-(1+2)+(6+6)-(0+1) = 23 23 9212 85
F(x3)=(2+3)-(9+2)+(1+2)-(8+5) = -16
F(x4)=(4+1)-(8+5)+(2+0)-(9+4) = -19
[ 1x4 = 4 Marks ]
(ii) One point cross over fittest two individuals
X2= 8712 | 6601
X1= 6541 | 3532
O3 = 65921232 [1 Marks ]
O4 = 23413585 [1 Marks ]
(iv) Cross the first and third fittest individuals using a uniform crossover.
X2 = 87126601
X3 = 23921285
Random exchange :
O5 = 83126605 [ 1 Marks]
O6 = 27921281 [1 Marks ]
9. (a) Consider the following data set with three binary input attributes (A1, A2, and
A3) and one binary output, y.What is the variable at the root of the decision tree? ?
Decision Tree
instanc A1 A2 A3 y
e
1 1 0 0 0
2 1 0 1 0
3 0 1 0 0
4 1 1 1 1
5 1 1 0 1
[ 1 Marks ]
(b) Can you represent the following boolean function with a single logistic threshold
unit(i.e., a single unit from a neural network)? If yes, show the weights. If not,
explain why not in 1-2 sentences.
Yes we can represent given boolean fiunction using single logistic thershold
[1 Marks]
Explanation : Given Boolean function is linearly seperable with illustation
[ 1 Marks]
Drawing of neural network with following values of wrights and bias
Man( Marcus)
Pompeian ( Marcus) [ 0.5 Marks]
(b) What are the shortcoming of hill climbing algorithms? How does simulated
annealing improve hill climbing
1. Local Maxima: When all moves appears worse( i.e reaches at local
maxima but not global maxima )
2. Plateau : When all move appears same ( i.e. reaches in flat plane)