Changes and corrections before change request

Cucumber successfull
This commit is contained in:
xlaussel 2020-11-24 12:43:08 +01:00
parent 9a32722634
commit 8697a6b14a
3 changed files with 17 additions and 27 deletions

View File

@ -230,7 +230,6 @@ template <bool DIRECTION, typename Algorithm, typename... Args>
void relaxOutgoingEdges(const DataFacade<Algorithm> &facade,
typename SearchEngineData<Algorithm>::QueryHeap &forward_heap,
const typename SearchEngineData<Algorithm>::QueryHeap::HeapNode& heapNode,
const EdgeWeight weight,
Args... args)
{
const auto &partition = facade.GetMultiLevelPartition();
@ -253,8 +252,8 @@ void relaxOutgoingEdges(const DataFacade<Algorithm> &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<Algorithm> &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<Algorithm> &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<Algorithm> &facade,
}
// Relax outgoing edges from node
relaxOutgoingEdges<DIRECTION>(facade, forward_heap, heapNode, weight, args...);
relaxOutgoingEdges<DIRECTION>(facade, forward_heap, heapNode, args...);
}
// With (s, middle, t) we trace back the paths middle -> s and middle -> t.

View File

@ -297,17 +297,17 @@ class QueryHeap
boost::optional<HeapNode&> GetHeapNodeIfWasInserted(const NodeID node)
{
const auto index = node_index.peek_index(node);
if (index >= static_cast<decltype(index)>(inserted_nodes.size()))
if (index >= static_cast<decltype(index)>(inserted_nodes.size()) || inserted_nodes[index].node!=node)
{
return {};
}
return inserted_nodes[index];
}
const boost::optional<const HeapNode&> GetHeapNodeIfWasInserted(const NodeID node) const
boost::optional<const HeapNode&> GetHeapNodeIfWasInserted(const NodeID node) const
{
const auto index = node_index.peek_index(node);
if (index >= static_cast<decltype(index)>(inserted_nodes.size()))
if (index >= static_cast<decltype(index)>(inserted_nodes.size()) || inserted_nodes[index].node!=node)
{
return {};
}

View File

@ -94,9 +94,6 @@ void relaxBorderEdges(const DataFacade<mld::Algorithm> &facade,
template <bool DIRECTION, typename... Args>
void relaxOutgoingEdges(const DataFacade<mld::Algorithm> &facade,
const SearchEngineData<mld::Algorithm>::ManyToManyQueryHeap::HeapNode& heapNode,
const EdgeWeight weight,
const EdgeDuration duration,
const EdgeDistance distance,
typename SearchEngineData<mld::Algorithm>::ManyToManyQueryHeap &query_heap,
Args... args)
{
@ -131,9 +128,9 @@ void relaxOutgoingEdges(const DataFacade<mld::Algorithm> &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<mld::Algorithm> &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<mld::Algorithm> &facade,
}
}
relaxBorderEdges<DIRECTION>(facade, node, weight, duration, distance, query_heap, level);
relaxBorderEdges<DIRECTION>(facade, node, heapNode.weight, heapNode.data.duration, heapNode.data.distance, query_heap, level);
}
//
@ -386,9 +383,6 @@ oneToManySearch(SearchEngineData<Algorithm> &engine_working_data,
// Relax outgoing edges
relaxOutgoingEdges<DIRECTION>(facade,
heapNode,
weight,
duration,
distance,
query_heap,
phantom_nodes,
phantom_index,
@ -461,7 +455,7 @@ void forwardRoutingStep(const DataFacade<Algorithm> &facade,
}
relaxOutgoingEdges<DIRECTION>(
facade, heapNode, source_weight, source_duration, source_distance, query_heap, phantom_node);
facade, heapNode, query_heap, phantom_node);
}
template <bool DIRECTION>
@ -487,9 +481,6 @@ void backwardRoutingStep(const DataFacade<Algorithm> &facade,
relaxOutgoingEdges<!DIRECTION>(facade,
heapNode,
target_weight,
target_duration,
target_distance,
query_heap,
phantom_node,
maximal_level);