Travelling Salesman Problem
Given a list of cities and their pairwise distances, the aim of this study is to find the shortest
possible tour that visits each city exactly once. Here I embrace the Heuristic approach which
means that algorithms for finding feasible and acceptable solutions that will give upper
bounds on the objective value. Tour construction under heuristic approach is based on the
Nearest Neighbour, Greedy, and Tour Improvement heuristics.
Briefly, Nearest Neighbour method is perhaps the simplest and most straightforward TSP
heuristic. The key to this algorithm is to always visit the nearest city. The Greedy heuristic
gradually constructs a tour by repeatedly selecting the shortest edge and adding it to the tour
as long as it doesn’t create a cycle with less than N edges, or increases the degree of any node
to more than 2. We must not add the same edge twice of course. In Toru Improvement, Once
a tour has been generated by some tour construction heuristic, we might wish to improve that
solution. There are several ways to do this, but the most common ones are the 2-opt and 3-
opt local searches. Their performances are somewhat linked to the construction heuristic
used.
Nearest Neigbour Heuristic
As briefly discussed above, the idea is that you start at a random city, from which you travel
to the nearest city that has not been visited before. This is repeated until you have passed
every city. The advantage with this heuristic is that it yields a quick solution, however not
necessarily the optimal one. I use three different data having different number of cities. he
advantage with this heuristic is that it yields a quick solution, however not necessarily the
optimal one.
The Nearest Neighbour heuristic constructs a feasible tour as follows:
1. Randomly choose a start node and start with the “tour” that only consists of that node.
2. Repeat the following step until all nodes are contained in the tour:
Among all nodes not yet in the tour, choose one that is closest to the last inserted node and
append it to the tour.
The pseudo code of nearest neighbor algorithm is the following:
1. Stand on an arbitrary vertex as current vertex.