The Travelling Salesman Problem (TSP) is a famous optimisation problem studied in computer science. In the TSP, the salesman must visit every city in a connected road network once only, by the least-cost distances, and return to their starting city.

It belongs in the NP-Class.

Decision Version: NP-Complete

Given a complete graph with a cost , is there a Hamiltonian circuit whose total cost is

The decision version of the TSP is considered much easier to solve than the optimisation version. To verify this problem:

A proof is given. Proof in this case is a tour. For it to be in NP, we must be able to verify this proof with a deterministic algorithm in polynomial time. So first we have to check, whether every city is only visited once. This can be done at most in . Next we need to calculate the distances and sum them up. This can be done as well at most in . The last step is to check whether the calculated length is ≤k. The whole process would require a polynomial time →. - CS Stack Exchange

Therefore the problem is in NP. The problem also falls in NP-Complete due to a proof that Hamiltonian Circuit is NP-Complete

Optimisation Version: NP-Hard

Given a complete graph , find the minimum cost to complete a Hamiltonian Circuit.

It is important to note that the Optimisation problem can be transformed into a decision problem. This problem is NP-Hard because it is considered just as hard, if not harder, than every problem in NP.

Exhaustive/Brute-force approach:
  1. Start by choosing a random start node from nodes. possible choices
  2. Then choose the next node from adjacent nodes, not including the start node. choices
  3. Keep doing this.

Brute-force results in paths being generated, where is the number of nodes in the graph.

Dynamic Programming approach:#todo
2-opt Algorithm#todo