Project 1 FAQ

Here are the Frequently Asked Questions about the Vacuum Cleaning Agent project.

  1. How do I compile the code?

    I find the best way to compile Java packages is to be at the directory above the package and issue a command like javac vacworld/ You may have to set your CLASSPATH environment variable to "." as well. This says the current directory is in Java's class path.

  2. I'm using the department's Unix systems to run the code, and I'm get the following compilation error:
    Method add(agent.Agent) not found in class java.util.Vector.
    I haven't altered any of your files. Is it somehow the version of jdk I'm running?

    Yes, it is most likely the version of JDK you are running. Vector.add() is a method from version 1.2 of Java. You are probably using an earlier version (type "java -version" to find out). See if you can run /apps/j2se/bin/java. If so, just add "/apps/j2se/bin" to your path (before whatever directory your current version of java is in, of course), so that this will become your default version of Java. If Java 1.2 isn't accessible from the machine you're using, you could always just change the line to the Java 1.0 equivalent. That is. change:

  3. How will you evaluate whether my agent is intelligent?

    The primary criteria for intelligence is the ability to complete the task, regardless of room configuration. As mentioned in the assignment, the most intelligent agents will also make efficient use of their moves. That is, the fewer forwards, turns, and sucks that agent performs, the more intelligent it is (assuming it completes the task successfully). In general, turns will be considered less expensive than forwards and sucks.

  4. I know that in order to be considered intelligent, the agent must move efficiently. However, will thinking time be considered in grading the agent?

    Since the environment is static, thinking time is not critical. Thinking times between moves on the order of a few minutes are perfectly acceptable (although it is possible to develop good agents who can make decsions much more quickly). However, agents that regularly take five or more minutes between decisions may be penalized for being implemented inefficiently.

  5. I have question about whether the agent will know the "area" it should traverse. Consdier, the given example:
        1  2  3  4  5
     1              W
     2     D     D  W
     3              W
     4  W
     5  W  W     D
    The position (1,5) will never be directly reachable by the robot. The robot will never know if it is empty or if there is an obstacle there. Thus it will think it has not completed the job.

    The robot can assume that any unreachable square has a wall there (this will be the case in all examples that I test the robot on).

  6. Will you use the VacuumState.getRandomState() Method to generate he testing sequence?

    No, I will not use getRandomState() to test the program. I will have a set of preselected room configurations that I will test everybody's agents on.

  7. I believe I have found an error in VacuumState.getRandomState(). The code has:
        roll = Math.random();
        if (i != INIT_X && i != INIT_Y && roll <= WALL_CHANCE) {
 [i][j] = WALL;
    but this does not seem correct.

    Yes, that is a bug. Since I will not be using getRandomState(), it is not important, but if you want to use it to test your programs, then you should changese lines to:

        roll = Math.random();
        if ((i != INIT_X || j != INIT_Y) && roll <= WALL_CHANCE) {
  [i][j] = WALL;

    Note, that "i != INIT_Y" was changed to "j != INIT_Y" and the previous "&&" was changed to "||".