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

View File

@ -21,8 +21,8 @@ struct NodeBucket
{
NodeID middle_node;
NodeID parent_node;
bool from_clique_arc;
unsigned column_index; // a column in the weight/duration matrix
unsigned column_index : 31; // a column in the weight/duration matrix
unsigned from_clique_arc : 1;
EdgeWeight weight;
EdgeDuration duration;
@ -32,8 +32,18 @@ struct NodeBucket
unsigned column_index,
EdgeWeight weight,
EdgeDuration duration)
: middle_node(middle_node), parent_node(parent_node), from_clique_arc(from_clique_arc),
column_index(column_index), weight(weight), duration(duration)
: middle_node(middle_node), parent_node(parent_node), column_index(column_index),
from_clique_arc(from_clique_arc), weight(weight), duration(duration)
{
}
NodeBucket(NodeID middle_node,
NodeID parent_node,
unsigned column_index,
EdgeWeight weight,
EdgeDuration duration)
: middle_node(middle_node), parent_node(parent_node), column_index(column_index),
from_clique_arc(false), weight(weight), duration(duration)
{
}
@ -75,7 +85,7 @@ struct NodeBucket
}
};
};
}
} // namespace
template <typename Algorithm>
std::pair<std::vector<EdgeDuration>, std::vector<EdgeDistance>>

View File

@ -446,21 +446,6 @@ UnpackedPath search(SearchEngineData<Algorithm> &engine_working_data,
// Get packed path as edges {from node ID, to node ID, from_clique_arc}
auto packed_path = retrievePackedPathFromHeap(forward_heap, reverse_heap, middle);
// if (!packed_path.empty())
// {
// std::cout << "packed_path: ";
// for (auto edge : packed_path)
// {
// std::cout << std::get<0>(edge) << ",";
// }
// std::cout << std::get<1>(packed_path.back());
// std::cout << std::endl;
// }
// else
// {
// std::cout << "no packed_path!" << std::endl;
// }
// Beware the edge case when start, middle, end are all the same.
// In this case we return a single node, no edges. We also don't unpack.
const NodeID source_node = !packed_path.empty() ? std::get<0>(packed_path.front()) : middle;
@ -520,12 +505,7 @@ UnpackedPath search(SearchEngineData<Algorithm> &engine_working_data,
unpacked_edges.insert(unpacked_edges.end(), subpath_edges.begin(), subpath_edges.end());
}
}
// std::cout << "unpacked_nodes: ";
// for (auto node : unpacked_nodes)
// {
// std::cout << node << ", ";
// }
// std::cout << std::endl;
return std::make_tuple(weight, std::move(unpacked_nodes), std::move(unpacked_edges));
}

View File

@ -135,8 +135,6 @@ function process_turn (profile, turn)
if turn.has_traffic_light then
turn.duration = turn.duration + profile.properties.traffic_light_penalty
end
io.write("after penalty turn.duration: ", turn.duration, "turn.weight: ", turn.weight, "\n")
end
return {

View File

@ -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;

View File

@ -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);

View File

@ -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});
}
}
};