📅  最后修改于: 2023-12-03 14:58:32.827000             🧑  作者: Mango
This problem is from the Graduate Aptitude Test in Engineering (GATE) 2004 for Information Technology. It is a question on algorithms and requires the candidate to develop an efficient algorithm.
Given a Hamiltonian Cycle in a complete undirected graph $G(V,E)$ with $n$ vertices ($n\ge5$) and weight function $w$, we want to find an algorithm to solve the Traveling Salesman Problem (TSP), i.e. to find a Hamiltonian cycle with minimum weight.
This problem is a classic example of dynamic programming. We can solve this problem using the Bellman-Held-Karp algorithm, which has a time complexity of $O(2^nn^2)$.
The Bellman-Held-Karp algorithm is a bottom-up approach that builds up a solution for subproblems of increasing size until the main problem is solved. We start with subproblems of size 2, where we simply connect two vertices and assign the weight of the edge between them as the cost. Then we build up to subproblems of size $n$ by adding one vertex at a time to the existing subproblems.
To illustrate this, let $C(S,i)$ be the cost of the minimum weight Hamiltonian cycle that visits all the vertices in set $S$ and ends at vertex $i$. We can decompose $C(S,i)$ into smaller subproblems by considering all possible subsets $S'$ of $S$ that exclude vertex $i$, and then adding the cost of the edge $(j,i)$ for all $j\in S'$.
for k = 2 to n do
for all subsets S with k vertices that include vertex 1 do
for all j in S, j != 1 do
C(S,j) = min { C(S',j) + dist(j,i) } for all S' that exclude i
We can then compute the final solution by adding the weight of the edge $(1,i)$ for all $i\in V\setminus{1}$ and taking the minimum.
TSP = min { C(V,i) + dist(i,1) } for all i in V\setminus{1}
In conclusion, we have seen how to solve the Traveling Salesman Problem using the Bellman-Held-Karp algorithm. While it has a high time complexity, it is one of the most efficient algorithms for solving TSP in practice.