CSC 486 Artificial Intelligence

On Agents
Using the AIMA Lisp Code


Objectives


Our AI text introduces the vacuum-cleaner micro-environment as follows:

  • PERCEPTS: In the vacumm-cleaner world, each vacuum-cleaner agent gets a three-element percept vector on each turn. The first element is a touch sensor in front of the agent which is 1 when the vacuum-cleaner bumps into something and NIL otherwise. The second is from a photosensor under the vacuum-cleaner that is used to sense whether or not dirt is there, and the third is from an infrared sensor that detects when the agent is in its home location.

  • ACTIONS: In the vacumm-cleaner world, each vacuum-cleaner agent may choose among five possible actions: go forward, turn right, turn left, vacuum dirt, and turn off.

  • GOALS: The goal for each vacumm-cleaner is to clean up and go home. This is measured with the performance measure tha awards 100 points for each piece of dirt vacuumed up, subtracts 1 point for each action, and subtracts 1000 points if it is not in the home location when it turns itself off.

  • ENVIRONMENT: The vacumm-cleaner world consists of a grid of squares some of which have obstacles such as walls, others have dirt, and still others are open. In the display, "#" represents an obstacle such as a wall and "*" represents dirt.

This assignment must be completed individually.

Your textbook authors have created agents, including the vacuum-cleaner agent, that you can run based upon the examples given in the text. A great deal of Lisp code is necessary to build up both the agent and the environment, so we would like to download this code and set it up to run on each of our individual computers.

  1. First, you will need to download the code from AIMA Lisp Code.
  2. Then unzip these files into a folder on your hard drive.
  3. Edit the file "aima.lisp" and change the value of the parameter *aima-root* on line 9 to reflect the location of the files. For a Windows file system, we will have something like "c:\\aima\\". Note that we have to use double backslashes, because backslashes are treated specially in Common Lisp strings. Next copy this file into the program directory of Allegro Lisp, so the Allegro Lisp interpreter can find the files you want.
  4. Next, start Allegro Lisp and enter the following into the command line:
    (load "aima.lisp")
    (aima-load 'name)

    Note that you will get some error messages about certain built-in functions being redefined. This is because these functions are desined to run in a variety of Lisp environments, including older environments. You can treat these errors as warnings and just push return at each of these messages. (Note: We should be able to turn this flag off, but I haven't yet figured out how.)
  5. You should now be ready to run the agent simulations.
After loading all of the code, try the following functions: Next, look through the Lisp code files and see if you can find where:
  1. The default agent is defined.
  2. The environment is set-up.
  3. The performance measure is defined.

Back to Introduction to Computer Programming with C++