This preview shows page 1. Sign up to view the full content.
Unformatted text preview: ICS 171, Summer 2000: Midterm Solutions
1 Anna is a programmer at Anteater Computers and is in charge of writing a program to control their assembly machines. They have a robotic arm which must solder chips onto a circuit board at the points fA,B,C,D,E,F,G,Hg as shown below.
A0 1 1 0 1 0
11 00 D 11 00 11 00 11 00 C 11 00 11 00 11 00 G 11 00 11 00 E 11 00 11 00 H0 1 1 0 1 0 B 11 00 11 00 F 11 00 11 00 11 00 The arm starts in the top left corner and it must visit each point on the circuit board and return to its starting point. Help Anna minimize the total distance the arm must travel by formulating this problem as an optimization problem. a Develop a state representation for this optimization problem. State representation: an ordered list such as fA,C,D, . . . ,g which represents a tour through all the points. Note that in this representation every possible state is a viable tour solution. The tours states di er in their objective function value total distance the arm must travel. The goal of formulating an optimization problem is to nd the tour that results in the minimum possible distance the robotic arm needs to travel. b Suggest search operators that can be used to explore the state space. Any operator that alters the order the points are visited is okay. A simple operator is swapx,y which changes the position of any two elements. c Recommend a search algorithm for Anna to use to nd the best route for the arm to take. Justify your recommendation. Any iterative improvement algorithm would be ne here. So for example, hill climbing with multiple random restarts or simulated annealing is okay. Additionally, since the problem is small, exhaustive search is also feasible. 1 20 pts 2 Shown below is a graph representing a map navigation problem.
7 S 2 5 A 1 1 E 3 0 G 4 2 C 3 D B 1 5 4 4 The path cost is shown by the number on the links; the heuristic evaluation is shown by the number in the box. Assume that during search S is the start state and G is the goal state when placing nodes on the queue use alphabetical ordering to break ties assume that we never generate child nodes that appear as ancestors of the current node in the search tree a What is the order that breadth rst search will expand the nodes? SABCECDB G b What is the order that iterative deepening search will expand the nodes? SSABSAC G c What is the order that hill climbing search will expand the nodes? SBC G d What is the order that A* search will expand the nodes? SAEBC8C9 G 2 5 pts What are the conditions necessary for breadth rst search to be optimal? The operators should all have equal costs.
3 5 pts 4 Give an example of a search problem where hill climbing performs di erently from best rst search.
7 S 4 A B 2 0 G Here hillclimbing will get stuck at A whereas best rst search will backtrack and explore routes to G through B. 5 pts
5 What is the behavior of the A* algorithm if hn is a perfect heuristic and always returns the exact cost to the goal? A* will expand a single path that leads straight to the goal. 3 10 pts 6 Derek is an engineer at Zot Robotics and he is designing a robot that will travel between buildings on campus to deliver mail. He implemented the A* algorithm for path planning using straight line distance for the heuristic function but it does not seem to be working correctly as the robot often takes a sub-optimal path. Here is the pseudocode that he is using:
initialize: let Q = S while Q is not empty pull Q1, the first element in Q child_nodes = expand Q1 eliminate child_nodes which represent loops for each remaining child in child_nodes if child is a goal state report success and exit end for add children of node to Q sort Q according to fcost = pathcostS to node + hnode end while a What is the error in the pseudocode and why does it lead to sub-optimal solutions? The code should check if Q1 is a goal right after pulling it from the Q. The code should not check child states to see if they are goals. Checking child states immediately to see if they are goals circumvents the queue which is sorted by fcost. Thus, it is possible for a child node which represents an expensive solution to be found before a better possibility is explored on the queue. b Correct Derek's error and write out the proper pseudocode for A*.
initialize: let Q = S while Q is not empty pull Q1, the first element in Q if Q1 is a goal report success and exit child_nodes = expand Q1 eliminate child_nodes which represent loops add children of node to Q sort Q according to fcost = pathcostS to node + hnode end while 4 10 pts 7 Consider the problem of search in a three player game. You may assume that there are no alliances. The evaluation function now has three values , so that is the value of the state for player 1, is the value for player 2 and is the value for player 3. Player 1 moves rst at the root, followed by player 2 and then 3. Extend minimax search to 3 player games and complete the following game tree by lling in the backed up value triples for all nodes. Indicate the move chosen by player 1 by circling the corresponding state.
x; y; z x y z ( ) ( ) ( ) ( ) ( ) ( ) ( ) (3 2 4) (4 2 1) (6 1 2) (7 4 -1) (5 -1 -1) (-1 5 2) (7 7 -1) (5 4 5) In order to solve this problem there are two key points that you must realize. First, the triple represents the evaluation of a single board state and it must be backed up as a whole unit. Second, since we have three players we need to give each their own evaluation of the state and each player picks the board state that maximizes his or her element of : i.e., starting from the bottom of the tree player 3 picks so that is maximized, player 2 picks so that is maxmimized and nally player 1 picks so that is maximized.
x; y; z x; y; z z y x (3 2 4) (3 2 4) (-1 5 2) (3 2 4) (6 1 2) (-1 5 2) (5 4 5) (3 2 4) (4 2 1) (6 1 2) (7 4 -1) (5 -1 -1) (-1 5 2) (7 7 -1) (5 4 5) 5 ...
View Full Document