WORCESTER POLYTECHNIC INSTITUTE
Computer Science Department

## CS4341 ❏ Artificial Intelligence ❏ B07

Mon, Tue, Thu, Fri - 1:00 - AK 233
Prof. David C. Brown, Fuller Lab 131, (508) 831-5618, dcb at cs.wpi.edu

Version: Sun Nov 11 18:16:17 EST 2007

## PROJECT 2 - A Star with a Blinding Flash

### Due Date

This project is due on Tuesday 20th November 2007

### Overview:

This project demonstrates two applications of AI techniques using the landscape domain. The first is to use the A* search for sorting trucks. The second application is to use the Min-Conflicts heuristic that was discussed in class.

### Part 1: Truck Sorting

It is important for the vehicles in a convoy carrying building materials to be in the right order. If they arrive in the right order they can be unpacked in the right order, so that materials needed first can be piled up nearer to where they are to be used for construction. Unfortunately, the vehicles actually arrive in a random order, as they come from different suppliers.

As they arrive, trucks are given a number that indicates their position in the convoy, and are parked in the next available space in a fenced in compound. Parking space is very limited and security is important.

Assuming that there are only 8 trucks, after they all arrive they might look something like this:

 7 4 2 8 1 3 5 6

while we actually want them in order so that the convoy can easily pull away from the parking area. i.e., it should look like this:

 1 2 3 4 5 6 7 8

You need to determine how the trucks are to be moved inside the compound to put them in order. Trucks can only move into the open space. Moving a truck moves the open space to where the truck was. Trucks only move up and down, or left and right: i.e., no diagonal movements.

Using the A* algorithm, and some appropriate heuristic underestimate that can be used to help determine the quality of different possible truck moves, find the smallest number of moves that puts the trucks into the desired order.

### Part 2: CCV Parking

Confusion causing vehicles (CCVs) give off a blinding flash with a lot of smoke and then disappear when they see another CCV. CCVs can see in straight lines in all eight movement directions. If one CCV can see another CCV we call it a "conflict", and run away quickly.

As you can imagine, parking them in a small space is a problem: after all, you want to save the confusion for others. We want to minimize the amount of space used.

Using eight CCVs, and the Min-Conflicts Heuristic, design a parking arrangement so that they can be parked in an 8 by 8 parking space in one corner of the landscape.

Start with an initial, random, complete assignment of one CCV to each "row" of the parking space. At any point in the problem-solving, if there are no conflicts, then report a solution. If there are conflicts then randomly pick a conflicted CCV, and move it in its row to a position that minimizes its conflicts. If more than one position is the minimum then select randomly. Zero conflicts is better than 1 conflict, 1 conflict is better than 2 conflicts, etc.

Repeat the process until a solution is found or until some maximum number of tries has been reached. Report the solution.

Develop your program for the NxN case, and use a constant to specialize it to work in the 8x8 case. Clearly other sizes would be useful for testing.

### Demonstrations:

To fully show the capabilities of your two algorithms include several test runs with different initial situations. For two of the key runs in part 1, and two in part 2, a clear, self-explanatory "demonstration" must be provided, not just the initial input and the answer.

### Submit

Projects must be completed by the start of class on the due date.

You must submit:

• On paper and via turnin:
• Clear documentation (pdf) that describes the design of your programs, data structures, and algorithms.
• A description of the design of and results from each test case.

• Via turnin only:
• All the test cases in your demonstration with the corresponding output that shows that the code is functioning correctly.
• All the code.

How to submit: