Address PR comments

This commit is contained in:
Patrick Niklaus
2018-05-08 13:54:20 +00:00
committed by Patrick Niklaus
parent 2a15e6dec8
commit c459530cb6
6 changed files with 21 additions and 42 deletions
@@ -74,15 +74,6 @@ InternalRouteResult directShortestPathSearch(SearchEngineData<mld::Algorithm> &e
auto &reverse_heap = *engine_working_data.reverse_heap_1;
insertNodesInHeaps(forward_heap, reverse_heap, phantom_nodes);
std::cout << "source_phantom.forward_segment_id.id: "
<< phantom_nodes.source_phantom.forward_segment_id.id
<< " source_phantom.reverse_segment_id.id: "
<< phantom_nodes.source_phantom.reverse_segment_id.id << std::endl;
std::cout << "target_phantom.forward_segment_id.id: "
<< phantom_nodes.target_phantom.forward_segment_id.id
<< " target_phantom.reverse_segment_id.id: "
<< phantom_nodes.target_phantom.reverse_segment_id.id << std::endl;
// TODO: when structured bindings will be allowed change to
// auto [weight, source_node, target_node, unpacked_edges] = ...
EdgeWeight weight = INVALID_EDGE_WEIGHT;
@@ -148,11 +148,10 @@ void backwardRoutingStep(const DataFacade<Algorithm> &facade,
const auto target_weight = query_heap.GetKey(node);
const auto target_duration = query_heap.GetData(node).duration;
const auto parent = query_heap.GetData(node).parent;
const bool INVALID_CLIQUE_ARC_TYPE = false;
// Store settled nodes in search space bucket
search_space_with_buckets.emplace_back(
node, parent, INVALID_CLIQUE_ARC_TYPE, column_index, target_weight, target_duration);
node, parent, column_index, target_weight, target_duration);
relaxOutgoingEdges<REVERSE_DIRECTION>(
facade, node, target_weight, target_duration, query_heap, phantom_node);
@@ -275,18 +275,19 @@ oneToManySearch(SearchEngineData<Algorithm> &engine_working_data,
for (auto edge : facade.GetAdjacentEdgeRange(node))
{
const auto &data = facade.GetEdgeData(edge);
const auto to = facade.GetTarget(edge);
if ((DIRECTION == FORWARD_DIRECTION ? facade.IsForwardEdge(edge)
: facade.IsBackwardEdge(edge)) &&
!query_heap.WasInserted(facade.GetTarget(edge)))
!query_heap.WasInserted(to))
{
const auto turn_id = data.turn_id;
const auto node_id = DIRECTION == FORWARD_DIRECTION ? node : facade.GetTarget(edge);
const auto node_id = DIRECTION == FORWARD_DIRECTION ? node : to;
const auto edge_weight = initial_weight + facade.GetNodeWeight(node_id) +
facade.GetWeightPenaltyForEdgeID(turn_id);
const auto edge_duration = initial_duration + facade.GetNodeDuration(node_id) +
facade.GetDurationPenaltyForEdgeID(turn_id);
query_heap.Insert(facade.GetTarget(edge), edge_weight, {node, edge_duration});
query_heap.Insert(to, edge_weight, {node, edge_duration});
}
}
};