CS370 Program 2 (Due October 4, 2000)

In this assignment, you will solve various vacuum-cleaner agent problems using search. I will first describe the desired results of the assignment, and then I'll describe the details about how to do the assignment.


1. Desired Results

  1. Code defining the vacuum cleaner world as a search problem.

  2. A good admissible heuristic for the vacuum cleaner world.

  3. A trace of the A* search algorithm running on a 3-by-3 vacuum cleaner world (meaning the world is 4-by-4). Your trace should NOT list all of the nodes expanded, but rather just the resulting solution path. Your trace should also track the amount of time the search took.

  4. A different heuristic for use in a greedy search.

  5. A trace of the greedy search algorithm running on a 3-by-3 vacuum cleaner world.

  6. A trace comparing the number of nodes expanded, the total CPU time, and the solutions of A* and greedy search on three different randomly-generated 3-by-3 vacuum world problems.

  7. How does the running time of your search-based agent scale with the size of the vacuum cleaner world (e.g., for an nxn world as n gets large)? Justify your answer with results.

  8. Suppose you had to choose between using an A*-search-based agent and the rule-based agent that you wrote for last-week's assignment. To make such a choice, we must be able to trade off computer time versus execution time. In this case, the computer time is the time it costs your agent to choose its actions, and the execution time is the time it takes to execute the actions. Suppose that in a real situation, it takes 10 seconds to execute each action (move, turn, suck, or shut-off) and our goal is to get the room cleaned in the minimum total amount of time. How large would the world need to be before the search-based agent would be worse than the rule-based agent? Can you suggest a simpler search-based agent that could always out-perform the rule-based agent? (This should be possible, since the search-based agent knows the full state, whereas the rule-based agent only sees the bump, dirt, and home sensors.)

2. Implementation Details and Advice

The core of the code that you will use in this assignment is basically the same as in the previous assignment. However, it has also been expanded. The directory ~echown/courses/370/aima-java contains a wealth of code that will be useful for this assignment (as well as a lot of general AI code). You should create a similar directory in your own account and copy all of the files from my directory (and all of the subdirectories). You can easily do this by using the -R option on the cp command. E.g. cp -R ~echown/courses/370/aima-java/* .

The structure of the directory is that the source code lives in the src directory which further splits into a number of subdirectories (notably agent, search, and examples for this assignment. Compiled code lives in the classes subdirectory. Make files exist for everything (you may need to modify the agent Makefile to include new files that you add). Essentially you compile the system by issueing make from the home directory (e.g. aima-java) and then make-install to install the compiled code into the classes directory (there are other ways to do this of course). Then if you cd into the classes directory you can run programs. E.g. java aima/agents/VacuumRun will run the program defined in VacuumRun in the agents directory.

In the examples directory there are several files which should prove very helpful in completing this assignment. Notably, check out TestSearch.java and TwoThreeState.java which provide examples of running search agents. Pay careful attention to the use of package statements.

The agents directory contains several new files to augment the agent's perception. The world now runs as EnhancedVacuum.java and provides a percept from EnhancedPercept.java. You can run the program through EnhancedRun.java. You'll need to define your own search agent as well as a search state (use a file named EnhancedState.java, you should use TwoThreeState.java as a template for this).

Writing good heuristics is not the only way to make search faster. Think about search speed when you implement the operators.

Once you have written the EnhancedState.java file, you can apply various pre-written search algorithms to solve this problems using a style similar to the example (needless to say you should start by debugging on very small worlds). For this assignment it is not critical that you actually interface your operator selection routine to the results of the search (but its nice obviously), I'm mainly interested in the results of the search. Play around with the various search algorithms to see how much of an improvement A* is over the weak methods.

You need to be able to measure the CPU time required by a search algorithm. Java provides a function to do this called System.currentTimeMillis().

3. What to Hand In

Your source code (email as well), program traces, and answers to the questions in the first part. This assignment is much harder than the first assignment. I expect to hear tails of people spending many hours on it. I am giving you more than two weeks to do it, so won't blink even if you spend more than 20 hours on it.