Matrix plugin with MLD overlay

This commit is contained in:
Michael Krasnyk
2017-06-28 00:48:18 +02:00
committed by Patrick Niklaus
parent b910ab9bcb
commit 517cb5f094
7 changed files with 327 additions and 51 deletions
+9 -2
View File
@@ -25,6 +25,7 @@ auto makeGraph(const MultiLevelPartition &mlp, const std::vector<MockEdge> &mock
struct EdgeData
{
EdgeWeight weight;
EdgeDuration duration;
bool forward;
bool backward;
};
@@ -34,8 +35,8 @@ auto makeGraph(const MultiLevelPartition &mlp, const std::vector<MockEdge> &mock
for (const auto &m : mock_edges)
{
max_id = std::max<std::size_t>(max_id, std::max(m.start, m.target));
edges.push_back(Edge{m.start, m.target, m.weight, true, false});
edges.push_back(Edge{m.target, m.start, m.weight, false, true});
edges.push_back(Edge{m.start, m.target, m.weight, 2 * m.weight, true, false});
edges.push_back(Edge{m.target, m.start, m.weight, 2 * m.weight, false, true});
}
std::sort(edges.begin(), edges.end());
return partition::MultiLevelGraph<EdgeData, osrm::storage::Ownership::Container>(
@@ -253,6 +254,12 @@ BOOST_AUTO_TEST_CASE(four_levels_test)
CHECK_EQUAL_RANGE(cell_2_1.GetInWeight(9), 0, INVALID_EDGE_WEIGHT);
CHECK_EQUAL_RANGE(cell_2_1.GetInWeight(12), INVALID_EDGE_WEIGHT, 10);
CHECK_EQUAL_RANGE(cell_2_1.GetOutDuration(9), 6, 0, INVALID_EDGE_WEIGHT);
CHECK_EQUAL_RANGE(cell_2_1.GetOutDuration(13), INVALID_EDGE_WEIGHT, INVALID_EDGE_WEIGHT, 20);
CHECK_EQUAL_RANGE(cell_2_1.GetInDuration(8), 6, INVALID_EDGE_WEIGHT);
CHECK_EQUAL_RANGE(cell_2_1.GetInDuration(9), 0, INVALID_EDGE_WEIGHT);
CHECK_EQUAL_RANGE(cell_2_1.GetInDuration(12), INVALID_EDGE_WEIGHT, 20);
CellStorage storage_rec(mlp, graph);
customizer.Customize(graph, storage_rec);