The Traveling Salesman Problem


The purpose of this program is to take a series of locations, each of which have a certain cost of travel from A to B. Take a number of locations and calculate the cheapest route to travel between all locations. This is based on the idea that sometimes it is cheaper to travel from C to A to B rather then A to B to C. The algorithm works by calculating all possible permutations for the number of locations, and then checking to see if a route between those locations exists and also calculating the cheapest route to visit all of them and return to the first location.

I know the pages look boring, I intend to spruce it up a bit at some point.

First enter the number of locations or cities below.
Number of cities: