FJK Home CPE/CSC 480 F03 Syllabus Schedule Lecture Notes Assignments Project Other Links
CPE/CSC 480 F03 Artificial Intelligence Fall 2003
Points 25
Deadline Tue, Oct. 28

CPE/CSC 480 F03 Assignment 2

In the second assignment, you will explore various aspects of search methods. Your task is to program an agent that systematically investigates its environment by using some of the search methods discussed in class.

The Agent Playground

The emphasis in this assignment lies on the search methods, and less on the programming of the environment. As part of his master's thesis, a graduate student has implemented an environment for the Wumpus World in Java. This environment will also be the basis for the search algorithms. It will be made available via Blackboard, accompanied by instructions on how to use it, and an example of a simple reflex agent that randomly moves around in the environment.

This "playground" is a rectangular array of squares where the agent can move around. Each square has coordinates, and may have properties such as empty, occupied, clean, dirty, etc.

The agent inspects a square for its properties by querying the environment. Based on that information and possibly knowledge from previous queries, the agent determines the next square to be investigated. The agent is capable of basic movements such as move-forward, turn-right, and turn-left. After the agent has made a decision about an action, it communicates the information to the environment, which is then updated accordingly.

The agent is not allowed to "have a peek" at the overall setup in order to optimize its activities; it must rely on the information it receives from the envorinment, and possibly on conjectures drawn from this information.

Design your system in such a way that it can be easily enhanced. For example, it should be straightforward to deal with extra properties for the field or individual squares, or to change its dimensions. The agent should be able to have different or additional sensors and actuators, perform different actions, use expanded internal representations, perform more complex internal calculations, etc. Ideally, you should be able to modify your agent so that it can be expanded for more complex tasks like retrieving the gold in the Wumpus world.

Search Methods

In this assignment, you have to implement four search methods
  1. breadth-first search (clockwise, starting at the noon position)
  2. depth-first search (clockwise, starting at the noon position)
  3. greedy search
  4. A* search
The task of the agent is defined as follows: It starts from its initial position, by default the tile with the coordinates (0,0), and has to reach a certain tile identified as the goal position. On its path to the goal, it may have to clean tiles, and the amount of dirt on a tile affects the path cost of the agent. For some of the search methods, the agent needs additional information to estimate the cost from the current node to the goal node. In this case, the agent can ask the field manager for a hint. The manager can provide at least the following two hints:
  1. An estimate of the distance between the current and the goal node based on the geometrical properties of the field.
  2. The compass direction of the goal relative to the current position (i.e. North, South, East, West)
These hints, however, incur additional costs for the agent. Usually the costs are higher for more valuable hints.

On-Line vs. Off-Line Search

In a real-world setting, the agent most likely would perform an on-line search, interleaving the computations to determine the search with the execution of the corresponding steps. In this context, you should implement an off-line search where the agent explores the environment "mentally" by asking the environment manager about the properties of the squares it is inspecting, gradually building up a search tree and possibly a map of the environment. After it has identified the goal, it calculates a direct path from the initial position to the goal, and then executes the respective actions to move along the path.

This approach has an important consequence for the agent. When it encounters a dead end during its investigation (i.e. there are no uninspected reachable squares from the current square), it can continue its investigation with another square on the fringe easily by "mentally" jumping to that square. An off-line agent has to back up and retrace its steps in order to reach the next square on the fringe, thus increasing the path cost considerably.

Practical Aspects

The agents must keep track of the tiles it has already visited, and for some search methods, it must be able to backtrack (retrace its steps). The agent should build a data structure that tracks the path it has taken so far, allowing it to retrace its steps. The agent can also construct its own internal map, which may make navigation considerably easier. Again, please note that the agent does not know the relevant aspects of the environment in advance, such as the dimension of the playground, or the placement of obstacles.

Testing and Evaluation

As a test case, you have to use the field below, with the following meaning of the symbols: the field has the dimension 20x20, and is delimited by dashes - and horizontal bars |. The starting position is marked by the letter S, and the goal is in the tile marked by the letter G. Obstacles in the field are indicated by X, and dirt is indicated by a number which reflects the amount of dirt, or the number of cleaning operations an agent has to perform. Instead of cleaning a dirty field, the agent may go around the dirt pile; this, of course, adds to the cost.

The search costs for the agent are:

The path costs for the agent are:

For the evaluation of your program, we will also use other maps. Check the Blackboard Discussion forum for additional samples.
   0        9        19
   --------------------
 0|S                  |
  |  1      X         |
  | 121     X         |
  |12321XXXXX        1|
  | 121             12|
  |  1   XXXXXXXXXXXX3|
  |      X          12|
  |      X G         1|
  |      X            |
 9|       XX1         |
10|        121        |
  |       12321       |
  |      1234321      |
  |       12321       |
  |        121        |
  |         1         |
  |                   |
  |                   |
  |                   |
19|                   |
   --------------------

Your program must provide the following information: This information should be displayed for every step, and written into a log file for later analysis. It is also a good idea to add the configuration of the field and the search method used to your file.

Extra Credit Opportunities

Implement Your Own Environment

You can also implement your own playground for an extra credit of 20% of the total number of points for this assignment. If you decide to do this, you may inspect the sample playground, but not use any of its code.

Display the Agent's Internal Map

The provided environment shows only the environment from an omnicient observer's perspective. The agent itself can build up its own internal map as it explores the environment. Usually an appropriate data strucuture such as an array or a graph is used by the agent to represent information about the environment. Displaying the agent's view of the environment can be helpful for the analysis of the agent's behavior. Adding this display to the environment can earn you another 10% of extra credit. You can combine this with the implementation of your own environment for a total of 30% extra credit.

Assignment Submission

Submit your assignment through the Drop Box on Blackboard. Blackboard will let you know if there are problems with this process, but I believe the feedback for a successful submission is less clear. I recommend to keep a copy of the complete assignment on a computer that is easily accessible, just in case...

If you have gneral questions or comments concerning the programming aspects of the homework, post them on the Blackboard Discussion Forum for the assignment. the grader, Hafeez Jaffer, and the author of the environment program, John Clayton, will check that forum on a regular basis, and try to answer your questions.

New to Java?

If you don't have programming experience in Java, follow this link to some pointers about Java.

FJK Home CPE/CSC 480 F03 Syllabus Schedule Lecture Notes Assignments Project Other Links
© 2000-2023
Franz Kurfess