diff --git a/include/engine/routing_algorithms/routing_base_mld.hpp b/include/engine/routing_algorithms/routing_base_mld.hpp index ecbbbecb9..b06b8976b 100644 --- a/include/engine/routing_algorithms/routing_base_mld.hpp +++ b/include/engine/routing_algorithms/routing_base_mld.hpp @@ -230,7 +230,6 @@ template void relaxOutgoingEdges(const DataFacade &facade, typename SearchEngineData::QueryHeap &forward_heap, const typename SearchEngineData::QueryHeap::HeapNode& heapNode, - const EdgeWeight weight, Args... args) { const auto &partition = facade.GetMultiLevelPartition(); @@ -253,8 +252,8 @@ void relaxOutgoingEdges(const DataFacade &facade, if (shortcut_weight != INVALID_EDGE_WEIGHT && heapNode.node != to) { - const EdgeWeight to_weight = weight + shortcut_weight; - BOOST_ASSERT(to_weight >= weight); + const EdgeWeight to_weight = heapNode.weight + shortcut_weight; + BOOST_ASSERT(to_weight >= heapNode.weight); auto toHeapNode = forward_heap.GetHeapNodeIfWasInserted(to); if (!toHeapNode) { @@ -282,8 +281,8 @@ void relaxOutgoingEdges(const DataFacade &facade, if (shortcut_weight != INVALID_EDGE_WEIGHT && heapNode.node != to) { - const EdgeWeight to_weight = weight + shortcut_weight; - BOOST_ASSERT(to_weight >= weight); + const EdgeWeight to_weight = heapNode.weight + shortcut_weight; + BOOST_ASSERT(to_weight >= heapNode.weight); auto toHeapNode = forward_heap.GetHeapNodeIfWasInserted(to); if (!toHeapNode) { @@ -320,7 +319,7 @@ void relaxOutgoingEdges(const DataFacade &facade, // TODO: BOOST_ASSERT(edge_data.weight == node_weight + turn_penalty); - const EdgeWeight to_weight = weight + node_weight + turn_penalty; + const EdgeWeight to_weight = heapNode.weight + node_weight + turn_penalty; auto toHeapNode = forward_heap.GetHeapNodeIfWasInserted(to); if (!toHeapNode) @@ -376,7 +375,7 @@ void routingStep(const DataFacade &facade, } // Relax outgoing edges from node - relaxOutgoingEdges(facade, forward_heap, heapNode, weight, args...); + relaxOutgoingEdges(facade, forward_heap, heapNode, args...); } // With (s, middle, t) we trace back the paths middle -> s and middle -> t. diff --git a/include/util/query_heap.hpp b/include/util/query_heap.hpp index 3bf8421c5..33e12f3da 100644 --- a/include/util/query_heap.hpp +++ b/include/util/query_heap.hpp @@ -297,17 +297,17 @@ class QueryHeap boost::optional GetHeapNodeIfWasInserted(const NodeID node) { const auto index = node_index.peek_index(node); - if (index >= static_cast(inserted_nodes.size())) + if (index >= static_cast(inserted_nodes.size()) || inserted_nodes[index].node!=node) { return {}; } return inserted_nodes[index]; } - const boost::optional GetHeapNodeIfWasInserted(const NodeID node) const + boost::optional GetHeapNodeIfWasInserted(const NodeID node) const { const auto index = node_index.peek_index(node); - if (index >= static_cast(inserted_nodes.size())) + if (index >= static_cast(inserted_nodes.size()) || inserted_nodes[index].node!=node) { return {}; } diff --git a/src/engine/routing_algorithms/many_to_many_mld.cpp b/src/engine/routing_algorithms/many_to_many_mld.cpp index b6f8aaa5b..e1d5d609f 100644 --- a/src/engine/routing_algorithms/many_to_many_mld.cpp +++ b/src/engine/routing_algorithms/many_to_many_mld.cpp @@ -94,9 +94,6 @@ void relaxBorderEdges(const DataFacade &facade, template void relaxOutgoingEdges(const DataFacade &facade, const SearchEngineData::ManyToManyQueryHeap::HeapNode& heapNode, - const EdgeWeight weight, - const EdgeDuration duration, - const EdgeDistance distance, typename SearchEngineData::ManyToManyQueryHeap &query_heap, Args... args) { @@ -131,9 +128,9 @@ void relaxOutgoingEdges(const DataFacade &facade, if (shortcut_weight != INVALID_EDGE_WEIGHT && node != to) { - const auto to_weight = weight + shortcut_weight; - const auto to_duration = duration + shortcut_durations.front(); - const auto to_distance = distance + shortcut_distances.front(); + const auto to_weight = heapNode.weight + shortcut_weight; + const auto to_duration = heapNode.data.duration + shortcut_durations.front(); + const auto to_distance = heapNode.data.distance + shortcut_distances.front(); const auto& toHeapNode= query_heap.GetHeapNodeIfWasInserted(to); if (!toHeapNode) { @@ -171,9 +168,9 @@ void relaxOutgoingEdges(const DataFacade &facade, if (shortcut_weight != INVALID_EDGE_WEIGHT && node != to) { - const auto to_weight = weight + shortcut_weight; - const auto to_duration = duration + shortcut_durations.front(); - const auto to_distance = distance + shortcut_distances.front(); + const auto to_weight = heapNode.weight + shortcut_weight; + const auto to_duration = heapNode.data.duration + shortcut_durations.front(); + const auto to_distance = heapNode.data.distance + shortcut_distances.front(); const auto& toHeapNode= query_heap.GetHeapNodeIfWasInserted(to); if (!toHeapNode) { @@ -199,7 +196,7 @@ void relaxOutgoingEdges(const DataFacade &facade, } } - relaxBorderEdges(facade, node, weight, duration, distance, query_heap, level); + relaxBorderEdges(facade, node, heapNode.weight, heapNode.data.duration, heapNode.data.distance, query_heap, level); } // @@ -386,9 +383,6 @@ oneToManySearch(SearchEngineData &engine_working_data, // Relax outgoing edges relaxOutgoingEdges(facade, heapNode, - weight, - duration, - distance, query_heap, phantom_nodes, phantom_index, @@ -461,7 +455,7 @@ void forwardRoutingStep(const DataFacade &facade, } relaxOutgoingEdges( - facade, heapNode, source_weight, source_duration, source_distance, query_heap, phantom_node); + facade, heapNode, query_heap, phantom_node); } template @@ -487,9 +481,6 @@ void backwardRoutingStep(const DataFacade &facade, relaxOutgoingEdges(facade, heapNode, - target_weight, - target_duration, - target_distance, query_heap, phantom_node, maximal_level);