Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
22C:145 ARTIFICIAL INTELLIGENCE Midterm Exam, March 2013 Open book and notes; no digital devices Total points = 100 1. (30 points) Suppose a search problem is represented by the following graph: where the cost of each edge is given, A is the start node and F is the goal. The heurist function is given as follows: n h(n) A 14 B 8 C 1 D 12 E 6 F 0 G 1 H 3 Assuming the neighbors of a node are explored in the alphabeta order of their names, please list the nodes entering the Closed list as the search goes on using the following strategies, respectively, and list the path found from A to F . • Depth-first search • Uniform-cost search: f (n) = g(n), the total cost of n from the start node. • A∗ : f (n) = g(n) + h(n) Answer keys: • Depth-first search: the open list is a stack (last-in first-out) open A CD CBEH CBEF CBE closed A AD ADH ADHF The path is A, D, H, F . • Uniform-cost search: f (n) = g(n), the total cost of n from the start node. The open list is a priority queue. open A C5, D2 C5, B6, E5, H9 B6, E5, H9, G9 B6, H7, G9 H7, G9, F 14 G9, F 13 F 13 closed A AD ADC ADCE ADCEB ADCEBH ADCEBHG ADCEBHGF The path is A, D, E, H, F . • A∗ : f (n) = g(n) + h(n) The open list is a priority queue. open A C6, D14 D14, G10 D14, E20 E11, B14, H12 B14, H10 B14, F 13 B14 The path is A, D, E, H, F . closed A AC ACG ACGD ACGDE ACGDEH ACGDEHF 2. (30 points) You are asked to solve the following initial configuation: 5-queen puzzle using the local search with the ∗ ∗ ∗ ∗ ∗ The evaluation function is the number of pairs of attacking queens (10 for this initial configuration). A neighbor of a configuration is defined as changing the position of a queen in one row to its neighboring (left or right) positions (so for 5-queen, there are at most 10 neighbors). Please show what is the best neighbor (pick one if there are more than one) in each move. The search stops when either you found a model or you reached a local optimum. Answer keys: The numbers in the following table indicate the number of conflicts when the queen in that row moves to its position: ∗ 7 7 ∗ 7 7 ∗ 7 7 ∗ 7 7 ∗ So any move will be equally good. Let us pick the first queen to move and recompute the number of conflicts: 10 4 ∗ ∗ 5 7 5 ∗ 5 6 ∗ 5 5 ∗ The best move will be for the second queen to move left. We reach a local minimum as shown below: no moves reduce the number of conflicts below 4. 7 ∗ ∗ 7 4 4 ∗ 4 4 ∗ 4 4 ∗ 3. (40 points) Please first express the following statements in First-order logic with quantifiers (no free variables), and then in clauses along with a resolution proof that Marcus hates Caesar. Finally, write clauses in Prolog format and provide the query that Marcus hates Caesar. Marcus is a Pompeian. All Pompeians are Romans. Caesar is a ruler. All Romans are either loyal to Caesar or hate Caesar. People only try to assassinate rulers they are not loyal to. Macus trys to assasinate Caesar. Answer keys: For first-order formulas, clauses, and the resolution proof, please consult http://www-rci.rutgers.edu/∼cfs/472 html/Logic KR/resolution.html The Prolog program is given below: pompeian(marcus). roman(X) :- pompeian(X). ruler(caesar). hate(X, caesar) :- roman(X), notLoyalto(X,caesar). notLoyalto(X, Y) :- tryassasinate(X,Y), ruler(Y). tryassasinate(marcus, caesar). The Prolog query is ?- hate(marcus, caesar).