TSP Branch and Bound

Solve the TSP problem using branch and bound. We'll discuss the branch and bound algorithm in class. A few helpful handouts are included in the docs directory of the project description. The implementation of this algorithm will require more than an afternoon.

More Documentation

The algorithm is slightly complicated and is not in the textbook. More documentation is available: You will want to get copies of these and study them.

Input

You will read input from a database (available at http://vv.cs.byu.edu/~jones/cs312/tsp.mdb) The tProblems table contains the problem information and the tMatrics table contains the matrices that contain the cost of traveling between each pair of cities. The tables have the following structure:

tProblems
fieldtypecomments
keynumber
problemIDintegerIdentifier for this problem in the tMatrices and tSolutions tables
citiesintegerNumber of cities in this problem
timeBoundfloatHow many seconds allowed for solving this problem

tMatrices
fieldtypecomments
keynumber
problemintegerIdentifier for this problem, matches problemID in tPRoblems
rowintegerWhich row of the cost matrix is this row of the table?
contentsstringSpace-separated list of costs.

Implementation

You will implement a branch and bound algorithm to solve the tsp problem within the given time bound. If time expires before your algorithm finds a solution, then you should return the best solution you've found so far and exit. You don't need to invent your own algorithm. The algorithms discussed in class will work just fine.

Output

You will write your output to a table called tSolutions. This table has the following fields:

tSolutions
fieldtypecomments
keynumberThis is automatically updated, you can ignore it
problemintegerIdentifier for this problem, matches problemID in tPRoblems
costintegerCost of your solution
pathstringOrder in which you visited the cities in your solution. Start with the city in the first row. Name the cities A, B, C, ... Z, a, b, ... z where the city in the first row is A, the city in the second row is B and so forth
exactSolutionbooleanWas your solution exact?
timeSpentfloatAmount of time your algorithm spent solving this problem. If you run out of time, it is ok for this value to be slightly larger than the time bound (because you probably won't check the time between every pair of instructions and you will need a little time to turn off your timer and output the solution).

Grading

Absolute performance requirements are given in each input file. You'll be graded on how well you algorithm performs an a set of benchmark problems. Some problems will be designed to be completable by a "reasonable" implementation, other will be designed to too hard for a "reasonable" implementation to complete within the time bound. For the second class of problems, you'll be graded on how close your solution is to the optimal solution. For each such problem, we'll decide that an answer within x% of optimal gets full credit.

The two problems currently in the sample problems database contains resonable problems to which your algorithm should easily find an optimal solution. More problems, including some unreasonable ones, will be posted later. Note that the actual running times in the tSolutions table are made up, so don't get too concerned if you aren't running in that amount of time.

Code

See the class blog entry on a C# timer for a pointer to a C# timer you may want to use.

Handin

Mail your C# project to the TAs. Mail your self-assessment, if required by your professor, directly to your professor.

Due April 1