# Introduction to Artificial Inteligence

## Written assignment: planning, probabilistic inference, and learning

```Justify all answers!

1) We are given the following independence statements about random variables
A, B, C, D, E, F:

I({A,B,C},{D,E}|{})
I({A,B,C},{F}|{})
I({D,E},{F}|{})
I({A},{B}|{})

not I({A},{B}|{C})
not I({D},{E}|{})

a) Construct a Bayes network that is consistent with the
above set of independence statements.

b) Is the answer above unique? If not, what is the set of possible BNs
that is consistent with all the statements?

2) Consider the following variables and their immediate causes (parents):

variable         parents
-------------------------------
A               C
B               none
C               none
D               A
E               A
G               D B
H               E

a) Is this network a poly-tree?
b) Is this network (directed-path) singly connected?
c) Determine the truth of the following independence
statements (using d-separation):
1)  I({D}, {E} | {})
2)  I({D}, {E} | {A})
3)  I({D}, {E} | {A, G})
4)  I({B}, {E} | {D})
5)  I({B}, {C} | {})
6)  I({B}, {C} | {G})
d) Assume that the nodes are binary-valued.
Suppose that P(C=true) = 0.2, P(B=true)= 0.1, P(E=true|A=false) = 0.5,
P(E=true|A=true) = 0.5,
P(H=true|E=true) = 0.2, P(H=true|E=false) = 0.4,
P(A=true|C=true) = 0.9, P(A=true|C=false) = 0.4

Find P(C=true | A=true, H=true)

Hint: you may want to preprocess to get rid of nodes before doing any computation.

3) You need to construct a 4-input neural network that has 2 outputs: the first
has value 1 in the output just when the number of its inputs that are "on" is even,
and the other has a value of 1 in the ouput just  when the number of its inputs that are "on" is odd.
(assume inputs are in {0, 1}).
a) Can this be done without hidden units?
b) Show a network using threshold elements that performs
the required computation (specify the weights, too!)

4) a) For the blocks world as defined in class, show how POP constructs the plan
(that is, show all partial plans from the initial plan until a correct
plan is reached) for initial state:

D
A
C  B
------------

and the goal state containing: On(A,B) and On(B,C)

b) Suppose that is not known whether On(A,B) or On(B,A) in the initial state,
and that there is an operator "Check(On(x,y))" which results in knowing whether
this is true or not. Show how a conditional plan is constructed for the above
case.

5)  Consider the following voting scenario, occuring in a certain middle-eastern country.*
We will assume that you are a risk-neutral, i.e. that
your utility function is linear in the amount of money that your assets are worth.
Assume also that moral considerations are not part of your utility function.

There are 3 candidates for whom you could vote: Yahoo, Future, and White,
all equally likely to win, unless your vote happens to swing the election.
Assume that there is a 5% chance that your vote will actually swing the election,
and a 0.5% chance that "The Man" (now officially endorsed by Yahoo) will somehow find out what your vote was.
If that happens, and you voted for someone OTHER than Yahoo, your business
will be trashed for a loss of 100,000 NIS and also lose every potential side-benefit
of serving with Yahoo (see below).

Your accountant has notified you that your taxes for FY 2012 amount to 1,000,000 NIS
on your cottage-cheese-encapsulation business.
Also, you happen to be a member of Yahoo's party, and if this party wins
you have a 10% chance of being in the legislature, in which case you will be able to
pass a law that declares all cottage-cheese-related businesses tax-exempt. But there is also a
10% chance that in this case a corruption charge against you will stick and you will
go to jail and lose your business, a total additional cost of 5,000,000 NIS.

Additional information is as follows: Yahoo claims he will reduce your taxes by 50%,
and you think he will actually deliver with probability 0.5 given that he is elected.
If White is elected there will be mediocre-size bonuses which will gain you 100,000 NIS.
Future getting elected will improve police forces, which will decrease your security
costs by 150,000 NIS.

Assume that event combinations not mentioned above have a probability of 0, e.g.
the probability that you will be a member of the legislature given that Yahoo
does not win is 0.

You have the following options:
1) Vote for Yahoo
2) Vote for Future
3) Vote for White
4) Not vote at all

Draw the decision diagram for each case below, and solve it.

a) What is your rational choice in voting?

b) As above, but you have the choice to pay 10,000 NIS to "filch-tech polling inc."
for a poll which tells you with certainty which 1 of the above 3 will surely NOT win
(leaving the other 2 equally likely). If you do make the payment, you get this
information before you need to decide about your vote.
Do you pay for the poll?
What do you vote after getting the poll information, assuming you do?

6) Consider the following Canadian traveller problem instance.

The (undirected) graph has 4 vertices, as follows:
(I, V1, V2, G)
The edges are as follows:
(I, V1), weight 10, no ice.
(I, V2), weight 20, no ice.
(V1, V2), weight 30, probability of ice 0.5
(V1, G), weight 10, probability of ice 0.8
(V2, G), weight 20, probability of ice 0.5
(I, G), weight 1000, no ice

b1) Formalize the above problem as a (belief-state) MDP, i.e.
what are the states, the transition probability
function, and the reward function?

b2) Find the optimal policy. You may assume that the robot starts
at vertex I in order to save some computation.

b3)In addition, from node I only, and before it starts moving,
the agent can perform a SENSING action
for a cost of 1, which results in the agent knowing the state of
the edge (V2, G). Re-compute the optimal policy for this case.

7)  A principal researcher in the Intelligent Smart Grid (ISG) consortium
would like to construct a decision procedure based on results from hiring
employees in the Canadian Traveler Problem research project.
The decision procedure will be based on a decision tree, using information
in the case database. Attributes for each employee are:
degree level (A),  C programming ability (B) Self motivation (C), number of
papers published in AI workshops (D).
The target attribute is the "decision", whether to hire or not.

a) Construct by hand (using the greedy search using the best information
gain heuristic) a consistent decision tree for the following table:

input variables               decision
A      B      C      D
--------------------------------------------
2      F      L      0             N
2      F      M      1             Y
2      T      L      0             N
3      F      H      0             Y
3      T      M      2             N
3      T      M      0             N
3      T      H      1             Y

b) Is a more compact (fewer internal nodes) decision tree possible for the above table?
If no - prove it. If yes, which tree?

```

Deadline: Wednesday, January 23, 2013, at 12 noon.

Note: submission (as well as WORK) on this exercise is SOLO (that is, NOT in pairs or other groups of size > 1)

* Disclaimer: any seeming identification with existing countries, institutions, political parties, or people, is unintentional.