Well, your solution to TSP is always going to be far from perfect. No code, but here's how to go about 2-Opt. It's not too bad:
- You need a class called Stop that has a Next, Prev, and City property, and probably a Stops property that just returns the array containing Next and Prev.
- When you link them together, we'll call that a Tour. Tour has a Stop property (any of the stops will do), and an AllStops property, whose getter just walks the stops and returns them
- You need a method that takes a tour and returns its cost. Let's call that Tour.Cost().
- You need Tour.Clone(), which just walks the stops and clones them individually
- You need a method that generates the set of tours with two edges switched. Call this Tour.PossibleMutations()
- Start with your NN solution
- Call PossibleMutations() on it
- Call Cost() on all of them and take the one with the lowest result
- Repeat until the cost doesn't go down