From 6c68c3a1e16d0a430d33a4910b459c62bcbccd3b Mon Sep 17 00:00:00 2001 From: Daniel Patterson Date: Sun, 17 May 2015 14:29:57 -0700 Subject: [PATCH] Revert "fix incorrect behavior when via point was on same one-way street as destination but should have been reached before, closes #1424" This reverts commit 11c671354be8c791ef107e6ce6c4a38435417edb. --- routing_algorithms/shortest_path.hpp | 58 +++++++++++++++++++++------- 1 file changed, 43 insertions(+), 15 deletions(-) diff --git a/routing_algorithms/shortest_path.hpp b/routing_algorithms/shortest_path.hpp index 3dedc2b76a0..4b3cc49a4a9 100644 --- a/routing_algorithms/shortest_path.hpp +++ b/routing_algorithms/shortest_path.hpp @@ -92,9 +92,7 @@ class ShortestPathRouting final const bool allow_u_turn = current_leg > 0 && uturn_indicators.size() > current_leg && uturn_indicators[current_leg - 1]; - const EdgeWeight min_edge_offset = - std::min(phantom_node_pair.source_phantom.GetForwardWeightPlusOffset(), - phantom_node_pair.source_phantom.GetReverseWeightPlusOffset()); + EdgeWeight min_edge_offset = 0; // insert new starting nodes into forward heap, adjusted by previous distances. if ((allow_u_turn || search_from_1st_node) && @@ -102,32 +100,58 @@ class ShortestPathRouting final { forward_heap1.Insert( phantom_node_pair.source_phantom.forward_node_id, - -phantom_node_pair.source_phantom.GetForwardWeightPlusOffset(), + (allow_u_turn ? 0 : distance1) - + phantom_node_pair.source_phantom.GetForwardWeightPlusOffset(), phantom_node_pair.source_phantom.forward_node_id); + min_edge_offset = + std::min(min_edge_offset, + (allow_u_turn ? 0 : distance1) - + phantom_node_pair.source_phantom.GetForwardWeightPlusOffset()); // SimpleLogger().Write(logDEBUG) << "fwd-a2 insert: " << - // phantom_node_pair.source_phantom.forward_node_id << ", w: " << -phantom_node_pair.source_phantom.GetForwardWeightPlusOffset(); + // phantom_node_pair.source_phantom.forward_node_id << ", w: " << (allow_u_turn ? 0 + // : distance1) - phantom_node_pair.source_phantom.GetForwardWeightPlusOffset(); forward_heap2.Insert( phantom_node_pair.source_phantom.forward_node_id, - -phantom_node_pair.source_phantom.GetForwardWeightPlusOffset(), + (allow_u_turn ? 0 : distance1) - + phantom_node_pair.source_phantom.GetForwardWeightPlusOffset(), phantom_node_pair.source_phantom.forward_node_id); + min_edge_offset = + std::min(min_edge_offset, + (allow_u_turn ? 0 : distance1) - + phantom_node_pair.source_phantom.GetForwardWeightPlusOffset()); // SimpleLogger().Write(logDEBUG) << "fwd-b2 insert: " << - // phantom_node_pair.source_phantom.forward_node_id << ", w: " << -phantom_node_pair.source_phantom.GetForwardWeightPlusOffset(); + // phantom_node_pair.source_phantom.forward_node_id << ", w: " << (allow_u_turn ? 0 + // : distance1) - phantom_node_pair.source_phantom.GetForwardWeightPlusOffset(); } if ((allow_u_turn || search_from_2nd_node) && phantom_node_pair.source_phantom.reverse_node_id != SPECIAL_NODEID) { forward_heap1.Insert( phantom_node_pair.source_phantom.reverse_node_id, - -phantom_node_pair.source_phantom.GetReverseWeightPlusOffset(), + (allow_u_turn ? 0 : distance2) - + phantom_node_pair.source_phantom.GetReverseWeightPlusOffset(), phantom_node_pair.source_phantom.reverse_node_id); + min_edge_offset = + std::min(min_edge_offset, + (allow_u_turn ? 0 : distance2) - + phantom_node_pair.source_phantom.GetReverseWeightPlusOffset()); // SimpleLogger().Write(logDEBUG) << "fwd-a2 insert: " << - // phantom_node_pair.source_phantom.reverse_node_id << ", w: " << -phantom_node_pair.source_phantom.GetReverseWeightPlusOffset(); + // phantom_node_pair.source_phantom.reverse_node_id << + // ", w: " << (allow_u_turn ? 0 : distance2) - + // phantom_node_pair.source_phantom.GetReverseWeightPlusOffset(); forward_heap2.Insert( phantom_node_pair.source_phantom.reverse_node_id, - -phantom_node_pair.source_phantom.GetReverseWeightPlusOffset(), + (allow_u_turn ? 0 : distance2) - + phantom_node_pair.source_phantom.GetReverseWeightPlusOffset(), phantom_node_pair.source_phantom.reverse_node_id); + min_edge_offset = + std::min(min_edge_offset, + (allow_u_turn ? 0 : distance2) - + phantom_node_pair.source_phantom.GetReverseWeightPlusOffset()); // SimpleLogger().Write(logDEBUG) << "fwd-b2 insert: " << - // phantom_node_pair.source_phantom.reverse_node_id << ", w: " << -phantom_node_pair.source_phantom.GetReverseWeightPlusOffset(); + // phantom_node_pair.source_phantom.reverse_node_id << + // ", w: " << (allow_u_turn ? 0 : distance2) - + // phantom_node_pair.source_phantom.GetReverseWeightPlusOffset(); } // insert new backward nodes into backward heap, unadjusted. @@ -137,7 +161,9 @@ class ShortestPathRouting final phantom_node_pair.target_phantom.GetForwardWeightPlusOffset(), phantom_node_pair.target_phantom.forward_node_id); // SimpleLogger().Write(logDEBUG) << "rev-a insert: " << - // phantom_node_pair.target_phantom.forward_node_id << ", w: " << phantom_node_pair.target_phantom.GetForwardWeightPlusOffset(); + // phantom_node_pair.target_phantom.forward_node_id << + // ", w: " << + // phantom_node_pair.target_phantom.GetForwardWeightPlusOffset(); } if (phantom_node_pair.target_phantom.reverse_node_id != SPECIAL_NODEID) @@ -146,7 +172,9 @@ class ShortestPathRouting final phantom_node_pair.target_phantom.GetReverseWeightPlusOffset(), phantom_node_pair.target_phantom.reverse_node_id); // SimpleLogger().Write(logDEBUG) << "rev-a insert: " << - // phantom_node_pair.target_phantom.reverse_node_id << ", w: " << phantom_node_pair.target_phantom.GetReverseWeightPlusOffset(); + // phantom_node_pair.target_phantom.reverse_node_id << + // ", w: " << + // phantom_node_pair.target_phantom.GetReverseWeightPlusOffset(); } // run two-Target Dijkstra routing step. @@ -304,8 +332,8 @@ class ShortestPathRouting final BOOST_ASSERT(search_from_1st_node != search_from_2nd_node); } - distance1 += local_upper_bound1; - distance2 += local_upper_bound2; + distance1 = local_upper_bound1; + distance2 = local_upper_bound2; ++current_leg; }