Fix for updating node weights in contraction hierarchy
This commit is contained in:
parent
adc87149e2
commit
cdc7e5f021
@ -75,6 +75,12 @@ int Contractor::Run()
|
||||
EdgeID number_of_edge_based_nodes = updater.LoadAndUpdateEdgeExpandedGraph(
|
||||
edge_based_edge_list, node_weights, connectivity_checksum);
|
||||
|
||||
// Convert node weights for oneway streets to INVALID_EDGE_WEIGHT
|
||||
for (auto &weight : node_weights)
|
||||
{
|
||||
weight = (weight & 0x80000000) ? INVALID_EDGE_WEIGHT : weight;
|
||||
}
|
||||
|
||||
// Contracting the edge-expanded graph
|
||||
|
||||
TIMER_START(contraction);
|
||||
|
@ -138,9 +138,12 @@ NBGToEBG EdgeBasedGraphFactory::InsertEdgeBasedNode(const NodeID node_u, const N
|
||||
BOOST_ASSERT(nbe_to_ebn_mapping[edge_id_1] != SPECIAL_NODEID ||
|
||||
nbe_to_ebn_mapping[edge_id_2] != SPECIAL_NODEID);
|
||||
|
||||
// TODO: use the sign bit to distinguish oneway streets that must
|
||||
// have INVALID_EDGE_WEIGHT node weight values to enforce loop edges
|
||||
// in contraction
|
||||
if (nbe_to_ebn_mapping[edge_id_1] != SPECIAL_NODEID &&
|
||||
nbe_to_ebn_mapping[edge_id_2] == SPECIAL_NODEID)
|
||||
m_edge_based_node_weights[nbe_to_ebn_mapping[edge_id_1]] = INVALID_EDGE_WEIGHT;
|
||||
m_edge_based_node_weights[nbe_to_ebn_mapping[edge_id_1]] |= 0x80000000;
|
||||
|
||||
BOOST_ASSERT(m_compressed_edge_container.HasEntryForID(edge_id_1) ==
|
||||
m_compressed_edge_container.HasEntryForID(edge_id_2));
|
||||
|
@ -743,12 +743,11 @@ Updater::LoadAndUpdateEdgeExpandedGraph(std::vector<extractor::EdgeBasedEdge> &e
|
||||
accumulated_segment_data[updated_iter - updated_segments.begin()];
|
||||
|
||||
// Update the node-weight cache. This is the weight of the edge-based-node
|
||||
// only,
|
||||
// it doesn't include the turn. We may visit the same node multiple times,
|
||||
// but
|
||||
// we should always assign the same value here.
|
||||
if (node_weights.size() > 0)
|
||||
node_weights[edge.source] = new_weight;
|
||||
// only, it doesn't include the turn. We may visit the same node multiple times,
|
||||
// but we should always assign the same value here.
|
||||
BOOST_ASSERT(edge.source < node_weights.size());
|
||||
node_weights[edge.source] =
|
||||
node_weights[edge.source] & 0x80000000 ? new_weight | 0x80000000 : new_weight;
|
||||
|
||||
// We found a zero-speed edge, so we'll skip this whole edge-based-edge
|
||||
// which
|
||||
|
Loading…
Reference in New Issue
Block a user