(load "/Accounts/courses/cs327/aima/aima.lisp")
This loads the utilities that come with our textbook, Artificial Intelligence: A Modern Approach (AIMA).
Next, you should copy the Vacuum-World code into whichever directory you are doing your Lisp programming. Here is one example:
cp /Accounts/courses/cs327/assign2/vacuum.lisp ~
The "~" is shorthand for your own home directory.
You can now further copy or modify this program at will.
(load "vacuum.lisp")
You can then run the environment by typing
(run-vacuum 5 7) ; Put whatever numbers here you like
where 5 is the size of the x-axis, and 7 is the size of the y-axis. (Try varying these). You should then see a diagram of Vacuum-World, with the agent indicated by an "A", and dirt indicated by "#". Every time you press the Enter key, the agent will suck up dirt if there is some in the current position, or move forward in the direction in which the agent points. Above the grid, the recent percept list and action taken are shown. The percept list contains three positions:
(bump-sensor dirt-sensor home-sensor)
bump-sensor is T if the agent has just bumped into a wall.
dirt-sensor is T if there is a piece of dirt underneath the agent.
home-sensor is T of the agent is in its home location (bottom left).
If you continue to press Enter, the agent will slide up the left hand side of the room, then back down the left side again until it reaches its home position again. For more information on Vacuum-World, checkout out Problem 2.5 on page 51 in your text - I've modelled this Vaccum-World closely after the ideas presented there. The performance measurement, for example, is the same.
2. Copy the file "vacuum.lisp" to "vacuum_state.lisp". Again change the function choose-action (and other aspects of the Lisp code if necessary) to add some form of internal state to the agent so that it performs better than your reflex agent above. How close does your agent come to the ideal agent for this environment? Is the environment:
> (load "vacuum_reflex.lisp") ; similarly with vacuum_state
> (run-vacuum 3 7) ; or whatever values I choose
You should also turn in a flat file called hw2.txt, which contains the
answers to all questions asked above.