## U.C. Berkeley CS267: TSP Specifics

Here are a few things you may find helpful:
• A complete Multipol task queue interface is available here
• A paper by Chih-Po Wen, A Distributed Task Queue for Load Balancing on the CM5, is available here
• html
• postscript
• An example program that uses the task queue is in /usr/castle/share/proj/cpwen/queen.
• This is a distance matrix distmat.mat to be used in the assignment (we will use a different one for the contest).
• You can visually inspect the resutls generated by your program. Please, get the matlab program plotpath.m , and coordinates of the cities xy.mat . Let path.dat be the name of your output file (it has to contain a closed path that includes all cities; city numbers start at 1): 1 15 4 5 10 .... 15 1. The following sequence of matlab instructions will display the result:
```	>> load -ascii xy.mat
>> plotpath(xy,path)
```
• What to turn in:
• Complete clear simple writeup explaining your algorithm, how you used the task queue, etc.
• Any comments you might have on the assignment.
• Your best results for the test matrix and a matlab picture.
• Pointer to the code.
• The due date is April 1. We will have a TSP contest on April 2, 6pm, in 405 Soda.

• What to assume: Make no assumptions about the size of the matrix (although you can probably guess that it'll be on the larger size). Also, as stated in the assignment, make no assumption about the topology (i.e., Euclidean N-dimensional, Triangle inequality, etc.). You'll be given a square distance matrix in standard matlab format. That is, if 'm' is a matlab matrix, the format will be what matlab writes out in the following command:
```    save filename.mat m -ascii
```
(Note how matlab saves infinities, but if you use scanf for reading, it should be able to handle them properly.). Please call your program 'ptsp' and accept arguments such that the following will work:
```     (your_path)/ptsp -n {matrix_size} -f {matrix_file}
```
Yes, the '-n' argument is redundant (you can get this information from the matrix_file) but we thought that providing a '-n' argument would make parsing the file a bit easier. Your program, of course, will need to be world executable.

You'll get to run your program for about 5 minutes on a dedicated 32 processor CM5 (i.e., rodin, note 32MB/node). Although this isn't the most accurate way, we'll judge relative program performance by having someone (guess who?) hit ^C about 5 minutes after starting the program. The last complete tour that has been printed to the screen will be accepted as your group's final solution. This means you'll have to balance the I/O printing granularity and computation tradeoff appropriately. Please output the solutions on a single line in a list-of-cities format. Follow it with the current tour length so we can get an idea on how things are going. For example, each tour output should be:

```   1 c2 c3 c4 ... cn 1
current_tour_length
```
I.e., output a row vector on one line followed by a number on the next. c_i is a number from 2 to N, where N is the number of cities, and c_i != c_j, for i != j. This means we'll start and end with city 1. Each final solution will be verified as a valid tour, and the shortest tour wins. While a group's program is running, one group member will give a brief overview of the algorithm while the rest of us watch.

So, as a checklist before the race:

• Mail me your group members.
• In the above mail, send me the path to your program that will work during the race.
• Make sure your program is world executable.
• Make sure your program accepts the correct arguments.
• Make sure your program prints solutions using single line format followed by the tour length.
• And finally, make sure your program works!!
Good luck to you all!!