Docsity

Informed Search - Artificial Intelligence - Solved Exam, Exams of Artificial Intelligence

Partial preview of the text

Download Informed Search - Artificial Intelligence - Solved Exam and more Exams Artificial Intelligence in PDF only on Docsity!

Midterm Examination

CS540: Introduction to Artificial Intelligence

October 27, 2010

LAST NAME: SOLUTION

FIRST NAME:

SECTION (1=Zhu, 2=Dyer): ___________________________

Problem Score Max Score

1 ___________ 15

2 ___________ 16

3 ___________ 7

4 ___________ 15

5 ___________ 12

6 ___________ 10

7 ___________ 15

8 ___________ 10

Total ___________ 100

Question 1. [15] State Space Search

You have two jugs, measuring 3 gallons and 4 gallons, and a water faucet. You can fill the jugs up or empty them out from one to another or onto the ground. You need to measure out exactly 2 gallons.

(a) [5] Let state ( a , b ) mean the amount of water in the 3 and 4 gallon jugs, respectively. Define all successors of this state.

(3,b); if a<

(a,4); if b<

(0,b); if a>

(a,0); if b>

(3, b-(3-a)=a+b-3); if a<3 and a+b>

(a+b, 0); if a<3 and b>0 and a+b<=

The two above can be combined into (min(a+b,3), max(a+b-3,0))

(a-(4-b)=a+b-4, 4); if b<4 and a+b>

(0, a+b); if b<4 and a>0 and a+b<=

The two above can be combined into (max(a+b-4,0), min(a+b,4))

(b) [5] Write down a solution path from (3, 4) to a goal state. You do not need to show how you find this path.

(3,4)-(3,0)-(0,3)-(3,3)-(2,4) or

(3,4)-(0,4)-(3,1)-(0,1)-(1,0)-(1,4)-(3,2)

(c) [5] Let the cost of every edge be 1. Consider the function h ( a , b ) = | a - b |. Is h an admissible heuristic? Justify your answer.

No. On many goal states this h is not zero. On the first solution path, (0,3) has actual cost 2 (i.e. two steps away from goal) but h(0,3)=3>2. Similarly, on the 2nd^ solution path, (1,4) has actual cost 1 but h(1,4)=3>1.

(b) [8] Perform A Search* , starting from A. Break ties alphabetically. Show the expanded states and the priority queue contents at each step. What is the cost of your solution path?

Expanded states priority queue

  • A(0+2) A(0+2) B(1+2), C(1+1) C(1+1) B(1+2), D(2+3), E(2+2), F(2+1) B(1+2) D(2+3), E(2+2), F(2+1) F(2+1) D(2+3), E(2+2), G(5+0), H(3+3) E(2+2) D(2+3), G(5+0), H(3+3) D(2+3) G(5+0), H(3+3) G(5+0) H(3+3)

Path: A-C-F-G, cost=

Question 3. [7] Simulated Annealing

Assume that simulated annealing starts from a state s at the center of a large plateau. That is, the values of all states on the plateau are exactly the same.

(a) [4] Say in the first step the random neighbor we picked is t , which of course has the same value as s. What will simulated annealing do? Justify your answer.

Since P(s->t) = exp(-|f(s)-f(t)|/T) and f(s)=f(t), we see that with probability 1 we will move to t.

(b) [3] To encourage the search to escape this plateau as quickly as possible, what should we do with the temperature T? Justify your answer.

Since the above probability P(s->t) does not depend on T (because it is exp(0)), there is nothing you can do about temperature T to encourage an escape.

(c) [3] Explain why the standard minimax algorithm would fail on this game tree.

The game tree is infinite. Because minimax is depth first search, it will not terminate.

Question 5. [12] Constraint Satisfaction

Consider the problem of assigning colors to the five squares on board below such that horizontally adjacent and vertically adjacent squares do not have the same color. Assume there are possible two colors, red ( R ) and black ( B ). Formulated as a constraint satisfaction problem, there are five variables (the squares) and two possible values ( R , B ) for each variable.

(a) [3] If initially every variable has both possible values and we then assign variable 1 to have value R , what is the result of the Forward Checking algorithm?

Forward checking propagates constraints from the current assigned variable to all adjacent unassigned variables, which in this case are variables 2 and 4. This results in the following domains for the variables: 1 = {R}, 2 = {B}, 3 = {R, B}, 4 = {B}, 5 = {R, B}

(b) [4] If initially every variable has both possible values and the Arc Consistency algorithm is run, what are the resulting domains for each of the variables?

None of the domains change, with each variable still have both possible values, {R, B}.

(c) [5] If initially every variable has both possible values except variable 5 has only value B , what is the result of the Arc Consistency algorithm?

1 = {B}, 2 = {R}, 3 = {B}, 4 = {R}, 5 = {B}

Question 6. [10] Propositional Logic

(a) [2] True or false: ( A ๏ƒ› B ) |= (๏ƒ˜ A ๏ƒš B )

True

(b) [4] Is the PL sentence (( P ๏ƒž Q ) ๏ƒ™ Q ) ๏ƒž P valid, unsatisfiable or satisfiable? Justify your answer.

Satisfiable. When P=T and Q=T the sentence is true, but when P=F and Q=T the sentence is false.

(c) [4] Given two arbitrary sentences ๏ก and ๏ข in PL, ๏ก |= ๏ข if and only if

i. [2] the sentence ๏ก ๏ƒž ๏ข is _______valid_______________________ (one word answer)

ii. [2] the sentence ๏ก ๏ƒ™ ๏ƒ˜๏ข is _______unsatisfiable______________ (one word answer)

Question 8. [10] Representation in First-Order Logic

For each of the following sentences in English, is the accompanying sentence in first-order logic a good translation? If yes, answer yes. If no, explain why not.

(a) [5] No two UW students have the same ID number.

๏ƒ˜๏€ค p , q , n ( UWStudent ( p ) ๏ƒ™ UWStudent ( q ) ๏ƒ™ ๏ƒ˜(p = q)) ๏ƒž ( IDNum ( p , n ) ๏ƒ™ IDNum ( q , n ))

This is NOT correct because it uses ๏ƒž instead of ๏ƒ™ when quantified by ๏€ค. It should be:

๏ƒ˜๏€ค p , q , n UWStudent ( p ) ๏ƒ™ UWStudent ( q ) ๏ƒ™ ๏ƒ˜(p = q) ๏ƒ™ IDNum ( p , n )

๏ƒ™ IDNum ( q , n )

(b) [5] All UW students except math majors like CS majors.

๏€ข p , q ( UWStudent ( p ) ๏ƒ™ ๏ƒ˜ MathMajor ( p )) ๏ƒž ( UWStudent ( q ) ๏ƒ™ CSMajor ( q ) ๏ƒ™ likes ( p , q ))

This is NOT correct because it says that if there is at least one UW student who is not a math major, then everyone has to be a UW CS major. A corrected version is:

๏€ข p , q ( UWStudent ( p ) ๏ƒ™ ๏ƒ˜ MathMajor ( p ) ๏ƒ™ UWStudent ( q ) ๏ƒ™

CSMajor ( q )) ๏ƒž likes ( p , q )