2013-05-06 64 views
-1
Consider the following matrix/array that contains the distances between 4 cities: 

0 1 2 3 
1 0 4 5 
2 4 0 6 
3 5 6 0 

Each row/column pair (i,j) represents the distance between city i and city j. 
For example the distance between city 1 and city 4 is 3. 

我只是想检查我的理解是否正确。像阵列,第一个城市从0开始关闭所以在基体中,城市1是0和城市2是1.旅行推销员:矩阵和旅游

城市3和城市3将是0之间的路径?首先我们看一下第2行,然后第2列。

让我们想象一下,我们有以下游:T = {1,3,2,4}。要工作了这一点,我们做...

市1至3城市为2。3市城市2是4市2〜4为5

所以游的长度应为2 + 4 + 5 = 11?在旅行商问题然而,我们总是回到行驶到起始位置,所以从城市4,我们必须回到1这将耗费额外的3,所以我们最后的游览为14(11 + 3)。

回答