【发布时间】:2013-05-06 14:22:48
【问题描述】:
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)。
【问题讨论】: