旅行商问题 (Travelling Salesman problem)
This problem can be stated as- "Given n number of cities and a travelling salesman has to visit each city. Then we have to find the shortest tour so that the travelling salesman can visit each and every city only once."
可以说这个问题是: “给n个城市,一个旅行推销员必须访问每个城市。然后我们必须找到最短的游览,以便旅行推销员只能访问每个城市一次。”
This travelling salesman problem is one of the examples of NP-Complete problems.
这个旅行推销员问题是NP-完全问题的例子之一。
In the travelling salesman problem, we are given a complete undirected graph G = (V, E) that has a non-negative integer cost c (u, v) associated with each edge (u, v) belongs to E and we must find a tour of G with minimum cost.
在旅行商问题中,我们得到一个完整的无向图G =(V,E) ,该图具有与每个边(u,v)相关的非负整数成本c(u,v) ,属于E ,我们必须找到以最低的费用游览G。
Let C (A) denotes the total cost of the edges in the subset A is the subset E.
令C(A)表示子集A中边缘的总成本为子集E。
![Travelling Salesman problem](https://i-blog.csdnimg.cn/blog_migrate/cdad809b1c11fe2881e01f0c6f47c1ea.png)
Practically, it is always cheapest to go directly from a place w, going by way of any intermediate stop V can’t be expensive. Or say, cutting out an intermediate stop never increase the cost. This can be formalized that the cost function c satisfies the triangle inequality, if for all vertices u, v, w £ V .
实际上,直接从位置w出发总是最便宜的,通过任何中间停靠点V都不会很昂贵。 或者说,切出一个中间停止点永远不会增加成本。 如果对所有顶点u,v,w£V ,成本函数c可以满足三角形不等式,则可以形式化。
C (u, w) <= c (u, v) + c (v, w)
C(u,w)<= c(u,v)+ c(v,w)
This triangle inequality is natural one, and is many application it is automatically satisfied. In this problem, our tour starts from an initial state and completes after returning to original state passing through all intermediate states.
这个三角形不等式是自然的,并且在许多应用中都可以自动满足。 在这个问题中,我们的游览从初始状态开始,并在经过所有中间状态回到原始状态后完成。
If the graph has n vertices, i.e., |V| = n, then the solution space S is given by S = { 1, π, 1, π: is a permutation of (2, 3, ..., n)}.
如果图具有n个顶点,即| V | = n ,则解空间S由S = {1,π,1,π:是(2,3,...,n)}的排列给出 。
Then |S| = (n-1)!
然后| S | =(n-1)!
The size of S can be reduced by restricting S so that (1, i1,...i2,i(n-1), 1) belongs to S if and only if (ij, ij + 1) £ E, 0 <= j <= n-1, and i0 = in = 1.
可以通过限制S来减小S的大小,使得(1,i1,... i2,i(n-1),1)属于S,当且仅当(ij,ij + 1)£E,0 < = j <= n-1 , i0 = in = 1 。
State space tree for this problem, for n = 4 and initial and final states 1.
这个问题的状态空间树,对于n = 4以及初始状态和最终状态1 。
![Travelling Salesman problem](https://i-blog.csdnimg.cn/blog_migrate/f792d7fc0be76eaaff35f3ea5216e185.png)
翻译自: https://www.includehelp.com/algorithms/travelling-salesman-problem.aspx