CS 351 Lisp and Symbolic Computation
Homework 2: GPS


Due: February 29, 2000, 3:15PM


The GPS code from Norvig is in gps.lisp and gps1.lisp in /u/mooney/cs351-code/. You first need to load the files, auxmacs.lisp and auxfns.lisp (in that order), which contain utility functions that all of Norvig's code utilizes. You may want to copy all of these files to a directory of your own, change the value of the variable *PAIP-source-files* in auxfns.lisp to the directory where you put all your CS351 files. This will allow the requires function in auxfns which the Norvig files use to load other Norvig files to access these files from your own directory. You may also want to compile and load the resulting compiled versions for any or all of these file to improve performance.

Instructions for electronically submitting solutions are at http://www.cs.utexas.edu/users/mooney/cs351/turnin.html. Only hand in functions that you change or new ones you define. Your system should work when loaded on top of the existing GPS system. Discussion of any questions below should be given as comments in the file at an appropriate point.

First do exercise 4.4 from the textbook (p. 148) involving solving the ``not looking after you don't leap problem'' by passing achieve the goals that remain to be solved so that it can pick an action for the current goal that will also allow all the remaining goals to be solved. Be sure to also modify achieve-all as well so it does not duplicate effort by re-achieving the remaining goals after achieve has already satisfied them. Make sure your revised code solves the ``taxi problem'' on page 143.

Next, also add the notion of protected goals as discussed in Exercise 4.5 by passing down a list of already achieved goals and avoid choosing subsequent operators that clobber them. However, you do not need to consider re-ordering steps. Your final version should be able to solve both orderings of goals for the ``taxi problem'' (p. 143) and the goal ordering ((b on c) (a on b)) for the Sussman Anomaly (p. 142); however, it should produce a suboptimal (4 operator) solution to this problem.

Add the hack of trying both the forward and reversed orderings of the goals in achieve-all (as on p. 139). Now you should be able to solve both goal orderings for the Sussman Anomaly. What happens if you make achieve-all try all possible permutations of the goals?

A trace of my final solution running on the taxi problem (both goal orders) and Sussman anomaly (both goal orders) is given in /u/mooney/cs351-code/hw2-trace. You can ignore all of the warning messages that are generated due to constantly redefining various functions. The Sussman anomaly traces are fairly long due to the significant amount of backtracking required for these problems (many caused by trying reverse goal orderings).