Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Q1. [6 pts] Search: Heuristic Function Properties, Study notes of Logic

For each heuristic function, circle whether it is admissible and whether it is consistent with respect to the search problem given above.

Typology: Study notes

2021/2022

Uploaded on 09/27/2022

russel85
russel85 🇬🇧

4.6

(5)

285 documents

1 / 12

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Q1. [6 pts] Search: Heuristic Function Properties
For the following questions, consider the search problem shown on the left. It has only three states, and three
directed edges. Ais the start node and Gis the goal node. To the right, four dierent heuristic functions are defined,
numbered I through IV.
A
B
G
23
6
h(A)h(B)h(G)
I410
II 540
III 430
IV 520
(a) [4 pts] Admissibility and Consistency
For each heuristic function, circle whether it is admissible and whether it is consistent with respect to the
search problem given above.
Admissible? Consistent?
IYes No Ye s No
II Yes No Ye s No
III Yes No Ye s No
IV Yes No Ye s No
II is the only inadmissible heuristic, as it overestimates the cost from B:h(B) = 4, when the actual cost to Gis 3.
To check whether a heuristic is consistent, ensure that for all paths, h(N)h(L)path(N!L), where Nand L
stand in for the actual nodes. In this problem, h(G) is always 0, so making sure that the direct paths to the goal
(A!Gand B!G) are consistent is the same as making sure that the heuristic is admissible. The path from Ato
Bis a dierent story.
Heuristic I is not consistent: h(A)h(B)=41=3@
path(A!B) = 2.
Heuristic III is consistent: h(A)h(B)=43=1 2
Heuristic IV is not consistent: h(A)h(B)=52=3@
2
(b) [2 pts] Function Domination
Recall that domination has a specific meaning when talking about heuristic functions.
Circle all true statements among the following.
1. Heuristic function III dominates IV.
2. Heuristic function IV dominates III.
3. Heuristic functions III and IV have no dominance relationship.
4. Heuristic function I dominates IV.
5. Heuristic function IV dominates I.
6. Heuristic functions I and IV have no dominance relationship.
For one heuristic to dominate another, all of its values must be greater than or equal to the corresponding
values of the other heuristic. Simply make sure that this is the case. If it is not, the two heuristics have no
dominance relationship.
3
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Q1. [6 pts] Search: Heuristic Function Properties and more Study notes Logic in PDF only on Docsity!

Q1. [6 pts] Search: Heuristic Function Properties

For the following questions, consider the search problem shown on the left. It has only three states, and three directed edges. A is the start node and G is the goal node. To the right, four di↵erent heuristic functions are defined, numbered I through IV.

A

B

G

h(A) h(B) h(G)

I 4 1 0

II 5 4 0

III 4 3 0

IV 5 2 0

(a) [4 pts] Admissibility and Consistency For each heuristic function, circle whether it is admissible and whether it is consistent with respect to the search problem given above.

Admissible? Consistent?

I (^) Yes No Yes No

II (^) Yes No Yes No

III (^) Yes No Yes No

IV (^) Yes No Yes No

II is the only inadmissible heuristic, as it overestimates the cost from B: h(B) = 4, when the actual cost to G is 3.

To check whether a heuristic is consistent, ensure that for all paths, h(N ) h(L)  path(N! L), where N and L stand in for the actual nodes. In this problem, h(G) is always 0, so making sure that the direct paths to the goal (A! G and B! G) are consistent is the same as making sure that the heuristic is admissible. The path from A to B is a di↵erent story.

Heuristic I is not consistent: h(A) h(B) = 4 1 = 3 (^) @ path(A! B) = 2. Heuristic III is consistent: h(A) h(B) = 4 3 = 1  2 Heuristic IV is not consistent: h(A) h(B) = 5 2 = 3 (^) @ 2

(b) [2 pts] Function Domination Recall that domination has a specific meaning when talking about heuristic functions. Circle all true statements among the following.

  1. Heuristic function III dominates IV.
  2. Heuristic function IV dominates III.
  3. Heuristic functions III and IV have no dominance relationship.
  4. Heuristic function I dominates IV.
  5. Heuristic function IV dominates I.
  6. Heuristic functions I and IV have no dominance relationship.

For one heuristic to dominate another, all of its values must be greater than or equal to the corresponding values of the other heuristic. Simply make sure that this is the case. If it is not, the two heuristics have no dominance relationship.

Q2. [30 pts] Search problems

It is training day for Pacbabies, also known as Hungry Running Maze Games day. Each of k Pacbabies starts in its own assigned start location s (^) i in a large maze of size M xN and must return to its own Pacdad who is waiting patiently but proudly at g (^) i ; along the way, the Pacbabies must, between them, eat all the dots in the maze.

At each step, all k Pacbabies move one unit to any open adjacent square. The only legal actions are Up, Down, Left, or Right. It is illegal for a Pacbaby to wait in a square, attempt to move into a wall, or attempt to occupy the same square as another Pacbaby. To set a record, the Pacbabies must find an optimal collective solution.

(a) [5 pts] Define a minimal state space representation for this problem.

The state space is defined by the current locations of k Pacbabies and, for each square, a Boolean variable indicating the presence of food.

(b) [2 pts] How large is the state space?

(M N ) k^ · 2 M N

(c) [3 pts] What is the maximum branching factor for this problem?

(A) 4 k^ (B) 8 k^ (C) 4 k^2 M N^ (D) 4 k^2

Each of k Pacbabies has a choice of 4 actions.

(d) [6 pts] Let M H(p, q) be the Manhattan distance between positions p and q and F be the set of all positions of remaining food pellets and p (^) i be the current position of Pacbaby i. Which of the following are admissible heuristics?

h (^) A :

P (^) k i=1 M H(p^ i^ ,g^ i^ ) k h (^) B : max (^1) ik M H(p (^) i , g (^) i )

(h) [2 pts] How many possible environmental configurations are there in the initial belief state, before the Pacbabies receive any wetness percepts?

2 M N

(i) [4 pts] Given the current belief state, how many di↵erent belief states can be reached in a single step?

(A) 4 k^ (B) 8 k^ (C) 4 k^2 M N^ (D) 4 k^2 After each of 4 k^ joint movements of Pacbabies, there are 2k^ possible joint percepts, each leading to a distinct belief state.

Q3. [9 pts] Expectimax

Your little brother Timmy has a birthday and he was promised a toy. However, Timmy has been misbehaving lately and Dad thinks he deserves the least expensive present. Timmy, of course, wants the most expensive toy. Dad will pick the city from which to buy the toy, Timmy will pick the store and you get to pick the toy itself. You don’t want to take sides so you decide to pick a toy at random. All prices (including X and Y) are assumed to be nonnegative.

Five Little Monkeys

Games of Berkeley

Emeryville Berkeley

$50 $20 $50 $30 $25 $35 X $36 Y

Dad

Little

Timmy

You

The Ark Toys R Us

(a) [1 pt] Fill in the values of all the nodes that don’t depend on X or Y.

(b) [3 pts] What values of X will make Dad pick Emeryville regardless of the price of Y?

Dad will pick Emeryville if the value of the Berkeley node is more than the value of the Emeryville node ($40), that is if: x + y + 36 3

40 , x > 84 y , x > 84 .

(c) [3 pts] We know that Y is at most $30. What values of X will result in a toy from Games of Berkeley regardless of the exact price of Y?

Games of Berkeley will be chosen if the value of the “Five Little Monkeys” node is less than the value of the “Games of Berkeley” node ($30):

x + y + 36 3

< 30 , x < 54 y , x < 24

(d) [2 pts] Normally, alpha-beta pruning is not used with expectimax. However, with some additional information,

Q4. [17 pts] CSPs

(a) Pacman’s new house After years of struggling through mazes, Pacman has finally made peace with the ghosts, Blinky, Pinky, Inky, and Clyde, and invited them to live with him and Ms. Pacman. The move has forced Pacman to change the rooming assignments in his house, which has 6 rooms. He has decided to figure out the new assignments with a CSP in which the variables are Pacman (P), Ms. Pacman (M), Blinky (B), Pinky (K), Inky (I), and Clyde (C), the values are which room they will stay in, from 1-6, and the constraints are:

i) No two agents can stay in the same room ii) P > 3 vi) B is even iii) K is less than P vii) I is not 1 or 6 iv) M is either 5 or 6 viii) |I-C| = 1 v) P > M ix) |P-B| = 2

(i) [1 pt] Unary constraints On the grid below cross out the values from each domain that are eliminated by enforcing unary constraints. P 1 2 3 4 5 6 B 1 2 3 4 5 6 C 1 2 3 4 5 6 K 1 2 3 4 5 6 I 1 2 3 4 5 6 M 1 2 3 4 5 6 The unary constraints are ii, iv, vi, and vii. ii crosses out 1,2, and 3 for P. iv crosses out 1,2,3,4 for M. vi crosses out 1,3, and 5 for B. vii crosses out 1 and 6 for I. K and C have no unary constraints, so their domains remain the same. (ii) [1 pt] MRV According to the Minimum Remaining Value (MRV) heuristic, which variable should be assigned to first?

# P # B # C # K # I M

M has the fewest value remaining in its domain (2), so it should be selected first for assignment. (iii) [2 pts] Forward Checking For the purposes of decoupling this problem from your solution to the previous problem, assume we choose to assign P first, and assign it the value 6. What are the resulting domains after enforcing unary constraints (from part i) and running forward checking for this assignment? P 6 B 1 2 3 4 5 6 C 1 2 3 4 5 6 K 1 2 3 4 5 6 I 1 2 3 4 5 6 M 1 2 3 4 5 6 In addition to enforcing the unary constraints from part i, the domains are further constrained by all constraints involving P. This includes constraints i, iii, v, and ix. i removes 6 from the domains of all variables. iii removes 6 from the domain of K (already removed by constraint i). v removes 6 from the domain of M (also already removed by i). ix removes 2 and 6 from the domain of B. (iv) [3 pts] Iterative Improvement Instead of running backtracking search, you decide to start over and run iterative improvement with the min-conflicts heuristic for value selection. Starting with the following assignment:

P:6, B:4, C:3, K:2, I:1, M:

First, for each variable write down how many constraints it violates in the table below. Then, in the table on the right, for all variables that could be selected for assignment, put an x in any box that corresponds to a possible value that could be assigned to that variable according to min-conflicts. When marking next values a variable could take on, only mark values di↵erent from the current one.

Variable # violated P 0 B 0 C 1 K 0 I 2 M 0

P

B

C x K I x x M

Both I and C violate constraint viii, because |I-C|=2. I also violates constraint vii. No other variables violate any constraints. According to iterative improvement, any conflicted variable could be selected for assignment, in this case I and C. According to min-conflicts, the values that those variables can take on are the values that minimize the number of constraints violated by the variable. Assigning 2 or 4 to I causes it to violate constraint i, because other variables already have the values 2 and 4. Assigning 2 to C also only causes C to violate 1 constraint.

Neither MRV nor LCV can have an e↵ect.

Only MRV can have an e↵ect.

Only LCV can have an e↵ect.

Both MRV and LCV can have an e↵ect.

Q5. [20 pts] Propositional logic

(a) [6 pts] Consider a vocabulary with only four symbols, A, B, C, and D. For each of the following sentences, how many possible worlds make it true?

  1. (A ^ B) _ (C ^ D) 7 (4 for A ^ B, 4 for C ^ D, minus 1 for the model that satisfies both).
  2. ¬(A ^ B ^ C ^ D) 15 — it’s the negation of a sentence with 1 model.
  3. B ) (A ^ B) 12 — it’s true when B is false (8) and when B is true and A is true (4).

(b) [8 pts] A certain procedure to convert a sentence to CNF contains four steps (1-4 below); each step is based on a logical equivalence. Circle ALL of the valid equivalences for each step.

  1. Step 1: drop biconditionals a) (↵ , ) ⌘ ((↵ ) ) ^ ( ) ↵)) b) (↵ , ) ⌘ ((↵ ) ) _ ( ) ↵)) c) (↵ , ) ⌘ (↵ ^ )
  2. Step 2: drop implications

a) (↵ ) ) ⌘ (↵ _ ¬) b) (↵ ) ) ⌘ (¬↵ _ ) c) (↵ ) ) ⌘ (¬↵ ^ )

  1. Step 3: move not inwards a) ¬(↵ _ ) ⌘ (¬↵ ^ ¬) b) ¬(↵ _ ) ⌘ (¬↵ _ ¬) c) ¬(↵ ^ ) ⌘ (¬↵ _ ¬)
  2. Step 4: move “or” inwards and “and” outwards a) (↵ _ ( ^ )) ⌘ (↵ _ _ ) b) (↵ _ ( ^ )) ⌘ ((↵ _ ) ^ (↵ _ )) c) (↵ _ ( ^ )) ⌘ ((↵ ^ ) _ (↵ ^ ))