aboutsummaryrefslogtreecommitdiff
path: root/src/tsp_approx.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tsp_approx.rs')
-rw-r--r--src/tsp_approx.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/tsp_approx.rs b/src/tsp_approx.rs
index 2c6cbf9..e3448a1 100644
--- a/src/tsp_approx.rs
+++ b/src/tsp_approx.rs
@@ -292,7 +292,7 @@ fn refine_2_opt(dist_cache: &DistCache, tour: Vec<usize>) -> (bool, Vec<usize>)
let mut tour: Vec<_> = tour
.into_iter()
.enumerate()
- .map(|(i, v)| (i - 1, v, i + 1))
+ .map(|(i, v)| (i.wrapping_sub(1), v, i + 1))
.collect();
let n = tour.len();
// fix boundary