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 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 completely from the keg, empty a measure completely down the drain, or pour the entire contents of a measure into another measure. Marty orders a cup of beer. Help the bartender by formulating this as a state-space search problem. CSC242 Midterm Review 3. Your goal is to navigate a robot out of a maze built on a n × n grid with walls separating the corridors. You are given a map of the maze at the outset. The robot starts in the center of the maze facing north. You can turn the robot to face north, south, east, or west. You can direct the robot to move forward a certain distance, although it will stop before 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 two or more corridors. Reformulate the problem using this observation. How large is the state space? (c) From each point in the maze, we can move in any of the four directions until we reach a turning point, and this is the only action we need to do. Reformulate the problem 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 arbitrary real coordinates. Reformulate the problem. How big is the state space? CSC242 Midterm Review 4. Consider a state space where the start state is number 1 and each state k has two successors 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-first search, depth-first search to a depth limit of 3, and iterative deepening depth-first search. CSC242 Midterm Review 5. Define what it means for a heuristic to be admissible. Give a simple example of an admissible heuristic for a problem and explain why it’s admissible. CSC242 Midterm Review 6. Consider the following heuristic functions for the 8-puzzle: h1 : h2 : Number of misplaced tiles Sum of Manhattan distances of tiles from final positions (a) Are these heuristics admissible? Why or why not? (b) Consider the heuristic h = h1 + h2 Is this heuristic admissible? Prove it or give a counterexample. CSC242 Midterm Review 7. Suppose you need to search a regular (evenly-spaced), unbounded, discrete, 2D grid of points. Points are connected to their four neighbors (north, south, east, and west). The start 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? Why or 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? 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 keep track of? What is the maximum? (d) What are the advantages and disadvantages of keeping track of more states in local search? 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 Boolean variables (xi ) such that all the rules are satisfied. Formulate this so-called Boolean Satisfiability Problem as a local search problem. 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 CSC242 Midterm Review 11. Consider the following game tree: S0 M2 M1 S1 M4 2 M5 5 M3 S2 M6 M7 7 7 M8 11 S3 M9 M10 5 M11 S4 M12 M13 8 4 S5 M14 6 M15 M16 1 4 Terminal states are squares (with their utility). Non-terminals are circles. Edges are labeled 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 optimal response? CSC242 Midterm Review 12. Games are interesting because they are too hard to solve optimally. That is, it is generally too hard to compute the optimal move. (a) What specifically makes games hard in this sense? Use the terminology we have seen in class. (b) What is pruning? (c) What replaces the terminal test when a search is cutoff before reaching a terminal state? (d) Can alpha-beta pruning ever lead to sub-optimal decisions? (e) Can cutting off search ever lead to sub-optimal decisions? CSC242 Midterm Review 13. Consider the following game tree: S0 S1 7 11 S2 5 2 5 S3 7 S5 1 S4 4 8 4 6 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 game tree. Show which nodes are pruned and the final utility bounds for all the internal nodes that are not pruned. CSC242 Midterm Review 14. Suppose we are doing game tree search with alpha-beta pruning. In order to maximize pruning, in what order would it be best for the successors to be generated at a MAX level? What about at a MIN level? Is it practical to do this? Why or why not? 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? CSC242 Midterm Review 16. A map coloring is an assignment of colors to regions on a map such that no two adjacent regions 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 satisfaction 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. CSC242 Midterm Review 17. Alice, Betty, and Carol are in a book club. They’re trying to figure which of five different books they should read next. The books are: Dreams From My Father by Barack Obama, Lord of the Rings by J.R.R. Tolkein, Artificial Intelligence: A Modern Approach 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 Reality by 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 Betty or 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 each step (assignment or propagation), show the state of the problem. (Hint: You should only need two iterations if you’ve done it right.) 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) CSC242 Midterm Review 19. Establish by model checking whether P ⇒ Q |= ¬Q ⇒ ¬P . CSC242 Midterm Review 20. Establish by model checking whether {P, P ⇒ Q} |= Q. 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 CSC242 Midterm Review 22. Briefly define the following properties of inference rules: (a) Soundness (b) Completeness CSC242 Midterm Review 23. One rule of thumb for faculty hiring might be that a person who is not sociable (¬S) is tenurable (T ) if he or she is brilliant (B), but otherwise is not tenurable. Which of the following are correct representations of this assertion? Justify your answer. (a) (¬S ∧ T ) ⇐⇒ B (b) ¬S ⇒ (T ⇐⇒ B) (c) ¬S ⇒ ((B ⇒ T ) ∨ ¬T ) 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 ⇒ ¬B S4: E ⇒ B S5: B ⇒ F S6: B ⇒ C Hints: (1) Resolution requires conversion to a particular form. (2) To prove a conjunction it suffices to prove each conjunct separately. 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 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). (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). (2) CSC242 Midterm Review 27. Write out the axioms for reasoning about the wumpus’ location, using a constant symbol Wumpus, unary predicate Smelly, and binary predicates In and Adjacent. Hint: There is only one wumpus. 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) 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 predicates HeadOf (h, x) (“h is the head of x”), Horse(x) (“x is a horse”), and Animal (x) (“x is an animal”). (b) Negate the conclusion, and convert the premise and the conclusion into conjunctive normal form. (c) Use resolution to show that the conclusion follows from the premise. 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 KB contains a sentence that unifies with the query, and otherwise adds to the KB every atomic sentence that can be inferred from the sentences already in the KB after iteration j − 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)?