Optimise path distance calculation in MLD map matching
This commit is contained in:
parent
21ecb8c209
commit
48d5651e32
@ -650,25 +650,26 @@ double getNetworkDistance(SearchEngineData<Algorithm> &engine_working_data,
|
|||||||
return std::numeric_limits<double>::max();
|
return std::numeric_limits<double>::max();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_ASSERT(unpacked_nodes.size() >= 1);
|
||||||
|
|
||||||
EdgeDistance distance = {0.0};
|
EdgeDistance distance = {0.0};
|
||||||
|
|
||||||
if (source_phantom.forward_segment_id.id == unpacked_nodes[0])
|
if (source_phantom.forward_segment_id.id == unpacked_nodes.front())
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(source_phantom.forward_segment_id.enabled);
|
BOOST_ASSERT(source_phantom.forward_segment_id.enabled);
|
||||||
distance = EdgeDistance{0} - source_phantom.GetForwardDistance();
|
distance = EdgeDistance{0} - source_phantom.GetForwardDistance();
|
||||||
}
|
}
|
||||||
else if (source_phantom.reverse_segment_id.id == unpacked_nodes[0])
|
else if (source_phantom.reverse_segment_id.id == unpacked_nodes.front())
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(source_phantom.reverse_segment_id.enabled);
|
BOOST_ASSERT(source_phantom.reverse_segment_id.enabled);
|
||||||
distance = EdgeDistance{0} - source_phantom.GetReverseDistance();
|
distance = EdgeDistance{0} - source_phantom.GetReverseDistance();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t index = 0; index < unpacked_nodes.size() - 1; ++index) {
|
for (size_t index = 0; index < unpacked_nodes.size() - 1; ++index)
|
||||||
|
{
|
||||||
distance += facade.GetNodeDistance(unpacked_nodes[index]);
|
distance += facade.GetNodeDistance(unpacked_nodes[index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target_phantom.forward_segment_id.id == unpacked_nodes.back())
|
if (target_phantom.forward_segment_id.id == unpacked_nodes.back())
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(target_phantom.forward_segment_id.enabled);
|
BOOST_ASSERT(target_phantom.forward_segment_id.enabled);
|
||||||
|
|||||||
@ -33,7 +33,8 @@ try
|
|||||||
// Configure based on a .osrm base path, and no datasets in shared mem from osrm-datastore
|
// Configure based on a .osrm base path, and no datasets in shared mem from osrm-datastore
|
||||||
EngineConfig config;
|
EngineConfig config;
|
||||||
config.storage_config = {argv[1]};
|
config.storage_config = {argv[1]};
|
||||||
config.algorithm = (argc > 2 && std::string{argv[2]} == "mld") ? EngineConfig::Algorithm::MLD : EngineConfig::Algorithm::CH;
|
config.algorithm = (argc > 2 && std::string{argv[2]} == "mld") ? EngineConfig::Algorithm::MLD
|
||||||
|
: EngineConfig::Algorithm::CH;
|
||||||
config.use_shared_memory = false;
|
config.use_shared_memory = false;
|
||||||
|
|
||||||
// Routing machine with several services (such as Route, Table, Nearest, Trip, Match)
|
// Routing machine with several services (such as Route, Table, Nearest, Trip, Match)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user