日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

旅行商问题

發布時間:2025/3/11 编程问答 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 旅行商问题 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

旅行商問題 (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。

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 。

翻譯自: https://www.includehelp.com/algorithms/travelling-salesman-problem.aspx

總結

以上是生活随笔為你收集整理的旅行商问题的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。