CAP402 Artificial Intelligence
CAP402 Artificial Intelligence
Artificial Intelligence
HW-1
SUBMITTED TO:-
RAJNI
SUBMITTED BY
PRIYANKA SHARMA
ROLLNO
RTB901A04
MSC( CS)
Part A
Real Turing Test:- in this test there is a interrogator on one side one
male client and one female client on separate computer. The mode of
communication is not verbal but it is in the form of text-type writing.
After some time the female client is replaced by the machine and the
interrogator have to identify that the whether there are human being or
machine on the other side.
These two test are not really related with the artificial intelligence
because they are concerned with the behaviors as well as imitate the
human being. The intelligence of the human being vary from person
from person. So these two test are practically not applicable and these
are totally different.
Q)2Given a 5-litre jug filled with water and an empty 2-litre jug, how
can one obtain precisely 1-litre in the 2-litre jug? Water may either
be discarded or poured from one jug to another; however, no more
than the initial 5 liters is available. Use production system to solve the
problem.
Ans) Sol There are two jugs one is of 5-litre and another is of 2-litre. 5
litre jug is full of water and the jug of 2 litre is empty.
Example: 8 Puzzle
+-----+
|8 3 5|
|4 1 |
|2 7 6|
+-----+
+-----+
|8 3 |
|4 1 5|
|2 7 6|
+-----+
+-----+
|8 3|
|4 1 5|
|2 7 6|
+-----+
+-----+
|8 1 3|
|4 5|
|2 7 6|
+-----+
+-----+
|8 1 3|
| 4 5|
|2 7 6|
+-----+
+-----+
|8 1 3|
|2 4 5|
| 7 6|
+-----+
+-----+
|8 1 3|
|2 4 |
|7 6 5|
+-----+
+-----+
|8 1 3|
|2 4|
|7 6 5|
+-----+
+-----+
|8 1 3|
| 2 4|
|7 6 5|
+-----+
+-----+
| 1 3|
|8 2 4|
|7 6 5|
+-----+
+-----+
|1 3|
|8 2 4|
|7 6 5|
+-----+
+-----+
|1 2 3|
|8 4|
|7 6 5|
+-----+
Total Number of moves: 14
A search tree for 8-puzzle.
Part B
Q5) How does Breath- First Search would work better than Depth –
First search and vice-versa?
Ans) Sol .
Initially there is an Open list and a Closed List. An Open list keeps track
of what you need to do, and the Closed List keeps track of what you have
already done.
• Open List: A
• Closed List: <empty>
we discover the neighbors of our A node. To put another way, let's
take the first item from our Open list and explore its neighbors:
these are a ,b ,c
Our Open list contains two items. For depth first search and breadth first
search, you always explore the first item from our Open list. The first
item in our Open list is the B node. B is not our destination, so let's
explore its neighbors:
Our new nodes are D and E, and we add these nodes to the beginning of
our Open list:
• Open List: D, E, C
• Closed List: A, B
• Open List: E, C
• Closed List: A, B, D
Our Open list will have the E node removed and the F and G nodes
added. The removed E node will be added to our Closed List:
• Open List: F, G, C
• Closed List: A, B, D, E
The final path taken by our depth first search method is what the
final value of our Closed List is: A, B, D, E, F.
Breadth First Search:-
In breadth first search, newly explored nodes are added to the end of your
Open list. Let's see how that change will affect our results.
Let's try to find a path between nodes A and E. Let's start with our
root/goal node:
• Open List: A
• Closed List: <empty>
We remove A from our Open list and add A to our Closed List. A's
neighbors, the B and C nodes, are added to our Open list. They are added
to the end of our Open list, but since our Open list was
Open List: B, C
Closed List: A
B is now moved to our Closed List, but the neighbors of B, nodes D and
E are added to the end of our Open list:
• Open List: C, D, E
• Closed List: A, B
Since C has no neighbors, all we do is remove C from our Closed List and
move on:
• Open List: D, E
• Closed List: A, B, C
• Open List: E
• Closed List: A, B, C, D
Our final versions of the Open and Closed Lists contain the following
data:
On the basis of above example we can say breath first search is better
than depth first search.
Step1: Initially we have to make a stack having one element in each place
and also containing of the root node.
Step2: we have to test them to see whether the top element in the queue is
a goal node or not. If it is goal not then stop, else go to step 3.
Step3: in this step we have to eliminate the top element from the stack
and add the first element’s descendants, if any, to the top of the stack
according to arrangement computed by the estimated function.
The below created diagrams show the working of hill climbing method.
2 8 3
1 4
7 6 5
2 3
1 8 4 2 8 3
7 6 5 1 4
7 6 5
2 8 3
1 4
7 6 5
2 3
1 8 4
7 6 5
1 2 3
8 4
7 6 5
1 2 3
7 8 4
6 5