30
CSC242 Midterm Review 1. A 3-foot-tall monkey is in a room with where some bananas are suspended from the 8-foot ceiling. The monkey would like to get the bananas. The room contains two stackable, movable, climbable 3-foot-high crates. Help the monkey by formulating this as a state-space search problem.

CSC242 Midterm Review - University of Rochester€¦ · CSC242 Midterm Review 1. A 3-foot-tall monkey is in a room with where some bananas are suspended from the 8-foot ceiling. The

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: CSC242 Midterm Review - University of Rochester€¦ · CSC242 Midterm Review 1. A 3-foot-tall monkey is in a room with where some bananas are suspended from the 8-foot ceiling. The

CSC242 Midterm Review

1. A 3-foot-tall monkey is in a room with where some bananas are suspended from the8-foot ceiling. The monkey would like to get the bananas. The room contains twostackable, movable, climbable 3-foot-high crates. Help the monkey by formulating thisas a state-space search problem.

Page 2: CSC242 Midterm Review - University of Rochester€¦ · CSC242 Midterm Review 1. A 3-foot-tall monkey is in a room with where some bananas are suspended from the 8-foot ceiling. The

CSC242 Midterm Review

2. Beer is being served at a party in CSB601. The keg is delivered with a 12-cup measure,an 8-cup measure, and a 3-cup measure. The bartender can fill a measure completelyfrom the keg, empty a measure completely down the drain, or pour the entire contentsof a measure into another measure. Marty orders a cup of beer. Help the bartender byformulating this as a state-space search problem.

Page 3: CSC242 Midterm Review - University of Rochester€¦ · CSC242 Midterm Review 1. A 3-foot-tall monkey is in a room with where some bananas are suspended from the 8-foot ceiling. The

CSC242 Midterm Review

3. Your goal is to navigate a robot out of a maze built on a n×n grid with walls separatingthe corridors. You are given a map of the maze at the outset. The robot starts in thecenter of the maze facing north. You can turn the robot to face north, south, east, orwest. You can direct the robot to move forward a certain distance, although it will stopbefore hitting a wall.

(a) Formulate this as a state-space search problem. How large is the state space?

(b) In navigating a maze, the only place we need to turn is at the intersection of twoor more corridors. Reformulate the problem using this observation. How large isthe state space?

(c) From each point in the maze, we can move in any of the four directions until wereach a turning point, and this is the only action we need to do. Reformulate theproblem using these actions. Do we need to keep track of the robot’s orientation?Does this affect how the plan we find gets executed?

(d) Suppose that instead of a grid, the maze is defined on a square from [−1,−1] to [1, 1]on the Cartesian plane. The positions of the walls and of the robot are arbitraryreal coordinates. Reformulate the problem. How big is the state space?

Page 4: CSC242 Midterm Review - University of Rochester€¦ · CSC242 Midterm Review 1. A 3-foot-tall monkey is in a room with where some bananas are suspended from the 8-foot ceiling. The

CSC242 Midterm Review

4. Consider a state space where the start state is number 1 and each state k has twosuccessors numbered 2k and 2k + 1 respectively.

(a) Draw the portion of the state space for states 1 to 15.

(b) Suppose the goal state is 11. List the order the nodes will be visited for breadth-firstsearch, depth-first search to a depth limit of 3, and iterative deepening depth-firstsearch.

Page 5: CSC242 Midterm Review - University of Rochester€¦ · CSC242 Midterm Review 1. A 3-foot-tall monkey is in a room with where some bananas are suspended from the 8-foot ceiling. The

CSC242 Midterm Review

5. Define what it means for a heuristic to be admissible. Give a simple example of anadmissible heuristic for a problem and explain why it’s admissible.

Page 6: CSC242 Midterm Review - University of Rochester€¦ · CSC242 Midterm Review 1. A 3-foot-tall monkey is in a room with where some bananas are suspended from the 8-foot ceiling. The

CSC242 Midterm Review

6. Consider the following heuristic functions for the 8-puzzle:

h1: Number of misplaced tilesh2: Sum of Manhattan distances of tiles from final positions

(a) Are these heuristics admissible? Why or why not?

(b) Consider the heuristich = h1 + h2

Is this heuristic admissible? Prove it or give a counterexample.

Page 7: CSC242 Midterm Review - University of Rochester€¦ · CSC242 Midterm Review 1. A 3-foot-tall monkey is in a room with where some bananas are suspended from the 8-foot ceiling. The

CSC242 Midterm Review

7. Suppose you need to search a regular (evenly-spaced), unbounded, discrete, 2D grid ofpoints. Points are connected to their four neighbors (north, south, east, and west). Thestart state is the origin (0, 0). The goal state is (x, y).

(a) What is the branching factor b in this state space?

(b) How many distinct states are there at depth k (for k > 0)?

(c) What is the maximum depth of search for goal (x, y)?

(d) For a state (u, v), consider the heuristic h = |u−x|+ |v− y|. Is h admissible? Whyor why not?

(e) How many nodes are expanded by an A* search using h?

(f) Is h still admissible if some links (edges) are removed?

(g) Is h still admissible if some links (edges) are added between non-adjacent states?

Page 8: CSC242 Midterm Review - University of Rochester€¦ · CSC242 Midterm Review 1. A 3-foot-tall monkey is in a room with where some bananas are suspended from the 8-foot ceiling. The

CSC242 Midterm Review

8. (a) True or false: Local search is a form of systematic search.

(b) True or false: Local search is guaranteed to find the optimal solution to a problem.

(c) What is the minimum number of states that a local search algorithm must keeptrack of? What is the maximum?

(d) What are the advantages and disadvantages of keeping track of more states in localsearch?

Page 9: CSC242 Midterm Review - University of Rochester€¦ · CSC242 Midterm Review 1. A 3-foot-tall monkey is in a room with where some bananas are suspended from the 8-foot ceiling. The

CSC242 Midterm Review

9. Suppose you have a set of Boolean (true/false) variables, and a set of rules of the form“if x1 is true, then x2 must be false,” or “if both x1 and x2 are true, then either x3 or x4

are true,” and so on. Your goal is to find values (true or false) for each of the Booleanvariables (xi) such that all the rules are satisfied.

Formulate this so-called Boolean Satisfiability Problem as a local search problem.

Page 10: CSC242 Midterm Review - University of Rochester€¦ · CSC242 Midterm Review 1. A 3-foot-tall monkey is in a room with where some bananas are suspended from the 8-foot ceiling. The

CSC242 Midterm Review

10. Define the following terms briefly:

(a) Zero-sum game

(b) Perfect information

(c) Terminal state

(d) Utility function

(e) Game tree

Page 11: CSC242 Midterm Review - University of Rochester€¦ · CSC242 Midterm Review 1. A 3-foot-tall monkey is in a room with where some bananas are suspended from the 8-foot ceiling. The

CSC242 Midterm Review

11. Consider the following game tree:

S0

S2 S3S1

S4 S52 5 7 7 11 5

8 4 6 1 4

M1 M3

M4 M5 M6 M7 M8 M9 M10 M11

M12 M13 M14 M15 M16

M2

Terminal states are squares (with their utility). Non-terminals are circles. Edges arelabeled with the move that leads to the successor state.

(a) Label the levels of the tree with MAX and MIN.

(b) Compute the minimax value of the non-terminal nodes.

(c) What is the optimal move for the first player? What is the second player’s optimalresponse?

Page 12: CSC242 Midterm Review - University of Rochester€¦ · CSC242 Midterm Review 1. A 3-foot-tall monkey is in a room with where some bananas are suspended from the 8-foot ceiling. The

CSC242 Midterm Review

12. Games are interesting because they are too hard to solve optimally. That is, it is generallytoo hard to compute the optimal move.

(a) What specifically makes games hard in this sense? Use the terminology we haveseen in class.

(b) What is pruning?

(c) What replaces the terminal test when a search is cutoff before reaching a terminalstate?

(d) Can alpha-beta pruning ever lead to sub-optimal decisions?

(e) Can cutting off search ever lead to sub-optimal decisions?

Page 13: CSC242 Midterm Review - University of Rochester€¦ · CSC242 Midterm Review 1. A 3-foot-tall monkey is in a room with where some bananas are suspended from the 8-foot ceiling. The

CSC242 Midterm Review

13. Consider the following game tree:

S0

S1 S3S2

S4S52 5 77 11 5

8 4 61 4

Terminal states are squares (with their utility). Non-terminals are circles.

Display or describe the results of game tree search with alpha-beta pruning on this gametree. Show which nodes are pruned and the final utility bounds for all the internal nodesthat are not pruned.

Page 14: CSC242 Midterm Review - University of Rochester€¦ · CSC242 Midterm Review 1. A 3-foot-tall monkey is in a room with where some bananas are suspended from the 8-foot ceiling. The

CSC242 Midterm Review

14. Suppose we are doing game tree search with alpha-beta pruning. In order to maximizepruning, in what order would it be best for the successors to be generated at a MAXlevel? What about at a MIN level? Is it practical to do this? Why or why not?

Page 15: CSC242 Midterm Review - University of Rochester€¦ · CSC242 Midterm Review 1. A 3-foot-tall monkey is in a room with where some bananas are suspended from the 8-foot ceiling. The

CSC242 Midterm Review

15. (a) What are the three components of a constraint satisfaction problem?

(b) What is a solution to a constraint satisfaction problem?

Page 16: CSC242 Midterm Review - University of Rochester€¦ · CSC242 Midterm Review 1. A 3-foot-tall monkey is in a room with where some bananas are suspended from the 8-foot ceiling. The

CSC242 Midterm Review

16. A map coloring is an assignment of colors to regions on a map such that no two adjacentregions have the same color. Consider the map of Australia shown below:

(a) Formulate the problem of coloring this map with three colors as a constraint satis-faction problem.

(b) How many solutions are there to this CSP? Justify your answer.

(c) How many solutions are there if four colors are allowed? Justify your answer.

(d) How many solutions are there if two colors are allowed? Justify your answer.

Page 17: CSC242 Midterm Review - University of Rochester€¦ · CSC242 Midterm Review 1. A 3-foot-tall monkey is in a room with where some bananas are suspended from the 8-foot ceiling. The

CSC242 Midterm Review

17. Alice, Betty, and Carol are in a book club. They’re trying to figure which of fivedifferent books they should read next. The books are: Dreams From My Father byBarack Obama, Lord of the Rings by J.R.R. Tolkein, Artificial Intelligence: A ModernApproach by Stuart Russell and Peter Norvig, Harry Potter and The Sorceror’s Stone,by J.K. Rowling, and The Fabric of the Cosmos: Space, Time, and the Texture of Realityby Brian Greene.

In this book club, they don’t all have to read the same book. Alice only likes fiction,while Betty only likes non-fiction. Furthermore, Alice won’t read whatever either Bettyor Carol are reading, while Betty and Carol always read the same book.

(a) Formulate this as a constraint satisfaction problem.

(b) Propagate unary constraints and show the results.

(c) Solve the CSP using a combination of search and constraint propagation. At eachstep (assignment or propagation), show the state of the problem. (Hint: You shouldonly need two iterations if you’ve done it right.)

Page 18: CSC242 Midterm Review - University of Rochester€¦ · CSC242 Midterm Review 1. A 3-foot-tall monkey is in a room with where some bananas are suspended from the 8-foot ceiling. The

CSC242 Midterm Review

18. Complete truth tables for the following formulas:

(a) ¬P

(b) P ⇒ Q

(c) ¬Q⇒ ¬P

(d) ¬P ⇒ ¬Q

(e) P ∧ (Q ∨R)

(f) (P ∧Q) ∨ (P ∧R)

Page 19: CSC242 Midterm Review - University of Rochester€¦ · CSC242 Midterm Review 1. A 3-foot-tall monkey is in a room with where some bananas are suspended from the 8-foot ceiling. The

CSC242 Midterm Review

19. Establish by model checking whether P ⇒ Q |= ¬Q⇒ ¬P .

Page 20: CSC242 Midterm Review - University of Rochester€¦ · CSC242 Midterm Review 1. A 3-foot-tall monkey is in a room with where some bananas are suspended from the 8-foot ceiling. The

CSC242 Midterm Review

20. Establish by model checking whether {P, P ⇒ Q} |= Q.

Page 21: CSC242 Midterm Review - University of Rochester€¦ · CSC242 Midterm Review 1. A 3-foot-tall monkey is in a room with where some bananas are suspended from the 8-foot ceiling. The

CSC242 Midterm Review

21. Briefly define the following properties of a sentence or set of sentences:

(a) Satisfiable

(b) Unsatisatisfiable (do not use “satisfiable” in your answer).

(c) Tautology

Page 22: CSC242 Midterm Review - University of Rochester€¦ · CSC242 Midterm Review 1. A 3-foot-tall monkey is in a room with where some bananas are suspended from the 8-foot ceiling. The

CSC242 Midterm Review

22. Briefly define the following properties of inference rules:

(a) Soundness

(b) Completeness

Page 23: CSC242 Midterm Review - University of Rochester€¦ · CSC242 Midterm Review 1. A 3-foot-tall monkey is in a room with where some bananas are suspended from the 8-foot ceiling. The

CSC242 Midterm Review

23. One rule of thumb for faculty hiring might be that a person who is not sociable (¬S) istenurable (T ) if he or she is brilliant (B), but otherwise is not tenurable. Which of thefollowing are correct representations of this assertion? Justify your answer.

(a) (¬S ∧ T ) ⇐⇒ B

(b) ¬S ⇒ (T ⇐⇒ B)

(c) ¬S ⇒ ((B ⇒ T ) ∨ ¬T )

Page 24: CSC242 Midterm Review - University of Rochester€¦ · CSC242 Midterm Review 1. A 3-foot-tall monkey is in a room with where some bananas are suspended from the 8-foot ceiling. The

CSC242 Midterm Review

24. Use resolution to prove the sentence ¬B ∧ ¬A from the following set of clauses:

S1: A ⇐⇒ (B ∨ E)

S2: E ⇒ D

S3: C ∧ F ⇒ ¬BS4: E ⇒ B

S5: B ⇒ F

S6: B ⇒ C

Hints: (1) Resolution requires conversion to a particular form. (2) To prove a conjunctionit suffices to prove each conjunct separately.

Page 25: CSC242 Midterm Review - University of Rochester€¦ · CSC242 Midterm Review 1. A 3-foot-tall monkey is in a room with where some bananas are suspended from the 8-foot ceiling. The

CSC242 Midterm Review

25. Briefly define the following terms related to first-order logic:

(a) Domain or domain of discourse

(b) Term

(c) Atomic sentence or atomic formula

Page 26: CSC242 Midterm Review - University of Rochester€¦ · CSC242 Midterm Review 1. A 3-foot-tall monkey is in a room with where some bananas are suspended from the 8-foot ceiling. The

CSC242 Midterm Review

26. (a) Translate the following sentence of first-order logic into good, natural English:

∀x, y, l SpeaksLanguage(x, l) ∧ SpeaksLanguage(y, l)⇒Understands(x, y) ∧ Understands(y, x).

(1)

(b) Explain why this sentence is entailed by the sentence

∀x, y, l SpeaksLanguage(x, l) ∧ SpeaksLanguage(y, l)⇒ Understands(x, y). (2)

(c) Translate the following into first-order logic:

i. Mutual understanding leads to mutual friendship.

ii. Friendship is transitive (i.e., my friend’s friend is also my friend).

Page 27: CSC242 Midterm Review - University of Rochester€¦ · CSC242 Midterm Review 1. A 3-foot-tall monkey is in a room with where some bananas are suspended from the 8-foot ceiling. The

CSC242 Midterm Review

27. Write out the axioms for reasoning about the wumpus’ location, using a constant symbolWumpus , unary predicate Smelly , and binary predicates In and Adjacent . Hint: Thereis only one wumpus.

Page 28: CSC242 Midterm Review - University of Rochester€¦ · CSC242 Midterm Review 1. A 3-foot-tall monkey is in a room with where some bananas are suspended from the 8-foot ceiling. The

CSC242 Midterm Review

28. For each pair of atomic sentences, give the most general unifier if one exists:

(a) P (A,B,B) and P (x, y, z)

(b) Q(y, g(A,B)) and Q(g(x, x), y)

(c) Older(Father(y), y) and Older(Father(x), John)

(d) Knows(Father(y), y) and Knows(x, y)

Page 29: CSC242 Midterm Review - University of Rochester€¦ · CSC242 Midterm Review 1. A 3-foot-tall monkey is in a room with where some bananas are suspended from the 8-foot ceiling. The

CSC242 Midterm Review

29. From “Horses are animals,” it follows that “The head of a horse is the head of an animal.”Demonstrate that this inference is valid by doing the following:

(a) Translate the premise and the conclusion into first-order logic using the predicatesHeadOf (h, x) (“h is the head of x”), Horse(x) (“x is a horse”), and Animal(x) (“xis an animal”).

(b) Negate the conclusion, and convert the premise and the conclusion into conjunctivenormal form.

(c) Use resolution to show that the conclusion follows from the premise.

Page 30: CSC242 Midterm Review - University of Rochester€¦ · CSC242 Midterm Review 1. A 3-foot-tall monkey is in a room with where some bananas are suspended from the 8-foot ceiling. The

CSC242 Midterm Review

30. Suppose a knowledge base contains just the following first-order Horn clauses:

Ancestor(Mother(x), x)

Ancestor(x, y) ∧ Ancestor(y, z)⇒ Ancestor(x, z)

Consider a forward-chaining algorithm that, on the jth iteration, terminates if the KBcontains a sentence that unifies with the query, and otherwise adds to the KB everyatomic sentence that can be inferred from the sentences already in the KB after iterationj − 1.

(a) For each of the following queries, say whether the algorithm will (1) give an answer(if so, give that answer); or (2) terminate with no answer; or (3) not terminate.

i. Ancestor(Mother(y), John)

ii. Ancestor(Mother(Mother(y)), John)

iii. Ancestor(Mother(Mother(Mother(y))), y)

iv. Ancestor(Mother(John),Mother(Mother(John)))

(b) Can a resolution algorithm prove the sentence ¬Ancestor(John, John)?