Assignment 1
Assignment 1
Consider the problem of finding the shortest path between two points on a plane that has
convex polygonal obstacles as shown in Figure1. This is an idealization of the problem
that a robot has to solve to navigate in a crowded environment.
a. Suppose the state space consists of all positions (x, y) in the plane. How many states
are there? How many paths are there to the goal?
b. Explain briefly why the shortest path from one polygon vertex to any other in the scene
must consist of straight-line segments joining some of the vertices of the polygons.
Define a good state space now. How large is this state space?
Ans
a. If we consider all (x, y) points, then there are an infinite number of states, and of paths.
b. (For this problem, we consider the start and goal points to be vertices.) The shortest
distance between two points is a straight line, and if it is not possible to travel in a
straight line because some obstacle is in the way, then the next shortest distance is a
sequence of line segments, end-to-end, that deviate from the straight line by as little
as possible. So the first segment of this sequence must go from the start point to a
tangent point on an obstacle – any path that gave the obstacle a wider girth would be
longer. Because the obstacles are polygonal, the tangent points must be at vertices of
the obstacles, and hence the entire path must go from vertex to vertex. So now the state
space is the set of vertices, of which there are 35 in Figure 1.
2 Consider a state space where the start state is number 1 and each state k has two
successors: numbers 2k and 2k + 1.
a. Draw the portion of the state space for states 1 to 15.
b. Suppose the goal state is 11. List the order in which nodes will be visited for breadthfirst
search, depth-limited search with limit 3, and iterative deepening search.
c. Call the action going from k to 2k Left, and the action going to 2k + 1 Right. Can you
find an algorithm that outputs the solution to this problem without any search at all?
Ans
a. See Figure S.
b. Breadth-first: 1 2 3 4 5 6 7 8 9 10 11
Depth-limited: 1 2 4 8 9 5 10 11
Iterative deepening: 1; 1 2 3; 1 2 4 5 3 6 7; 1 2 4 8 9 5 10 11
c. The solution can be read off the binary numeral for the goal number. Write the goal
number in binary. Since we can only reach positive integers, this binary expansion
beings with a 1. From most- to least- significant bit, skipping the initial 1, go Left to
the node 2n if this bit is 0 and go Right to node 2n + 1 if it is 1. For example, suppose
the goal is 11, which is 1011 in binary. The solution is therefore Left, Right, Right.
3) True or false: If decision tree D2 is an elaboration of tree D1, then D1 is more-general-than D2.
Assume D1 and D2 are decision trees representing arbitrary boolean functions, and that D2 is an
elaboration of D1 if ID3 could extend D1 into D2. If true, give a proof; if false, a counterexample.
Solution:
In a general case, the answer is TRUE. That is a decision tree D1 is more-general-than D2. In a
decision tree the nodes in the top ask general questions. While the nodes are traversed from the top to
the bottom, the questions become more specific. There is a likelihood of overfitting if there are too
many levels in a decision tree.
On the other hand in the case of a decision tree with arbitrary boolean functions, the answer is
FALSE. As a counterexample, consider the boolean function f(A,B) = (A AND B) OR (A NAND B)
OR (A NOR B). Here the decision tree D2 would have all the boolean operations in f(A,B) and the
decision tree D1 would have only a subset of the boolean operations in f(A,B). Hence the result of D1
is wrong while that of D2 is correct. In this case, it is entirely wrong to say that D1 is a more-general-
than D2.
5)
a) Study the following table and construct a decision tree for computer buying behaviour
prediction using Information Gain as the heuristics.
b) Express the decision tree as a rule.
c) Apart from the Decision Tree that you got, provide one more Consistent hypothesis for this
set pf samples provided.
Buys
No Age Income Type Family income Credit Rating
computer
1 25 High Employee 20000 Low No
2 24 High Employee 21000 Low No
3 32 High Employee 15000 High No
Mediu
4 41 Employee 36000 High Yes
m
5 42 Low Student 36500 High Yes
6 43 Low Student 38000 High No
7 40 Low Student 35000 High Yes
Mediu
8 26 Employee 18000 Low No
m
9 30 Low Student 31000 Low No
Mediu
10 42 Student 37000 High Yes
m
Mediu
11 25 Student 19000 Low No
m
Mediu
12 35 Employee 18000 High No
m
13 38 High Student 34000 High Yes
Mediu
14 45 Employee 51000 High No
m