Skip to content

Commit

Permalink
Fix generation of inefficient MLD partitions
Browse files Browse the repository at this point in the history
Duplicate restriction nodes in the edge-based-graph are currently
not in included in a mapping (.osrm.cnbg_to_ebg) from
node-based-graph edges to edge-based-graph nodes.
This mapping is used by the MLD partitioner to assign EBG nodes
to partitions.

The omission from the mapping means all restriction nodes are
included in a special 'invalid' partition. This special partition
will break the geolocation properties of the multi-level hierarchy.
The partition and its super levels will have a large number of
border nodes and very few internal paths between them.

Given the partitioner is the only consumer of the mapping, we fix
the issue by including the duplicate restriction nodes in the mapping,
so that they are correctly assigned to a partition.

This has measurable improvement on MLD routing.
For a country-sized routing network, the fix reduces routing and table
request computation time by ~2% and ~6% respectively and
reduces memory usage by X%.
  • Loading branch information
mjjbell committed Aug 29, 2021
1 parent dca35dc commit 3d694b3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Unreleased
- Changes from 5.25.0
- Routing:
- FIXED: Fix generation of inefficient MLD partitions [#6084](https://github.com/Project-OSRM/osrm-backend/pull/6084)

# 5.25.0
- Changes from 5.24.0
Expand Down
7 changes: 7 additions & 0 deletions src/extractor/edge_based_graph_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,13 @@ EdgeBasedGraphFactory::GenerateEdgeExpandedNodes(const WayRestrictionMap &way_re
m_edge_based_node_distances.push_back(
m_edge_based_node_distances[nbe_to_ebn_mapping[eid]]);

// Include duplicate nodes in cnbg to ebg mapping. This means a
// compressed node pair (u,v) can appear multiple times in this list.
// This is needed by the MLD partition step to ensure duplicate nodes
// are also assigned to partitions (the MLD partitioner is currently
// the only consumer of this mapping).
mapping.push_back(NBGToEBG{node_u, node_v, edge_based_node_id, SPECIAL_NODEID});

edge_based_node_id++;
progress.PrintStatus(progress_counter++);
}
Expand Down
4 changes: 4 additions & 0 deletions src/partitioner/partitioner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ int Partitioner::Run(const PartitionerConfig &config)
edge_based_partition_ids[backward_node] = node_based_partition_ids[v];
}

BOOST_ASSERT(std::none_of(edge_based_partition_ids.begin(),
edge_based_partition_ids.end(),
[](auto x) { return x == SPECIAL_NODEID; }));

std::vector<Partition> partitions;
std::vector<std::uint32_t> level_to_num_cells;
std::tie(partitions, level_to_num_cells) =
Expand Down

0 comments on commit 3d694b3

Please sign in to comment.