Computer Science Department

CS4341 ❏ Artificial Intelligence

Version: Tue Apr 9 22:49:36 EDT 2013

PROJECT 2 - A Star with a Blinding Flash

Due Date

This project is due on Fri 12 April 2013


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.

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 correct 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. They can't move outside the compound. Two trucks can't occupy the same space.

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 plan with 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.

Don't worry about how they'll get to their designated position: they'll be dropped (very carefully) into position by a helicopter.

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.


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.


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:

Please note:

  1. Clearly label all printed work with your name & user name.
  2. Clearly label each file with a helpful name.
  3. ZIP your entire project directory. Make sure it only contains the files to be submitted. Use "zip" and not some other compression tool.
  4. Name the file as your user name + "-proj2.zip"   For example, "dcbrown-proj2.zip"
  5. Submit the zipped project using web turnin.
  6. The project's turnin assignment name is "project2".
  7. Your turnin password should have been emailed to you.
Please let us know if you still have problems.