Skip to content

Commit 70710a6

Browse files
committed
Stuff at common.py now really working.
1 parent 799c479 commit 70710a6

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

python/stochastic/common.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,7 @@ def path_cost(permutation, cities):
3535
limit = len(permutation)
3636

3737
for i in range(limit):
38-
if i == (limit - 1):
39-
c2 = 0
40-
else:
41-
c2 = i + 1
38+
c2 = permutation[(i + 1) % limit]
4239
distance += euc_2d(cities[permutation[i]], cities[c2])
4340

4441
return distance

0 commit comments

Comments
 (0)