Assigned: Monday, Mar. 3, 2003
Due: Monday, Mar. 24, 2003
(5 points) Suppose that we run a greedy search algorithm with h(n)=-g(n). What sort of search will the greedy search emulate?
(5 points) Come up with heuristics for the following problems. Explain whether they are admissible, and whether the state spaces contain local maxima with your heuristic: (a) path planning in the plane with rectangular obstacles, (b) maze problems, as defined in Chapter 3.
(10 points) Sometimes there is no good evaluation function for a problem, but there is a good comparison method: a way to tell if one node is better than another, without assigning numerical values to either. Show that this is enough to do best-first search. What properties of best-first search do we give up if we only have a comparison method?
(10 points) Prove that if the heuristic function h obeys the triangle inequality, then the f-cost along any path in the search tree is nondecreasing. (The triangle inequality says that the sum of the costs from A to B and B to C must not be less than the cost from A to C directly).
There's a simple game you can play with silver dollars. (A silver dollar is a coin worth $1.) There are five (5) silver dollars on the table and you and your opponent take turns picking up 1, 2, or 3 coins until none is left. You get to keep each silver dollar you pick up. But, if you pick up the last coin, you have to pay $2 to your opponent. The object of the game is to finish with the most money.
We will use the DrScheme programming environment which is available for different platforms including Windows, Mac, and Linux. You can download it and install it on your system. It is also available in CIS labs under F:\applicat\plt\scheme\drscheme.
Define the function RotateLeft1, which takes a list as its argument and returns a new list in which the former 1st element becomes the last. For example:
(RotateLeft1 '(a b c d)) -> (b c d a) (RotateLeft1 '(a)) -> (a) (RotateLeft1 '()) -> ()
Define RotateRight1 like RotateLeft1 except that it rotates the list in the other direction:
(RotateRight1 '(a b c d)) -> (d a b c) (RotateRight1 '()) -> ()
Now define Rotate, as a function of two arguments, a list L and an integer N. It returns a new list formed by rotating L N times to the right if N>0 and to the left if N<0. Examples are:
(Rotate '(one two three four five) 2) -> (four five one two three) (Rotate '(one two three infinity) -3) -> (infinity one two three) (Rotate '( () (()) ((())) ) 0) -> (() (()) ((())))
In class we defined a function COUNTATOMS which computes the number of atoms in a list. Write a similar function countCells which computes the number of list cells a list uses. An atom uses no cells. The empty list (i.e., ()) uses no cells. A list uses one cell for each of its members in addition to the cells each of its members uses. For example:
(countCells '(one two three four five)) -> 5 (countCells '(one (two) three four five)) -> 6 (countCells '(define (square x) (* x x)) -> 8 (countCells '()) -> 0 (countCells 'foo) -> 0
Implement a function called binary-search that searches a binary tree for the presence of a node. The function should take as parameters a tree and a goal node. The function should return the node if found, and false otherwise. Make sure you tell us which tree representation you use and give us an example of a tree as part of the comments for this function.