VIEWS: 32 PAGES: 8 POSTED ON: 3/27/2010
CSB551 – Elements of Artificial Intelligence – Fall 2009 Homework #3 (CSPs and Game Playing) Due: 10/13/09 (5:15 pm) How to complete this HW: Either 1) type your answers in the empty spaces below each problem and print out this document, or 2) print this document and write your answers in the empty spaces on the printout. Return the homework in class, during office hours, or slip it under the door of Lindley 301F before 5:15 on Tuesday, 10/13/09. Your name: ……………………………………………………………………………………… Your email address: …………………………………………………………………………… Note on Honor Code: You must NOT look at previously published solutions of any of these problems in preparing your answers. You may discuss these problems with other students in the class (in fact, you are encouraged to do so) and/or look into other documents (books, web sites), with the exception of published solutions, without taking any written or electronic notes. If you have discussed any of the problems with other students, indicate their name(s) here: ……………………………………………………………………………………………… Any intentional transgression of these rules will be considered an honor code violation. General information: Justify your answers, but keep explanations short and to the point. Excessive verbosity will be penalized. If you have any doubt on how to interpret a question, tell us in advance, so that we can help you understand the question, or tell us how you understand it in your returned solution. Grading: Problem# Max. grade Your grade I 30 II 30 III 20 IV 20 Total 100 I. Constraint Satisfaction: Tiling with Dominoes (30 points) Consider the problem of tiling a planar region R with n dominoes. Each domino is a 21 rectangle. R is an arbitrary collection of 2n 11 squares. Figure 1 shows one example of such a region. The squares are numbered 1 through 2n. R is described by the set of all the pairs (a,b), a, b {1, 2, …, 2n}, a < b, such that square a and square b are edge- connected (i.e., have an edge in common). In this representation, let R = {p1, p2, …, pr}, where each pk, k = 1 to r, is a pair of edge-connected squares. Figure 1: Example of a region R where 2n = 16. 1. Formulate this problem as a constraint-satisfaction problem (CSP) where the dominoes are the variables, that is, define the variable domains and the constraints. 2. Formulate this problem as a CSP where the squares are the variables. In this formulation, keep the size of the domains as small as possible (4 values at most) by noticing that it does not matter which particular domino goes on a given pair of squares. 3. Construct two connected regions with 6 squares each, such the constraint-graph of the CSP formulated as in the above Question 2 is tree-structured for one region and not tree-structured for the other. 4. Consider the region R shown in Figure 1. We want you to solve the corresponding CSP formulated as in Question 2 using the backtracking search algorithm with forward checking and the most-constrained-variable heuristic. We ask you to report what each step of the algorithm performs in the following format: Step 1 (choice of variable and value): Here tell us which variable is selected and which value is assigned to it. Step 2 (forward checking): Here tell us what are the variables whose domains are reduced and what are their new domains. Step 3 (choice of variable and value): … Step 4 (forward checking): … Etc … When there is a tie among several variables using the most-constrained-variable heuristic, select the variables in increasing numerical order (of the squares). When several values can be assigned to a variable, select the values in increasing numerical order. We ask you to only fill in the first 12 steps. For Steps 1 and 2, briefly justify your answer. For the other steps, just give your answer. II. Constraint Propagation: (30 points) Alice, a junior computer science student, decides that she wants to get a minor in math. She has already taken many of the requirements as part of her CS degree; all that remains are the following courses. She must take both Analysis (A) and Analysis II (B). She then has three electives of which she must take two; these are: Linear Algebra (C), Number Theory (D) and Modern Algebra (E). Alice has three more semester of study to go. Fortunately, every course is offered every semester, but she can take at most two math courses during any given semester. Of course, there are constraints on how she must take the courses. Obviously she must take Analysis (A) before Analysis II (B). She must also take Linear Algebra (C) before Modern Algebra (E). She can only take Number Theory (D) once she's taken Modern Algebra (E). Sadly, Analysis (A) and Linear Algebra (C) are always offered at exactly the same time, so she cannot take both in the same semester. We will formulate Alice's scheduling problem as a CSP in which each variable corresponds to a class that Alice must take, and each variable can take values corresponding to the numbering of the remaining semesters: 1 for junior Spring 2 for senior Fall 3 for senior Spring for “does not take this course.” 1. Find an assignment of the variables to values (just by trial and error) that satisfies the constraints. 2. State the domain of the variables and the constraints in mathematical notation using the following symbols: =; ; ; ; <; >. 3. We will now solve this CSP using backtracking search with AC3 and forward checking, as follows. (a) What are the remaining domains after calling AC3 on the initial CSP with no assignments? (b) What are the remaining domains after assigning A = 1 and using forward checking? (c) What about after assigning A = 1 and B = 2? (d) Continue to solve the CSP, listing the steps of the algorithm as in Question I.4. Assign variables in alphabetical order. When assigning values, order the values from lowest to highest. (In other words, do not use the most-constrained-variable, most-constraining-variable, and least-constraining value heuristics) III. Alpha-Beta Pruning (20 points) Consider the following game tree, in which static scores are from the first player’s point of view: A is the root. Its children are B and C. B’s children are D, E, and F. Etc … The score (value of the static evaluation function) of J is -3, that of K is 5, … 1. Suppose the first player is the maximizing player. Write down in the table below the final or value computed at each node by the alpha-beta pruning procedure. [If no value has been computed at a node, leave the entry of the table empty.] What move will MAX make? A B C D E F G H I 2. What nodes would not be examined using the alpha-beta pruning technique? (Assume that at each level the nodes are considered in the order listed above from left to right.) 3. Assume that alpha-beta technique keeps track of the tree path that is responsible for the final alpha value of the root of the tree. This path connects the root of the tree to some leaf node, which we call x. What is this node (e.g., x = K)? 4. Assume the maximizing-player generates a sub-tree (singular extension) from the leaf node x that you have identified in Question 3, and gets the following sub-tree: Should the maximizing player change decision at A [Answer by just yes or no]? If there is a new leaf node that is responsible for the final alpha value of the root of the tree, what is this node? [Don’t provide any explanation.] IV. Adversarial Search (20 points) Consider the following two-player game on the board depicted below, with 4 squares arranged in a line and numbered 1 through 4. Each player has a single token. Player A starts with his token at location 1 and player B with his token at location 4. Player A moves first. The two players take turns. When it is X’s turn to play (where X = A or B), he must move his token to an open adjacent location in either direction. If the opponent’s token is at an adjacent location, then X may jump over his opponent’s token to the next location, if any. For example, if A is at 3 and B at 2, then A may move to 1. The game ends when either A’s token reaches location 4 (then A wins) or when B’s token reaches location 1 (then B wins). The value of the game for a player is +1 when he wins and 1 when he loses. [Read Question 2 before answering Question 1.] 1. Draw the complete game tree, using the following conventions: Write each node as (a,b), where a is the location of A’s token and b is the location of B’s token. Put the terminal nodes in square boxes and annotate each with the game value from A’s point of view in a circle. Put loop nodes (states that already appear on the path from the root) in double square boxes. 2. Mark each non-terminal, non-loop node in the tree you draw in Question 1 with its backed-up minimax value in a circle. Since the regular Minimax procedure seen in class does not handle loop nodes, you do not need to assign minimax values to loop nodes. However, explain below how you handle them. Is there any non-terminal, non- loop node for which you can’t back-up a minimax value? In the end, each node in your game graph should appear in one of the following forms: In addition some nodes may have no backed-up values. [Write the backed-up values on the tree that you drew for Question 1 and answer the remaining of Question 2 below.]