From 94651744af861473a956dd611325ce840f6c668b Mon Sep 17 00:00:00 2001 From: Patrick Niklaus Date: Tue, 15 Dec 2015 21:33:59 +0100 Subject: [PATCH] Remove assertion in farest insertion --- algorithms/trip_farthest_insertion.hpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/algorithms/trip_farthest_insertion.hpp b/algorithms/trip_farthest_insertion.hpp index 1300cb6f6..f0f6314fd 100644 --- a/algorithms/trip_farthest_insertion.hpp +++ b/algorithms/trip_farthest_insertion.hpp @@ -77,7 +77,13 @@ GetShortestRoundTrip(const NodeID new_loc, BOOST_ASSERT_MSG(dist_from != INVALID_EDGE_WEIGHT, "distance has invalid edge weight"); BOOST_ASSERT_MSG(dist_to != INVALID_EDGE_WEIGHT, "distance has invalid edge weight"); - BOOST_ASSERT_MSG(trip_dist >= 0, "previous trip was not minimal. something's wrong"); + // This is not neccessarily true: + // Lets say you have an edge (u, v) with duration 100. If you place a coordinate exactly in + // the middle of the segment yielding (u, v'), the adjusted duration will be 100 * 0.5 = 50. + // Now imagine two coordinates. One placed at 0.99 and one at 0.999. This means (u, v') now + // has a duration of 100 * 0.99 = 99, but (u, v'') also has a duration of 100 * 0.995 = 99. + // In which case (v', v'') has a duration of 0. + // BOOST_ASSERT_MSG(trip_dist >= 0, "previous trip was not minimal. something's wrong"); // from all possible insertions to the current trip, choose the shortest of all insertions if (trip_dist < min_trip_distance)