enable map matching in MLD

This commit is contained in:
Michael Krasnyk 2017-03-31 11:29:48 +02:00 committed by Patrick Niklaus
parent 604f4957f7
commit c487d1307e
4 changed files with 46 additions and 19 deletions

View File

@ -99,6 +99,9 @@ template <> struct HasDirectShortestPathSearch<mld::Algorithm> final : std::true
template <> struct HasShortestPathSearch<mld::Algorithm> final : std::true_type
{
};
template <> struct HasMapMatching<mld::Algorithm> final : std::true_type
{
};
}
}
}

View File

@ -221,18 +221,6 @@ RoutingAlgorithms<routing_algorithms::mld::Algorithm>::ManyToManySearch(
throw util::exception("ManyToManySearch is not implemented");
}
template <>
inline routing_algorithms::SubMatchingList
RoutingAlgorithms<routing_algorithms::mld::Algorithm>::MapMatching(
const routing_algorithms::CandidateLists &,
const std::vector<util::Coordinate> &,
const std::vector<unsigned> &,
const std::vector<boost::optional<double>> &,
const bool) const
{
throw util::exception("MapMatching is not implemented");
}
template <>
inline std::vector<routing_algorithms::TurnData>
RoutingAlgorithms<routing_algorithms::mld::Algorithm>::GetTileTurns(

View File

@ -24,9 +24,9 @@ namespace
// Unrestricted search (Args is const PhantomNodes &):
// * use partition.GetQueryLevel to find the node query level based on source and target phantoms
// * allow to traverse all cells
LevelID getNodeQureyLevel(const partition::MultiLevelPartitionView &partition,
NodeID node,
const PhantomNodes &phantom_nodes)
inline LevelID getNodeQureyLevel(const partition::MultiLevelPartitionView &partition,
NodeID node,
const PhantomNodes &phantom_nodes)
{
auto level = [&partition, node](const SegmentID &source, const SegmentID &target) {
if (source.enabled && target.enabled)
@ -43,17 +43,21 @@ LevelID getNodeQureyLevel(const partition::MultiLevelPartitionView &partition,
phantom_nodes.target_phantom.reverse_segment_id)));
}
bool checkParentCellRestriction(CellID, const PhantomNodes &) { return true; }
inline bool checkParentCellRestriction(CellID, const PhantomNodes &) { return true; }
// Restricted search (Args is LevelID, CellID):
// * use the fixed level for queries
// * check if the node cell is the same as the specified parent onr
LevelID getNodeQureyLevel(const partition::MultiLevelPartitionView &, NodeID, LevelID level, CellID)
inline LevelID
getNodeQureyLevel(const partition::MultiLevelPartitionView &, NodeID, LevelID level, CellID)
{
return level;
}
bool checkParentCellRestriction(CellID cell, LevelID, CellID parent) { return cell == parent; }
inline bool checkParentCellRestriction(CellID cell, LevelID, CellID parent)
{
return cell == parent;
}
}
template <bool DIRECTION, typename... Args>
@ -305,7 +309,7 @@ search(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
return std::make_tuple(weight, source_node, target_node, std::move(unpacked_path));
}
// Alias to be compatible with the overload for CoreCH that needs 4 heaps
// Alias to be compatible with the overload for CoreCH that needs 4 heaps for shortest path search
inline void search(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
SearchEngineData<Algorithm>::QueryHeap &forward_heap,
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
@ -362,6 +366,28 @@ void unpackPath(const FacadeT &facade,
annotatePath(facade, source_node, target_node, unpacked_edges, phantom_nodes, unpacked_path);
}
inline double
getNetworkDistance(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
SearchEngineData<Algorithm>::QueryHeap &forward_heap,
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
SearchEngineData<Algorithm>::QueryHeap &forward_core_heap,
SearchEngineData<Algorithm>::QueryHeap &reverse_core_heap,
const PhantomNode &source_phantom,
const PhantomNode &target_phantom,
int duration_upper_bound = INVALID_EDGE_WEIGHT)
{
(void)facade;
(void)forward_heap;
(void)reverse_heap;
(void)forward_core_heap;
(void)reverse_core_heap;
(void)source_phantom;
(void)target_phantom;
(void)duration_upper_bound;
return 0.; // TODO: unimplemented
}
} // namespace mld
} // namespace routing_algorithms
} // namespace engine

View File

@ -1,5 +1,6 @@
#include "engine/routing_algorithms/map_matching.hpp"
#include "engine/routing_algorithms/routing_base_ch.hpp"
#include "engine/routing_algorithms/routing_base_mld.hpp"
#include "engine/map_matching/hidden_markov_model.hpp"
#include "engine/map_matching/matching_confidence.hpp"
@ -437,6 +438,15 @@ mapMatching(SearchEngineData<corech::Algorithm> &engine_working_data,
const std::vector<boost::optional<double>> &trace_gps_precision,
const bool allow_splitting);
template SubMatchingList
mapMatching(SearchEngineData<mld::Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<mld::Algorithm> &facade,
const CandidateLists &candidates_list,
const std::vector<util::Coordinate> &trace_coordinates,
const std::vector<unsigned> &trace_timestamps,
const std::vector<boost::optional<double>> &trace_gps_precision,
const bool allow_splitting);
} // namespace routing_algorithms
} // namespace engine
} // namespace osrm