0% found this document useful (0 votes)
78 views9 pages

P' To Node V: CT2-Answer Key Set-A-Batch-2

Download as doc, pdf, or txt
Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1/ 9

18CSC305J– Artificial Intelligence

CT2- Answer Key Set-A-Batch-2

1. a. Find the shorted path using A* algorithm from Node ‘P’ to node ‘V’. The heuristic
values are given near the nodes and the individual path cost is given on the edge. (13)

Node Shortest Heuristics to Total Distance Previous Node


Distance from reach F(n)= G(n)+
Source – P Destination -Q H(n)
G(n) c
P 0 14 14
Q 4 12 16 P
R 3 11 14 P
S 10 6 16 R
T 12 4 16 S
U 9 11 20 Q
V 17 0 17 T

Shortest Path : P – R – S – T - V with a length of 17

b. Consider the given graph

‘A’ is the root node. ‘F’ is the goal node. Explain the searching process using IDS. (12)

Depth Nodes
0 A
1 BCD
2 EFGHIJ
3 KLMNPQ

Depth Nodes visited using IDS


0 A
1 ABCD
2 ABEFCGDHIJ
3 ABEKLFCGMDHNPIJQ

2. a. The figure below is the game tree of a two-player game; the first player is the maximizer and
the second player is the minimizer. Use the tree to answer the following questions: [10]

- What is the final value of this game?

Consider running the alpha-beta pruning algorithm on this game tree.

- What is the final value of this game? 5

Consider running the alpha-beta pruning algorithm on this game tree.

- Is the final value of beta at the root node (after all children have been visited) +1? (T/F)

True. The root node is a maximizing node, and the value of beta never changes at a
maximizing node.

- What is the final value of beta at the node labeled P (after all of P’s children have been
visited)?

Since we are at a minimizing node and alpha is negative infinity, beta will take on the
smallest value returned by any of P’s children. In this case, P’s children would return 8, 9, and
4, so the final value of beta at P will be 4.

Suppose we are in the middle of running the algorithm. The algorithm has just reached the
node labeled Q. The value of alpha is 5 and the value of beta is +∞.

- Will any nodes be pruned?


Yes. If we work out the algorithm on the leftmost subtree of Q, we see that it returns a value
of 3. Beta at Q will then become 3, and 3 is less than the alpha value at Q, so Q will
immediately return a value to its parent. This means that the other two subtrees of Q are
pruned.

- What value will Q return to its parent?


Since its beta value after visiting the leftmost subtree was less than its alpha value of
5, Q will return its alpha value of 5
b. Explain in brief about the steps of Genetic algorithm
 Initialize population
 Select parents by evaluating their fitness
 Crossover parents to reproduce
 Mutate the offsprings
 Evaluate the offsprings
 Merge offsprings with the main population and sort

c. ________________ is an optimization technique that finds an approximation of the global


minimum of a function. [Clue: The process of slowly cooling metal.]
a. Simulated Annealing [SA]

d. Using this optimization, solve the Travelling salesman problem.


b. Algorithm For TSP - The way SA can be used for the TSP is as follows:

 Create the initial list of cities by shuffling the input list (ie: make the order of
visit random).
 At every iteration, two cities are swapped in the list. The cost value is the
distance traveled by the salesman for the whole tour.
 If the new distance, computed after the change, is shorter than the current
distance, it is kept.
 If the new distance is longer than the current one, it is kept with a certain
probability.
 We update the temperature at every iteration by slowly cooling down.

Moreover, two major optimizations can be used to speed up the computation of


the distances:

 Instead of recomputing the distance between two cities every time it is


required, the distances between all pairs of cities can be precomputed in a
table, and used thereafter. Actually, a triangular matrix is enough, as the
distance between cities A and B is the same as the distance between B and
A.
 As a change in parameters consists in swapping two cities, it is useless to
recompute the total distance for the whole tour. Indeed, only the distances
changed by the swap should be recomputed.
3. a. Give the difference between Frames and Semantic Nets while representing a knowledge

Semantic Nets

 Semantic networks structure the knowledge of a specific part of any


information. It uses real-world meanings that are easy to understand.
 For example, it uses "is a" and "is a part" inheritance hierarchies. Besides this,
they can be used to represent events and natural language sentences.
 The idea of semantic networks started out as a natural way to represent labelled
connections between entities.
 In Semantic networks, we can represent our knowledge in the form of graphical
networks. This network consists of nodes representing objects and arcs which
describe the relationship between those objects.
 Semantic networks can categorize the object in different forms and can also link
those objects. Semantic networks are easy to understand and can be easily
extended.
 This representation consists of mainly two types of relations: IS-A relation
(Inheritance) and Kind-of-relation.

Example: Following are some statements which we need to represent in the form of
nodes and arcs.
Statements:
Jerry is a cat.
Jerry is a mammal
Jerry is owned by Priya.
Jerry is brown colored.
All Mammals are animal

Frames

 A frame consists of a selection of slots which can be filled by values, or


procedures for calculating values, or pointers to other frames. For example
 The simplest type of frame is just a data structure with similar properties and
possibilities for knowledge representation as a semantic network, with the same
ideas of inheritance and default values.
 Frames become much more powerful when their slots can also contain
instructions (procedures) for computing things from information in other slots
or in other frames.

b. Write the following English sentences in symbolic form

1. If it rains, then I will stay at home. p → q

2. If I will go to Australia, then I will earn more money. p → q


3. He is poor but honest. p ∧ q 
4. If a = b and b = c then a = c. (p ∧ q) → r
5. Neither it is hot nor cold today. ∼p ∧ ∼q

c. Convert the following sentences in the propositional logic to clausal form.

P <=> (Q ^ ~R).
W => P.
R <=> S.
S => P.
P => (~(Q V W) V S)

1. P <=> (Q ^ ~R). Clausal Form: (~P V Q) ^ (~P V ~R) ^ (P V ~Q V R) ^ (P V


Q V ~R)
2. W => P. Clausal Form: ~W V P
3. R <=> S. Clausal Form: (~R V S) ^ (~S V R)
4. S => P. Clausal Form: ~S V P
5. P => (~(Q V W) V S) Clausal Form: ~P V ~Q V ~W V S

d.The law says that "it is a crime for an American to sell weapons to hostile nations. The country
"Nano", an enemy of America has some missiles, and all of its missiles were sold by colonel west,
who is an American". Use resolution principle to prove that west is a criminal.

Ans:

 It is a crime for an American to sell weapons to hostile nations:


American (x) ∧ Weapon (y) ∧ Sells (x, y, z) ∧ Hostile (z) ⇒ Criminal (x)
 Nono has some missiles, i.e., ∃x Owns (Nono, x) ∧ Missile(x):
Owns (Nono, M1) and Missile (M1)
 All of its missiles were sold to it by Colonel West
Missile (x) ∧ Owns (Nono, x) ⇒ Sells (West, x, Nono)
 Missiles are weapons:
Missile (x) ⇒ Weapon (x)
 An enemy of America counts as "hostile”:
Enemy (x, America) ⇒ Hostile (x)
 West, who is American
American (West)
 The country Nono, an enemy of America
Enemy (Nono, America)

Resolution proof: definite clauses

4. a. Consider the following Acyclic graph that portrays different events leading to a college
admission
Case 1: Consider the exam is very tough, the student does not have high IQ and scores less in
entrance exam. What is the probability that the student will get college admission if the student
manages to pass 12th exam? (7.5)
Input : Exam is tough , Student has low IQ, Entrances exams marks are less, 12th marks is low
Output: Gets admission in college
From the above word problem statement, the Joint Probability Distribution can be written as
below,
P[C=1, M=1, I=0, T=1, E=0]
From the above Conditional Probability tables, the values for the given conditions are fed to
the formula and is calculated as below.
P[C=1, M=1, I=0, T=1, E=0]
= P(C=1 | M=1) . P(M=1 | I=0, T=1) . P(I=0) . P(T=1) . P(E=0 | I=0)
= 0.1 * 0.1 * 0.8 * 0.3 * 0.75
= 0.0018
Case 2: What is the chance that the student do not get college admission despite having good IQ
capacity and scoring high marks in entrance exams? Also, the school exams were very easy.
Input : IQ = High , Entrance exam = High marks, Toughness of exam = Easy
Output : Do not get college admission

Thus

P[C=0, M=0, I=1, T=0, E=1]= P( C=0 | M=0) . P(M=0 | I=1, T=0) . P(I =1) . P(T =0) . P(E=1
| I=1)
= 0.6 * 0.5 * 0.2 * 0.7 * 0.6
= 0.0252
b. Using Baye's theorem solve the following problem. In a factory which manufactures bolts,
machines A, B and C manufacture respectively 25%, 35% and 40% of the bolts of their outputs
5%, 4% and 2% are respectively defective bolts. A bolts is drawn at random from the product
and is found to be defective. What is the probability that it is manufactured by the machine B?
c. For each of the following arguments, explain which rules of inference are used for each step. The
universe is the set of people.

i. "Every student in this class owns a personal computer.  Everyone who owns a personal
computer can use the Internet.  Therefore, John, a student in this class, can use the Internet."

 Let C(x) be "x is a student in this class,


 " P(x) be "x owns a personal computer, " and
  I(x) be "x can use the Internet." 
 The premises are.
1.    x (C(x)   P(x)),
2.    x (P(x)   I(x)) and 
3. C(John). 
 Using universal instantiation and the first premise, 
o C(John)   P(John)
 Applying modus ponens to this conclusion and the last premise,
o  P(John) follows. 
 Using universal instantiation and the second premise, 
o P(John)   I(John)
 From the last two conclusions by modus ponens
o  I(John)
 Hence from this conclusion and the last premise by conjunction 

C(John)   I(John)

i. "Everyone in this class owns a personal computer.  Someone in this class has never used the
Internet.  Therefore, someone who owns a personal computer has never used the Internet."
 Let 
o C(x) be "x is a student in this class, "
o  P(x) be "x owns a personal computer, " and 
o I(x) be "x has used the Internet." 
 The premises are
1.    x (C(x)   P(x))   and 
2.  x (C(x)     I(x)).  
 Using existential instantiation and the second premise 
o C(d)     I(d)   for some person d. Hence by
simplification C(d). 
 For that person d, by universal instantiation and the first premise 
o C(d)   P(d).  
o From this and the previous conclusion, by modus ponens P(d).
 Also from C(d)     I(d)   by simplification   I(d).  
 Hence by conjunction P(d)     I(d).  
 Hence by existential generalization   x (C(x)     I(x)).

You might also like