Colorado State University CS540: Artificial Intelligence (Spring, 98)

Computer Science Department
Colorado State University

Assignment 3: UCPOP

Assigned:  April 10
Due:  April 24
NTU/SURGE Due:  May 1

In this assignment, you will be playing with the partial-order planning system named UCPOP. You will use it to solve planning problems in the blocks world domain. To learn more about UCPOP and the author, visit UCPOP WWW Site. UCPOP is contained in the ~cs540/ucpop directory. That directory also contains a postscript version of the UCPOP manual.

I have written a short lisp file that I call start-ucpop.lisp that will load UCPOP for you and that defines two functions to help you with this assignment. I suggest you copy this to your working directory and modify it as you wish. The contents of this file is:


;;;;;;;;;;;;;;;;;start-ucpop.lisp;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(load "/s/bach/a/class/cs540/ucpop/loader.lisp")
(load-ucpop)
(in-package ucpop)

;;;Run new  everytime you have modified your lab3.lisp file.
(defun update ()
  (let ((filename "lab3.lisp"))
    (compile-file filename)
    (load filename)))

;;;Simplifies typing the search control function name
(defun run (x)
  (bf-control x))

;;;Get ready to do some heavy crunching.
;;;This much takes 5 minutes on schubert
(setf *search-limit* 50000)
(format t "~&*search-limit* set to ~d" *search-limit*)

;;;Remind user that they must set the package.
(format t "~%~%****Don't forget to do  (in-package ucpop)****~%~%")

First, add /usr/local/allegro4.3.1/bin/ to your PATH environmental variable. This gives you access to the class-lisp command that starts the Allegro Common Lisp environment. So, after modifying your PATH and copying start-ucpop to your working directory, you may do the following:

unix> class-lisp         {to start Allegro Common Lisp}

> (load "start-ucpop")

> (update)        {recompiles and loads your lab3.lisp file}

> (run 'blocks-problem)    {or whatever problems you have defined}

Sussman's anomaly, as discussed in class, can be represented in UCPOP as given in the file domains.lisp and repeated here:

(define (domain blocks-world-domain)
    ;; Define step for placing one block on another.
    (:operator puton
	      :parameters (?X ?Y ?Z)
	      :precondition (and (on ?X ?Z) (clear ?X) (clear ?Y)
				 (neq ?Y ?Z) (neq ?X ?Z)
				 (neq ?X ?Y) (neq ?X Table))
	      :effect 
	      (and (on ?X ?Y) (not (on ?X ?Z))
		   (when (neq ?Z Table) (clear ?Z))
		   (when (neq ?Y Table) (not (clear ?Y))))))

(define (problem sussman-anomaly)
  :domain 'blocks-world-domain
  :inits ((block A) (block B) (block C) (block Table)
	  (on C A) (on A Table) (on B Table) 
	  (clear C) (clear B) (clear Table))
  :goal (and (on B C) (on A B)))

If you put just this in a file names lab3.lisp, then you can do
> (update)

> (run 'sussman-anomaly)
You should do this just to get practice running UCPOP. If nothing else, at least turn in a printout of what you get when running the Sussman anomaly.

Of course, just running this is not the objective of this assignment. The objective is to modify this problem definition to add the ability to move the blocks from one room, R1, to another, R2. Then, use it to solve this problem:

You must figure out how to move all blocks from one room to another, then build the tower. The constraints on putting a block onto another block and onto the floor are the same as in Sussman's anomaly. The constraints for moving blocks is that a single block can be moved at a time and that block must be clear.

I suggest you follow this strategy. First, make the changes you think are necessary to the list of operators. Then, define some very simple problems. Start with a problem in which all blocks are on the floor in room R1 and set the goal to be all blocks on the floor of room R2. You may also test a simple stacking task. Start with all on the floor and try to stack just A onto B. Then it is a short step to building the whole tower.

Explore the limits of this. Make progressively harder tasks until you find one that can't be solved given the resources you have. The start-ucpop.lisp file sets the *search-limit* fairly high, so you do have significant resources. But even with these settings, you might find some problems that can't be solved and terminate due to other resource limits in about 5 minutes.

Hand in your Lisp code and a printout of the output from UCPOP on the problems you tried. (Remember the dribble function?) You must include the output for the full tower problem. Also, include the output and Lisp code from at least two of the simpler problems you used to debug your program. Finally, include the Lisp code and output of a problem that doesn't terminate successfully.

As always, I also want a written report summarizing your experience and addressing questions like: What was the most difficult part? How practical do you think UCPOP is for serious planning problems? What can you do differently to speed up the solution of this assignment's problem (Hint: perhaps a different search control)?



Copyright © 1998 Chuck Anderson
anderson@cs.colostate.edu