itroduce ADL via algorithm specific ch, corech and mld namespaces

This commit is contained in:
Michael Krasnyk 2017-03-31 12:52:04 +02:00
parent 2566f64c34
commit 8c64b01d67
23 changed files with 501 additions and 464 deletions

View File

@ -7,30 +7,36 @@ namespace osrm
{ {
namespace engine namespace engine
{ {
namespace algorithm namespace routing_algorithms
{ {
// Contraction Hiearchy // Contraction Hiearchy
struct CH final namespace ch
{
struct Algorithm final
{ {
}; };
}
// Contraction Hiearchy with core // Contraction Hiearchy with core
struct CoreCH final namespace corech
{
struct Algorithm final
{ {
}; };
}
// Multi-Level Dijkstra // Multi-Level Dijkstra
struct MLD final namespace mld
{
struct Algorithm final
{ {
}; };
template <typename AlgorithmT> const char *name();
template <> inline const char *name<CH>() { return "CH"; }
template <> inline const char *name<CoreCH>() { return "CoreCH"; }
template <> inline const char *name<MLD>() { return "MLD"; }
} }
namespace algorithm_trais // Algorithm names
{ template <typename AlgorithmT> const char *name();
template <> inline const char *name<ch::Algorithm>() { return "CH"; }
template <> inline const char *name<corech::Algorithm>() { return "CoreCH"; }
template <> inline const char *name<mld::Algorithm>() { return "MLD"; }
template <typename AlgorithmT> struct HasAlternativePathSearch final : std::false_type template <typename AlgorithmT> struct HasAlternativePathSearch final : std::false_type
{ {
@ -51,62 +57,64 @@ template <typename AlgorithmT> struct HasGetTileTurns final : std::false_type
{ {
}; };
template <> struct HasAlternativePathSearch<algorithm::CH> final : std::true_type // Algorithms supported by Contraction Hierarchies
template <> struct HasAlternativePathSearch<ch::Algorithm> final : std::true_type
{ {
}; };
template <> struct HasShortestPathSearch<algorithm::CH> final : std::true_type template <> struct HasShortestPathSearch<ch::Algorithm> final : std::true_type
{ {
}; };
template <> struct HasDirectShortestPathSearch<algorithm::CH> final : std::true_type template <> struct HasDirectShortestPathSearch<ch::Algorithm> final : std::true_type
{ {
}; };
template <> struct HasMapMatching<algorithm::CH> final : std::true_type template <> struct HasMapMatching<ch::Algorithm> final : std::true_type
{ {
}; };
template <> struct HasManyToManySearch<algorithm::CH> final : std::true_type template <> struct HasManyToManySearch<ch::Algorithm> final : std::true_type
{ {
}; };
template <> struct HasGetTileTurns<algorithm::CH> final : std::true_type template <> struct HasGetTileTurns<ch::Algorithm> final : std::true_type
{ {
}; };
// Algorithms supported by Contraction Hierarchies with core
template <> struct HasShortestPathSearch<corech::Algorithm> final : std::true_type
{
};
template <> struct HasDirectShortestPathSearch<corech::Algorithm> final : std::true_type
{
};
template <> struct HasMapMatching<corech::Algorithm> final : std::true_type
{
};
template <> struct HasGetTileTurns<corech::Algorithm> final : std::true_type
{
};
// disbaled because of perfomance reasons // disbaled because of perfomance reasons
template <> struct HasAlternativePathSearch<algorithm::CoreCH> final : std::false_type template <> struct HasAlternativePathSearch<corech::Algorithm> final : std::false_type
{ {
}; };
template <> struct HasManyToManySearch<algorithm::CoreCH> final : std::false_type template <> struct HasManyToManySearch<corech::Algorithm> final : std::false_type
{
};
template <> struct HasShortestPathSearch<algorithm::CoreCH> final : std::true_type
{
};
template <> struct HasDirectShortestPathSearch<algorithm::CoreCH> final : std::true_type
{
};
template <> struct HasMapMatching<algorithm::CoreCH> final : std::true_type
{
};
template <> struct HasGetTileTurns<algorithm::CoreCH> final : std::true_type
{ {
}; };
// disbaled because of perfomance reasons // Algorithms supported by Multi-Level Dijkstra
template <> struct HasAlternativePathSearch<algorithm::MLD> final : std::false_type template <> struct HasDirectShortestPathSearch<mld::Algorithm> final : std::true_type
{ {
}; };
template <> struct HasManyToManySearch<algorithm::MLD> final : std::false_type template <> struct HasMapMatching<mld::Algorithm> final : std::false_type
{ {
}; };
template <> struct HasShortestPathSearch<algorithm::MLD> final : std::false_type template <> struct HasAlternativePathSearch<mld::Algorithm> final : std::false_type
{ {
}; };
template <> struct HasDirectShortestPathSearch<algorithm::MLD> final : std::true_type template <> struct HasManyToManySearch<mld::Algorithm> final : std::false_type
{ {
}; };
template <> struct HasMapMatching<algorithm::MLD> final : std::false_type template <> struct HasShortestPathSearch<mld::Algorithm> final : std::false_type
{ {
}; };
template <> struct HasGetTileTurns<algorithm::MLD> final : std::false_type template <> struct HasGetTileTurns<mld::Algorithm> final : std::false_type
{ {
}; };
} }

View File

@ -17,11 +17,16 @@ namespace engine
namespace datafacade namespace datafacade
{ {
// Namespace local aliases for algorithms
using CH = routing_algorithms::ch::Algorithm;
using CoreCH = routing_algorithms::corech::Algorithm;
using MLD = routing_algorithms::mld::Algorithm;
using EdgeRange = util::range<EdgeID>; using EdgeRange = util::range<EdgeID>;
template <typename AlgorithmT> class AlgorithmDataFacade; template <typename AlgorithmT> class AlgorithmDataFacade;
template <> class AlgorithmDataFacade<algorithm::CH> template <> class AlgorithmDataFacade<CH>
{ {
public: public:
using EdgeData = contractor::QueryEdge::EdgeData; using EdgeData = contractor::QueryEdge::EdgeData;
@ -56,7 +61,7 @@ template <> class AlgorithmDataFacade<algorithm::CH>
const std::function<bool(EdgeData)> filter) const = 0; const std::function<bool(EdgeData)> filter) const = 0;
}; };
template <> class AlgorithmDataFacade<algorithm::CoreCH> template <> class AlgorithmDataFacade<CoreCH>
{ {
public: public:
using EdgeData = contractor::QueryEdge::EdgeData; using EdgeData = contractor::QueryEdge::EdgeData;
@ -64,7 +69,7 @@ template <> class AlgorithmDataFacade<algorithm::CoreCH>
virtual bool IsCoreNode(const NodeID id) const = 0; virtual bool IsCoreNode(const NodeID id) const = 0;
}; };
template <> class AlgorithmDataFacade<algorithm::MLD> template <> class AlgorithmDataFacade<MLD>
{ {
public: public:
using EdgeData = extractor::EdgeBasedEdge::EdgeData; using EdgeData = extractor::EdgeBasedEdge::EdgeData;

View File

@ -58,8 +58,7 @@ namespace datafacade
template <typename AlgorithmT> class ContiguousInternalMemoryAlgorithmDataFacade; template <typename AlgorithmT> class ContiguousInternalMemoryAlgorithmDataFacade;
template <> template <>
class ContiguousInternalMemoryAlgorithmDataFacade<algorithm::CH> class ContiguousInternalMemoryAlgorithmDataFacade<CH> : public datafacade::AlgorithmDataFacade<CH>
: public datafacade::AlgorithmDataFacade<algorithm::CH>
{ {
private: private:
using QueryGraph = util::StaticGraph<EdgeData, storage::Ownership::View>; using QueryGraph = util::StaticGraph<EdgeData, storage::Ownership::View>;
@ -151,8 +150,8 @@ class ContiguousInternalMemoryAlgorithmDataFacade<algorithm::CH>
}; };
template <> template <>
class ContiguousInternalMemoryAlgorithmDataFacade<algorithm::CoreCH> class ContiguousInternalMemoryAlgorithmDataFacade<CoreCH>
: public datafacade::AlgorithmDataFacade<algorithm::CoreCH> : public datafacade::AlgorithmDataFacade<CoreCH>
{ {
private: private:
util::vector_view<bool> m_is_core_node; util::vector_view<bool> m_is_core_node;
@ -869,36 +868,34 @@ class ContiguousInternalMemoryDataFacadeBase : public BaseDataFacade
template <typename AlgorithmT> class ContiguousInternalMemoryDataFacade; template <typename AlgorithmT> class ContiguousInternalMemoryDataFacade;
template <> template <>
class ContiguousInternalMemoryDataFacade<algorithm::CH> class ContiguousInternalMemoryDataFacade<CH>
: public ContiguousInternalMemoryDataFacadeBase, : public ContiguousInternalMemoryDataFacadeBase,
public ContiguousInternalMemoryAlgorithmDataFacade<algorithm::CH> public ContiguousInternalMemoryAlgorithmDataFacade<CH>
{ {
public: public:
ContiguousInternalMemoryDataFacade(std::shared_ptr<ContiguousBlockAllocator> allocator) ContiguousInternalMemoryDataFacade(std::shared_ptr<ContiguousBlockAllocator> allocator)
: ContiguousInternalMemoryDataFacadeBase(allocator), : ContiguousInternalMemoryDataFacadeBase(allocator),
ContiguousInternalMemoryAlgorithmDataFacade<algorithm::CH>(allocator) ContiguousInternalMemoryAlgorithmDataFacade<CH>(allocator)
{ {
} }
}; };
template <> template <>
class ContiguousInternalMemoryDataFacade<algorithm::CoreCH> final class ContiguousInternalMemoryDataFacade<CoreCH> final
: public ContiguousInternalMemoryDataFacade<algorithm::CH>, : public ContiguousInternalMemoryDataFacade<CH>,
public ContiguousInternalMemoryAlgorithmDataFacade<algorithm::CoreCH> public ContiguousInternalMemoryAlgorithmDataFacade<CoreCH>
{ {
public: public:
ContiguousInternalMemoryDataFacade(std::shared_ptr<ContiguousBlockAllocator> allocator) ContiguousInternalMemoryDataFacade(std::shared_ptr<ContiguousBlockAllocator> allocator)
: ContiguousInternalMemoryDataFacade<algorithm::CH>(allocator), : ContiguousInternalMemoryDataFacade<CH>(allocator),
ContiguousInternalMemoryAlgorithmDataFacade<algorithm::CoreCH>(allocator) ContiguousInternalMemoryAlgorithmDataFacade<CoreCH>(allocator)
{ {
} }
}; };
template <> template <> class ContiguousInternalMemoryAlgorithmDataFacade<MLD> : public AlgorithmDataFacade<MLD>
class ContiguousInternalMemoryAlgorithmDataFacade<algorithm::MLD>
: public datafacade::AlgorithmDataFacade<algorithm::MLD>
{ {
// MLD data // MLD data
partition::MultiLevelPartitionView mld_partition; partition::MultiLevelPartitionView mld_partition;
@ -1065,15 +1062,15 @@ class ContiguousInternalMemoryAlgorithmDataFacade<algorithm::MLD>
}; };
template <> template <>
class ContiguousInternalMemoryDataFacade<algorithm::MLD> final class ContiguousInternalMemoryDataFacade<MLD> final
: public ContiguousInternalMemoryDataFacadeBase, : public ContiguousInternalMemoryDataFacadeBase,
public ContiguousInternalMemoryAlgorithmDataFacade<algorithm::MLD> public ContiguousInternalMemoryAlgorithmDataFacade<MLD>
{ {
private: private:
public: public:
ContiguousInternalMemoryDataFacade(std::shared_ptr<ContiguousBlockAllocator> allocator) ContiguousInternalMemoryDataFacade(std::shared_ptr<ContiguousBlockAllocator> allocator)
: ContiguousInternalMemoryDataFacadeBase(allocator), : ContiguousInternalMemoryDataFacadeBase(allocator),
ContiguousInternalMemoryAlgorithmDataFacade<algorithm::MLD>(allocator) ContiguousInternalMemoryAlgorithmDataFacade<MLD>(allocator)
{ {
} }

View File

@ -64,13 +64,13 @@ template <typename AlgorithmT> class Engine final : public EngineInterface
if (config.use_shared_memory) if (config.use_shared_memory)
{ {
util::Log(logDEBUG) << "Using shared memory with algorithm " util::Log(logDEBUG) << "Using shared memory with algorithm "
<< algorithm::name<AlgorithmT>(); << routing_algorithms::name<AlgorithmT>();
facade_provider = std::make_unique<WatchingProvider<AlgorithmT>>(); facade_provider = std::make_unique<WatchingProvider<AlgorithmT>>();
} }
else else
{ {
util::Log(logDEBUG) << "Using internal memory with algorithm " util::Log(logDEBUG) << "Using internal memory with algorithm "
<< algorithm::name<AlgorithmT>(); << routing_algorithms::name<AlgorithmT>();
facade_provider = facade_provider =
std::make_unique<ImmutableProvider<AlgorithmT>>(config.storage_config); std::make_unique<ImmutableProvider<AlgorithmT>>(config.storage_config);
} }
@ -143,7 +143,8 @@ template <typename AlgorithmT> class Engine final : public EngineInterface
const plugins::TilePlugin tile_plugin; const plugins::TilePlugin tile_plugin;
}; };
template <> bool Engine<algorithm::CH>::CheckCompability(const EngineConfig &config) template <>
bool Engine<routing_algorithms::ch::Algorithm>::CheckCompability(const EngineConfig &config)
{ {
if (config.use_shared_memory) if (config.use_shared_memory)
{ {
@ -168,9 +169,10 @@ template <> bool Engine<algorithm::CH>::CheckCompability(const EngineConfig &con
} }
} }
template <> bool Engine<algorithm::CoreCH>::CheckCompability(const EngineConfig &config) template <>
bool Engine<routing_algorithms::corech::Algorithm>::CheckCompability(const EngineConfig &config)
{ {
if (!Engine<algorithm::CH>::CheckCompability(config)) if (!Engine<routing_algorithms::ch::Algorithm>::CheckCompability(config))
{ {
return false; return false;
} }

View File

@ -93,32 +93,32 @@ template <typename AlgorithmT> class RoutingAlgorithms final : public RoutingAlg
bool HasAlternativePathSearch() const final override bool HasAlternativePathSearch() const final override
{ {
return algorithm_trais::HasAlternativePathSearch<AlgorithmT>::value; return routing_algorithms::HasAlternativePathSearch<AlgorithmT>::value;
} }
bool HasShortestPathSearch() const final override bool HasShortestPathSearch() const final override
{ {
return algorithm_trais::HasShortestPathSearch<AlgorithmT>::value; return routing_algorithms::HasShortestPathSearch<AlgorithmT>::value;
} }
bool HasDirectShortestPathSearch() const final override bool HasDirectShortestPathSearch() const final override
{ {
return algorithm_trais::HasDirectShortestPathSearch<AlgorithmT>::value; return routing_algorithms::HasDirectShortestPathSearch<AlgorithmT>::value;
} }
bool HasMapMatching() const final override bool HasMapMatching() const final override
{ {
return algorithm_trais::HasMapMatching<AlgorithmT>::value; return routing_algorithms::HasMapMatching<AlgorithmT>::value;
} }
bool HasManyToManySearch() const final override bool HasManyToManySearch() const final override
{ {
return algorithm_trais::HasManyToManySearch<AlgorithmT>::value; return routing_algorithms::HasManyToManySearch<AlgorithmT>::value;
} }
bool HasGetTileTurns() const final override bool HasGetTileTurns() const final override
{ {
return algorithm_trais::HasGetTileTurns<AlgorithmT>::value; return routing_algorithms::HasGetTileTurns<AlgorithmT>::value;
} }
private: private:
@ -131,7 +131,7 @@ template <typename AlgorithmT>
InternalRouteResult InternalRouteResult
RoutingAlgorithms<AlgorithmT>::AlternativePathSearch(const PhantomNodes &phantom_node_pair) const RoutingAlgorithms<AlgorithmT>::AlternativePathSearch(const PhantomNodes &phantom_node_pair) const
{ {
return routing_algorithms::alternativePathSearch(heaps, facade, phantom_node_pair); return routing_algorithms::ch::alternativePathSearch(heaps, facade, phantom_node_pair);
} }
template <typename AlgorithmT> template <typename AlgorithmT>
@ -156,7 +156,7 @@ std::vector<EdgeWeight> RoutingAlgorithms<AlgorithmT>::ManyToManySearch(
const std::vector<std::size_t> &source_indices, const std::vector<std::size_t> &source_indices,
const std::vector<std::size_t> &target_indices) const const std::vector<std::size_t> &target_indices) const
{ {
return routing_algorithms::manyToManySearch( return routing_algorithms::ch::manyToManySearch(
heaps, facade, phantom_nodes, source_indices, target_indices); heaps, facade, phantom_nodes, source_indices, target_indices);
} }
@ -168,7 +168,7 @@ inline routing_algorithms::SubMatchingList RoutingAlgorithms<AlgorithmT>::MapMat
const std::vector<boost::optional<double>> &trace_gps_precision, const std::vector<boost::optional<double>> &trace_gps_precision,
const bool allow_splitting) const const bool allow_splitting) const
{ {
return routing_algorithms::mapMatching(heaps, return routing_algorithms::ch::mapMatching(heaps,
facade, facade,
candidates_list, candidates_list,
trace_coordinates, trace_coordinates,
@ -187,23 +187,24 @@ inline std::vector<routing_algorithms::TurnData> RoutingAlgorithms<AlgorithmT>::
// MLD overrides for not implemented // MLD overrides for not implemented
template <> template <>
InternalRouteResult inline RoutingAlgorithms<algorithm::MLD>::AlternativePathSearch( InternalRouteResult inline RoutingAlgorithms<
const PhantomNodes &) const routing_algorithms::mld::Algorithm>::AlternativePathSearch(const PhantomNodes &) const
{ {
throw util::exception("AlternativePathSearch is not implemented"); throw util::exception("AlternativePathSearch is not implemented");
} }
template <> template <>
inline InternalRouteResult inline InternalRouteResult
RoutingAlgorithms<algorithm::MLD>::ShortestPathSearch(const std::vector<PhantomNodes> &, RoutingAlgorithms<routing_algorithms::mld::Algorithm>::ShortestPathSearch(
const boost::optional<bool>) const const std::vector<PhantomNodes> &, const boost::optional<bool>) const
{ {
throw util::exception("ShortestPathSearch is not implemented"); throw util::exception("ShortestPathSearch is not implemented");
} }
template <> template <>
inline std::vector<EdgeWeight> inline std::vector<EdgeWeight>
RoutingAlgorithms<algorithm::MLD>::ManyToManySearch(const std::vector<PhantomNode> &, RoutingAlgorithms<routing_algorithms::mld::Algorithm>::ManyToManySearch(
const std::vector<PhantomNode> &,
const std::vector<std::size_t> &, const std::vector<std::size_t> &,
const std::vector<std::size_t> &) const const std::vector<std::size_t> &) const
{ {
@ -212,7 +213,8 @@ RoutingAlgorithms<algorithm::MLD>::ManyToManySearch(const std::vector<PhantomNod
template <> template <>
inline routing_algorithms::SubMatchingList inline routing_algorithms::SubMatchingList
RoutingAlgorithms<algorithm::MLD>::MapMatching(const routing_algorithms::CandidateLists &, RoutingAlgorithms<routing_algorithms::mld::Algorithm>::MapMatching(
const routing_algorithms::CandidateLists &,
const std::vector<util::Coordinate> &, const std::vector<util::Coordinate> &,
const std::vector<unsigned> &, const std::vector<unsigned> &,
const std::vector<boost::optional<double>> &, const std::vector<boost::optional<double>> &,
@ -222,7 +224,8 @@ RoutingAlgorithms<algorithm::MLD>::MapMatching(const routing_algorithms::Candida
} }
template <> template <>
inline std::vector<routing_algorithms::TurnData> RoutingAlgorithms<algorithm::MLD>::GetTileTurns( inline std::vector<routing_algorithms::TurnData>
RoutingAlgorithms<routing_algorithms::mld::Algorithm>::GetTileTurns(
const std::vector<datafacade::BaseDataFacade::RTreeLeaf> &, const std::vector<datafacade::BaseDataFacade::RTreeLeaf> &,
const std::vector<std::size_t> &) const const std::vector<std::size_t> &) const
{ {

View File

@ -15,12 +15,13 @@ namespace engine
{ {
namespace routing_algorithms namespace routing_algorithms
{ {
namespace ch
{
InternalRouteResult InternalRouteResult
alternativePathSearch(SearchEngineData &search_engine_data, alternativePathSearch(SearchEngineData &search_engine_data,
const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CH> &facade, const datafacade::ContiguousInternalMemoryDataFacade<ch::Algorithm> &facade,
const PhantomNodes &phantom_node_pair); const PhantomNodes &phantom_node_pair);
} // namespace ch
} // namespace routing_algorithms } // namespace routing_algorithms
} // namespace engine } // namespace engine
} // namespace osrm } // namespace osrm

View File

@ -13,16 +13,18 @@ namespace osrm
{ {
namespace engine namespace engine
{ {
namespace routing_algorithms namespace routing_algorithms
{ {
namespace ch
{
std::vector<EdgeWeight> std::vector<EdgeWeight>
manyToManySearch(SearchEngineData &engine_working_data, manyToManySearch(SearchEngineData &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CH> &facade, const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
const std::vector<PhantomNode> &phantom_nodes, const std::vector<PhantomNode> &phantom_nodes,
const std::vector<std::size_t> &source_indices, const std::vector<std::size_t> &source_indices,
const std::vector<std::size_t> &target_indices); const std::vector<std::size_t> &target_indices);
} // namespace ch
} // namespace routing_algorithms } // namespace routing_algorithms
} // namespace engine } // namespace engine

View File

@ -22,18 +22,21 @@ static const constexpr double DEFAULT_GPS_PRECISION = 5;
//[1] "Hidden Markov Map Matching Through Noise and Sparseness"; //[1] "Hidden Markov Map Matching Through Noise and Sparseness";
// P. Newson and J. Krumm; 2009; ACM GIS // P. Newson and J. Krumm; 2009; ACM GIS
SubMatchingList namespace ch
mapMatching(SearchEngineData &engine_working_data, {
const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CH> &facade, SubMatchingList mapMatching(SearchEngineData &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
const CandidateLists &candidates_list, const CandidateLists &candidates_list,
const std::vector<util::Coordinate> &trace_coordinates, const std::vector<util::Coordinate> &trace_coordinates,
const std::vector<unsigned> &trace_timestamps, const std::vector<unsigned> &trace_timestamps,
const std::vector<boost::optional<double>> &trace_gps_precision, const std::vector<boost::optional<double>> &trace_gps_precision,
const bool allow_splitting); const bool allow_splitting);
}
SubMatchingList namespace corech
mapMatching(SearchEngineData &engine_working_data, {
const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CoreCH> &facade, SubMatchingList mapMatching(SearchEngineData &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
const CandidateLists &candidates_list, const CandidateLists &candidates_list,
const std::vector<util::Coordinate> &trace_coordinates, const std::vector<util::Coordinate> &trace_coordinates,
const std::vector<unsigned> &trace_timestamps, const std::vector<unsigned> &trace_timestamps,
@ -42,5 +45,6 @@ mapMatching(SearchEngineData &engine_working_data,
} }
} }
} }
}
#endif /* MAP_MATCHING_HPP */ #endif /* MAP_MATCHING_HPP */

View File

@ -23,7 +23,7 @@ namespace ch
// Stalling // Stalling
template <bool DIRECTION, typename HeapT> template <bool DIRECTION, typename HeapT>
bool stallAtNode(const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CH> &facade, bool stallAtNode(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
const NodeID node, const NodeID node,
const EdgeWeight weight, const EdgeWeight weight,
const HeapT &query_heap) const HeapT &query_heap)
@ -49,7 +49,7 @@ bool stallAtNode(const datafacade::ContiguousInternalMemoryDataFacade<algorithm:
} }
template <bool DIRECTION> template <bool DIRECTION>
void relaxOutgoingEdges(const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CH> &facade, void relaxOutgoingEdges(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
const NodeID node, const NodeID node,
const EdgeWeight weight, const EdgeWeight weight,
SearchEngineData::QueryHeap &heap) SearchEngineData::QueryHeap &heap)
@ -113,7 +113,7 @@ we need to add an offset to the termination criterion.
static constexpr bool ENABLE_STALLING = true; static constexpr bool ENABLE_STALLING = true;
static constexpr bool DISABLE_STALLING = false; static constexpr bool DISABLE_STALLING = false;
template <bool DIRECTION, bool STALLING = ENABLE_STALLING> template <bool DIRECTION, bool STALLING = ENABLE_STALLING>
void routingStep(const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CH> &facade, void routingStep(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
SearchEngineData::QueryHeap &forward_heap, SearchEngineData::QueryHeap &forward_heap,
SearchEngineData::QueryHeap &reverse_heap, SearchEngineData::QueryHeap &reverse_heap,
NodeID &middle_node_id, NodeID &middle_node_id,
@ -186,8 +186,7 @@ void routingStep(const datafacade::ContiguousInternalMemoryDataFacade<algorithm:
} }
template <bool UseDuration> template <bool UseDuration>
EdgeWeight EdgeWeight getLoopWeight(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
getLoopWeight(const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CH> &facade,
NodeID node) NodeID node)
{ {
EdgeWeight loop_weight = UseDuration ? MAXIMAL_EDGE_DURATION : INVALID_EDGE_WEIGHT; EdgeWeight loop_weight = UseDuration ? MAXIMAL_EDGE_DURATION : INVALID_EDGE_WEIGHT;
@ -228,7 +227,7 @@ getLoopWeight(const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CH
* original edge found. * original edge found.
*/ */
template <typename BidirectionalIterator, typename Callback> template <typename BidirectionalIterator, typename Callback>
void unpackPath(const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CH> &facade, void unpackPath(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
BidirectionalIterator packed_path_begin, BidirectionalIterator packed_path_begin,
BidirectionalIterator packed_path_end, BidirectionalIterator packed_path_end,
Callback &&callback) Callback &&callback)
@ -325,7 +324,7 @@ void unpackPath(const FacadeT &facade,
* @param to the node the CH edge finishes at * @param to the node the CH edge finishes at
* @param unpacked_path the sequence of original NodeIDs that make up the expanded CH edge * @param unpacked_path the sequence of original NodeIDs that make up the expanded CH edge
*/ */
void unpackEdge(const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CH> &facade, void unpackEdge(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
const NodeID from, const NodeID from,
const NodeID to, const NodeID to,
std::vector<NodeID> &unpacked_path); std::vector<NodeID> &unpacked_path);
@ -351,7 +350,7 @@ void retrievePackedPathFromSingleHeap(const SearchEngineData::QueryHeap &search_
// && source_phantom.GetForwardWeightPlusOffset() > target_phantom.GetForwardWeightPlusOffset()) // && source_phantom.GetForwardWeightPlusOffset() > target_phantom.GetForwardWeightPlusOffset())
// requires // requires
// a force loop, if the heaps have been initialized with positive offsets. // a force loop, if the heaps have been initialized with positive offsets.
void search(const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CH> &facade, void search(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
SearchEngineData::QueryHeap &forward_heap, SearchEngineData::QueryHeap &forward_heap,
SearchEngineData::QueryHeap &reverse_heap, SearchEngineData::QueryHeap &reverse_heap,
std::int32_t &weight, std::int32_t &weight,
@ -361,7 +360,7 @@ void search(const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CH>
const int duration_upper_bound = INVALID_EDGE_WEIGHT); const int duration_upper_bound = INVALID_EDGE_WEIGHT);
// 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
inline void search(const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CH> &facade, inline void search(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
SearchEngineData::QueryHeap &forward_heap, SearchEngineData::QueryHeap &forward_heap,
SearchEngineData::QueryHeap &reverse_heap, SearchEngineData::QueryHeap &reverse_heap,
SearchEngineData::QueryHeap &, SearchEngineData::QueryHeap &,
@ -382,31 +381,11 @@ inline void search(const datafacade::ContiguousInternalMemoryDataFacade<algorith
duration_upper_bound); duration_upper_bound);
} }
// assumes that heaps are already setup correctly.
// A forced loop might be necessary, if source and target are on the same segment.
// If this is the case and the offsets of the respective direction are larger for the source
// than the target
// then a force loop is required (e.g. source_phantom.forward_segment_id ==
// target_phantom.forward_segment_id
// && source_phantom.GetForwardWeightPlusOffset() > target_phantom.GetForwardWeightPlusOffset())
// requires
// a force loop, if the heaps have been initialized with positive offsets.
void search(const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CoreCH> &facade,
SearchEngineData::QueryHeap &forward_heap,
SearchEngineData::QueryHeap &reverse_heap,
SearchEngineData::QueryHeap &forward_core_heap,
SearchEngineData::QueryHeap &reverse_core_heap,
int &weight,
std::vector<NodeID> &packed_leg,
const bool force_loop_forward,
const bool force_loop_reverse,
int duration_upper_bound = INVALID_EDGE_WEIGHT);
bool needsLoopForward(const PhantomNode &source_phantom, const PhantomNode &target_phantom); bool needsLoopForward(const PhantomNode &source_phantom, const PhantomNode &target_phantom);
bool needsLoopBackwards(const PhantomNode &source_phantom, const PhantomNode &target_phantom); bool needsLoopBackwards(const PhantomNode &source_phantom, const PhantomNode &target_phantom);
double getPathDistance(const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CH> &facade, double getPathDistance(const datafacade::ContiguousInternalMemoryDataFacade<ch::Algorithm> &facade,
const std::vector<NodeID> &packed_path, const std::vector<NodeID> &packed_path,
const PhantomNode &source_phantom, const PhantomNode &source_phantom,
const PhantomNode &target_phantom); const PhantomNode &target_phantom);
@ -415,20 +394,7 @@ double getPathDistance(const datafacade::ContiguousInternalMemoryDataFacade<algo
// If heaps should be adjusted to be initialized outside of this function, // If heaps should be adjusted to be initialized outside of this function,
// the addition of force_loop parameters might be required // the addition of force_loop parameters might be required
double double
getNetworkDistance(const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CoreCH> &facade, getNetworkDistance(const datafacade::ContiguousInternalMemoryDataFacade<ch::Algorithm> &facade,
SearchEngineData::QueryHeap &forward_heap,
SearchEngineData::QueryHeap &reverse_heap,
SearchEngineData::QueryHeap &forward_core_heap,
SearchEngineData::QueryHeap &reverse_core_heap,
const PhantomNode &source_phantom,
const PhantomNode &target_phantom,
int duration_upper_bound = INVALID_EDGE_WEIGHT);
// Requires the heaps for be empty
// If heaps should be adjusted to be initialized outside of this function,
// the addition of force_loop parameters might be required
double
getNetworkDistance(const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CH> &facade,
SearchEngineData::QueryHeap &forward_heap, SearchEngineData::QueryHeap &forward_heap,
SearchEngineData::QueryHeap &reverse_heap, SearchEngineData::QueryHeap &reverse_heap,
const PhantomNode &source_phantom, const PhantomNode &source_phantom,
@ -437,7 +403,7 @@ getNetworkDistance(const datafacade::ContiguousInternalMemoryDataFacade<algorith
// 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
inline double inline double
getNetworkDistance(const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CH> &facade, getNetworkDistance(const datafacade::ContiguousInternalMemoryDataFacade<ch::Algorithm> &facade,
SearchEngineData::QueryHeap &forward_heap, SearchEngineData::QueryHeap &forward_heap,
SearchEngineData::QueryHeap &reverse_heap, SearchEngineData::QueryHeap &reverse_heap,
SearchEngineData::QueryHeap &, SearchEngineData::QueryHeap &,
@ -449,8 +415,44 @@ getNetworkDistance(const datafacade::ContiguousInternalMemoryDataFacade<algorith
return getNetworkDistance( return getNetworkDistance(
facade, forward_heap, reverse_heap, source_phantom, target_phantom, duration_upper_bound); facade, forward_heap, reverse_heap, source_phantom, target_phantom, duration_upper_bound);
} }
} // namespace ch } // namespace ch
namespace corech
{
// assumes that heaps are already setup correctly.
// A forced loop might be necessary, if source and target are on the same segment.
// If this is the case and the offsets of the respective direction are larger for the source
// than the target
// then a force loop is required (e.g. source_phantom.forward_segment_id ==
// target_phantom.forward_segment_id
// && source_phantom.GetForwardWeightPlusOffset() > target_phantom.GetForwardWeightPlusOffset())
// requires
// a force loop, if the heaps have been initialized with positive offsets.
void search(const datafacade::ContiguousInternalMemoryDataFacade<corech::Algorithm> &facade,
SearchEngineData::QueryHeap &forward_heap,
SearchEngineData::QueryHeap &reverse_heap,
SearchEngineData::QueryHeap &forward_core_heap,
SearchEngineData::QueryHeap &reverse_core_heap,
int &weight,
std::vector<NodeID> &packed_leg,
const bool force_loop_forward,
const bool force_loop_reverse,
int duration_upper_bound = INVALID_EDGE_WEIGHT);
// Requires the heaps for be empty
// If heaps should be adjusted to be initialized outside of this function,
// the addition of force_loop parameters might be required
double
getNetworkDistance(const datafacade::ContiguousInternalMemoryDataFacade<corech::Algorithm> &facade,
SearchEngineData::QueryHeap &forward_heap,
SearchEngineData::QueryHeap &reverse_heap,
SearchEngineData::QueryHeap &forward_core_heap,
SearchEngineData::QueryHeap &reverse_core_heap,
const PhantomNode &source_phantom,
const PhantomNode &target_phantom,
int duration_upper_bound = INVALID_EDGE_WEIGHT);
} // namespace corech
} // namespace routing_algorithms } // namespace routing_algorithms
} // namespace engine } // namespace engine
} // namespace osrm } // namespace osrm

View File

@ -57,7 +57,7 @@ bool checkParentCellRestriction(CellID cell, LevelID, CellID parent) { return ce
} }
template <bool DIRECTION, typename... Args> template <bool DIRECTION, typename... Args>
void routingStep(const datafacade::ContiguousInternalMemoryDataFacade<algorithm::MLD> &facade, void routingStep(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
SearchEngineData::MultiLayerDijkstraHeap &forward_heap, SearchEngineData::MultiLayerDijkstraHeap &forward_heap,
SearchEngineData::MultiLayerDijkstraHeap &reverse_heap, SearchEngineData::MultiLayerDijkstraHeap &reverse_heap,
NodeID &middle_node, NodeID &middle_node,
@ -171,7 +171,7 @@ void routingStep(const datafacade::ContiguousInternalMemoryDataFacade<algorithm:
template <typename... Args> template <typename... Args>
std::tuple<EdgeWeight, NodeID, NodeID, std::vector<EdgeID>> std::tuple<EdgeWeight, NodeID, NodeID, std::vector<EdgeID>>
search(const datafacade::ContiguousInternalMemoryDataFacade<algorithm::MLD> &facade, search(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
SearchEngineData::MultiLayerDijkstraHeap &forward_heap, SearchEngineData::MultiLayerDijkstraHeap &forward_heap,
SearchEngineData::MultiLayerDijkstraHeap &reverse_heap, SearchEngineData::MultiLayerDijkstraHeap &reverse_heap,
Args... args) Args... args)

View File

@ -15,13 +15,13 @@ namespace routing_algorithms
InternalRouteResult InternalRouteResult
shortestPathSearch(SearchEngineData &engine_working_data, shortestPathSearch(SearchEngineData &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CH> &facade, const datafacade::ContiguousInternalMemoryDataFacade<ch::Algorithm> &facade,
const std::vector<PhantomNodes> &phantom_nodes_vector, const std::vector<PhantomNodes> &phantom_nodes_vector,
const boost::optional<bool> continue_straight_at_waypoint); const boost::optional<bool> continue_straight_at_waypoint);
InternalRouteResult InternalRouteResult
shortestPathSearch(SearchEngineData &engine_working_data, shortestPathSearch(SearchEngineData &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CoreCH> &facade, const datafacade::ContiguousInternalMemoryDataFacade<corech::Algorithm> &facade,
const std::vector<PhantomNodes> &phantom_nodes_vector, const std::vector<PhantomNodes> &phantom_nodes_vector,
const boost::optional<bool> continue_straight_at_waypoint); const boost::optional<bool> continue_straight_at_waypoint);

View File

@ -29,7 +29,7 @@ struct TurnData final
using RTreeLeaf = datafacade::BaseDataFacade::RTreeLeaf; using RTreeLeaf = datafacade::BaseDataFacade::RTreeLeaf;
std::vector<TurnData> std::vector<TurnData>
getTileTurns(const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CH> &facade, getTileTurns(const datafacade::ContiguousInternalMemoryDataFacade<ch::Algorithm> &facade,
const std::vector<RTreeLeaf> &edges, const std::vector<RTreeLeaf> &edges,
const std::vector<std::size_t> &sorted_edge_indexes); const std::vector<std::size_t> &sorted_edge_indexes);

View File

@ -19,6 +19,8 @@ namespace engine
{ {
namespace routing_algorithms namespace routing_algorithms
{ {
namespace ch
{
namespace namespace
{ {
@ -48,8 +50,7 @@ struct RankedCandidateNode
// todo: reorder parameters // todo: reorder parameters
template <bool DIRECTION> template <bool DIRECTION>
void alternativeRoutingStep( void alternativeRoutingStep(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CH> &facade,
QueryHeap &heap1, QueryHeap &heap1,
QueryHeap &heap2, QueryHeap &heap2,
NodeID *middle_node, NodeID *middle_node,
@ -154,7 +155,7 @@ void retrievePackedAlternatePath(const QueryHeap &forward_heap1,
// done at this stage // done at this stage
void computeLengthAndSharingOfViaPath( void computeLengthAndSharingOfViaPath(
SearchEngineData &engine_working_data, SearchEngineData &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CH> &facade, const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
const NodeID via_node, const NodeID via_node,
int *real_length_of_via_path, int *real_length_of_via_path,
int *sharing_of_via_path, int *sharing_of_via_path,
@ -319,7 +320,7 @@ void computeLengthAndSharingOfViaPath(
// conduct T-Test // conduct T-Test
bool viaNodeCandidatePassesTTest( bool viaNodeCandidatePassesTTest(
SearchEngineData &engine_working_data, SearchEngineData &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CH> &facade, const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
QueryHeap &existing_forward_heap, QueryHeap &existing_forward_heap,
QueryHeap &existing_reverse_heap, QueryHeap &existing_reverse_heap,
QueryHeap &new_forward_heap, QueryHeap &new_forward_heap,
@ -563,7 +564,7 @@ bool viaNodeCandidatePassesTTest(
InternalRouteResult InternalRouteResult
alternativePathSearch(SearchEngineData &engine_working_data, alternativePathSearch(SearchEngineData &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CH> &facade, const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
const PhantomNodes &phantom_node_pair) const PhantomNodes &phantom_node_pair)
{ {
InternalRouteResult raw_route_data; InternalRouteResult raw_route_data;
@ -846,6 +847,7 @@ alternativePathSearch(SearchEngineData &engine_working_data,
return raw_route_data; return raw_route_data;
} }
} // namespace ch
} // namespace routing_algorithms } // namespace routing_algorithms
} // namespace engine } // namespace engine
} // namespace osrm} } // namespace osrm}

View File

@ -109,7 +109,7 @@ InternalRouteResult directShortestPathSearchImpl(
template <> template <>
InternalRouteResult directShortestPathSearch( InternalRouteResult directShortestPathSearch(
SearchEngineData &engine_working_data, SearchEngineData &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CoreCH> &facade, const datafacade::ContiguousInternalMemoryDataFacade<corech::Algorithm> &facade,
const PhantomNodes &phantom_nodes) const PhantomNodes &phantom_nodes)
{ {
return ch::directShortestPathSearchImpl(engine_working_data, facade, phantom_nodes); return ch::directShortestPathSearchImpl(engine_working_data, facade, phantom_nodes);
@ -118,7 +118,7 @@ InternalRouteResult directShortestPathSearch(
template <> template <>
InternalRouteResult directShortestPathSearch( InternalRouteResult directShortestPathSearch(
SearchEngineData &engine_working_data, SearchEngineData &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CH> &facade, const datafacade::ContiguousInternalMemoryDataFacade<ch::Algorithm> &facade,
const PhantomNodes &phantom_nodes) const PhantomNodes &phantom_nodes)
{ {
return ch::directShortestPathSearchImpl(engine_working_data, facade, phantom_nodes); return ch::directShortestPathSearchImpl(engine_working_data, facade, phantom_nodes);
@ -127,7 +127,7 @@ InternalRouteResult directShortestPathSearch(
template <> template <>
InternalRouteResult directShortestPathSearch( InternalRouteResult directShortestPathSearch(
SearchEngineData &engine_working_data, SearchEngineData &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<algorithm::MLD> &facade, const datafacade::ContiguousInternalMemoryDataFacade<mld::Algorithm> &facade,
const PhantomNodes &phantom_nodes) const PhantomNodes &phantom_nodes)
{ {
engine_working_data.InitializeOrClearMultiLayerDijkstraThreadLocalStorage( engine_working_data.InitializeOrClearMultiLayerDijkstraThreadLocalStorage(

View File

@ -17,6 +17,9 @@ namespace routing_algorithms
using ManyToManyQueryHeap = SearchEngineData::ManyToManyQueryHeap; using ManyToManyQueryHeap = SearchEngineData::ManyToManyQueryHeap;
namespace ch
{
namespace namespace
{ {
struct NodeBucket struct NodeBucket
@ -34,7 +37,7 @@ struct NodeBucket
using SearchSpaceWithBuckets = std::unordered_map<NodeID, std::vector<NodeBucket>>; using SearchSpaceWithBuckets = std::unordered_map<NodeID, std::vector<NodeBucket>>;
template <bool DIRECTION> template <bool DIRECTION>
void relaxOutgoingEdges(const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CH> &facade, void relaxOutgoingEdges(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
const NodeID node, const NodeID node,
const EdgeWeight weight, const EdgeWeight weight,
const EdgeWeight duration, const EdgeWeight duration,
@ -69,7 +72,7 @@ void relaxOutgoingEdges(const datafacade::ContiguousInternalMemoryDataFacade<alg
} }
} }
void forwardRoutingStep(const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CH> &facade, void forwardRoutingStep(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
const unsigned row_idx, const unsigned row_idx,
const unsigned number_of_targets, const unsigned number_of_targets,
ManyToManyQueryHeap &query_heap, ManyToManyQueryHeap &query_heap,
@ -126,8 +129,7 @@ void forwardRoutingStep(const datafacade::ContiguousInternalMemoryDataFacade<alg
relaxOutgoingEdges<FORWARD_DIRECTION>(facade, node, source_weight, source_duration, query_heap); relaxOutgoingEdges<FORWARD_DIRECTION>(facade, node, source_weight, source_duration, query_heap);
} }
void backwardRoutingStep( void backwardRoutingStep(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CH> &facade,
const unsigned column_idx, const unsigned column_idx,
ManyToManyQueryHeap &query_heap, ManyToManyQueryHeap &query_heap,
SearchSpaceWithBuckets &search_space_with_buckets) SearchSpaceWithBuckets &search_space_with_buckets)
@ -150,7 +152,7 @@ void backwardRoutingStep(
std::vector<EdgeWeight> std::vector<EdgeWeight>
manyToManySearch(SearchEngineData &engine_working_data, manyToManySearch(SearchEngineData &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CH> &facade, const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
const std::vector<PhantomNode> &phantom_nodes, const std::vector<PhantomNode> &phantom_nodes,
const std::vector<std::size_t> &source_indices, const std::vector<std::size_t> &source_indices,
const std::vector<std::size_t> &target_indices) const std::vector<std::size_t> &target_indices)
@ -240,6 +242,7 @@ manyToManySearch(SearchEngineData &engine_working_data,
return durations_table; return durations_table;
} }
} // namespace ch
} // namespace routing_algorithms } // namespace routing_algorithms
} // namespace engine } // namespace engine
} // namespace osrm } // namespace osrm

View File

@ -419,9 +419,10 @@ mapMatchingImpl(SearchEngineData &engine_working_data,
return sub_matchings; return sub_matchings;
} }
SubMatchingList namespace ch
mapMatching(SearchEngineData &engine_working_data, {
const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CH> &facade, SubMatchingList mapMatching(SearchEngineData &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
const CandidateLists &candidates_list, const CandidateLists &candidates_list,
const std::vector<util::Coordinate> &trace_coordinates, const std::vector<util::Coordinate> &trace_coordinates,
const std::vector<unsigned> &trace_timestamps, const std::vector<unsigned> &trace_timestamps,
@ -436,10 +437,12 @@ mapMatching(SearchEngineData &engine_working_data,
trace_gps_precision, trace_gps_precision,
use_tidying); use_tidying);
} }
}
SubMatchingList namespace corech
mapMatching(SearchEngineData &engine_working_data, {
const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CoreCH> &facade, SubMatchingList mapMatching(SearchEngineData &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
const CandidateLists &candidates_list, const CandidateLists &candidates_list,
const std::vector<util::Coordinate> &trace_coordinates, const std::vector<util::Coordinate> &trace_coordinates,
const std::vector<unsigned> &trace_timestamps, const std::vector<unsigned> &trace_timestamps,
@ -455,6 +458,7 @@ mapMatching(SearchEngineData &engine_working_data,
trace_gps_precision, trace_gps_precision,
use_tidying); use_tidying);
} }
}
} // namespace routing_algorithms } // namespace routing_algorithms
} // namespace engine } // namespace engine

View File

@ -16,7 +16,7 @@ namespace ch
* @param to the node the CH edge finishes at * @param to the node the CH edge finishes at
* @param unpacked_path the sequence of original NodeIDs that make up the expanded CH edge * @param unpacked_path the sequence of original NodeIDs that make up the expanded CH edge
*/ */
void unpackEdge(const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CH> &facade, void unpackEdge(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
const NodeID from, const NodeID from,
const NodeID to, const NodeID to,
std::vector<NodeID> &unpacked_path) std::vector<NodeID> &unpacked_path)
@ -71,7 +71,7 @@ void retrievePackedPathFromSingleHeap(const SearchEngineData::QueryHeap &search_
// && source_phantom.GetForwardWeightPlusOffset() > target_phantom.GetForwardWeightPlusOffset()) // && source_phantom.GetForwardWeightPlusOffset() > target_phantom.GetForwardWeightPlusOffset())
// requires // requires
// a force loop, if the heaps have been initialized with positive offsets. // a force loop, if the heaps have been initialized with positive offsets.
void search(const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CH> &facade, void search(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
SearchEngineData::QueryHeap &forward_heap, SearchEngineData::QueryHeap &forward_heap,
SearchEngineData::QueryHeap &reverse_heap, SearchEngineData::QueryHeap &reverse_heap,
EdgeWeight &weight, EdgeWeight &weight,
@ -139,190 +139,6 @@ void search(const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CH>
} }
} }
// assumes that heaps are already setup correctly.
// A forced loop might be necessary, if source and target are on the same segment.
// If this is the case and the offsets of the respective direction are larger for the source
// than the target
// then a force loop is required (e.g. source_phantom.forward_segment_id ==
// target_phantom.forward_segment_id
// && source_phantom.GetForwardWeightPlusOffset() > target_phantom.GetForwardWeightPlusOffset())
// requires
// a force loop, if the heaps have been initialized with positive offsets.
void search(const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CoreCH> &facade,
SearchEngineData::QueryHeap &forward_heap,
SearchEngineData::QueryHeap &reverse_heap,
SearchEngineData::QueryHeap &forward_core_heap,
SearchEngineData::QueryHeap &reverse_core_heap,
EdgeWeight &weight,
std::vector<NodeID> &packed_leg,
const bool force_loop_forward,
const bool force_loop_reverse,
EdgeWeight weight_upper_bound)
{
NodeID middle = SPECIAL_NODEID;
weight = weight_upper_bound;
using CoreEntryPoint = std::tuple<NodeID, EdgeWeight, NodeID>;
std::vector<CoreEntryPoint> forward_entry_points;
std::vector<CoreEntryPoint> reverse_entry_points;
// get offset to account for offsets on phantom nodes on compressed edges
const auto min_edge_offset = std::min(0, forward_heap.MinKey());
// we only every insert negative offsets for nodes in the forward heap
BOOST_ASSERT(reverse_heap.MinKey() >= 0);
// run two-Target Dijkstra routing step.
while (0 < (forward_heap.Size() + reverse_heap.Size()))
{
if (!forward_heap.Empty())
{
if (facade.IsCoreNode(forward_heap.Min()))
{
const NodeID node = forward_heap.DeleteMin();
const EdgeWeight key = forward_heap.GetKey(node);
forward_entry_points.emplace_back(node, key, forward_heap.GetData(node).parent);
}
else
{
routingStep<FORWARD_DIRECTION>(facade,
forward_heap,
reverse_heap,
middle,
weight,
min_edge_offset,
force_loop_forward,
force_loop_reverse);
}
}
if (!reverse_heap.Empty())
{
if (facade.IsCoreNode(reverse_heap.Min()))
{
const NodeID node = reverse_heap.DeleteMin();
const EdgeWeight key = reverse_heap.GetKey(node);
reverse_entry_points.emplace_back(node, key, reverse_heap.GetData(node).parent);
}
else
{
routingStep<REVERSE_DIRECTION>(facade,
reverse_heap,
forward_heap,
middle,
weight,
min_edge_offset,
force_loop_reverse,
force_loop_forward);
}
}
}
const auto insertInCoreHeap = [](const CoreEntryPoint &p,
SearchEngineData::QueryHeap &core_heap) {
NodeID id;
EdgeWeight weight;
NodeID parent;
// TODO this should use std::apply when we get c++17 support
std::tie(id, weight, parent) = p;
core_heap.Insert(id, weight, parent);
};
forward_core_heap.Clear();
for (const auto &p : forward_entry_points)
{
insertInCoreHeap(p, forward_core_heap);
}
reverse_core_heap.Clear();
for (const auto &p : reverse_entry_points)
{
insertInCoreHeap(p, reverse_core_heap);
}
// get offset to account for offsets on phantom nodes on compressed edges
EdgeWeight min_core_edge_offset = 0;
if (forward_core_heap.Size() > 0)
{
min_core_edge_offset = std::min(min_core_edge_offset, forward_core_heap.MinKey());
}
if (reverse_core_heap.Size() > 0 && reverse_core_heap.MinKey() < 0)
{
min_core_edge_offset = std::min(min_core_edge_offset, reverse_core_heap.MinKey());
}
BOOST_ASSERT(min_core_edge_offset <= 0);
// run two-target Dijkstra routing step on core with termination criterion
while (0 < forward_core_heap.Size() && 0 < reverse_core_heap.Size() &&
weight > (forward_core_heap.MinKey() + reverse_core_heap.MinKey()))
{
routingStep<FORWARD_DIRECTION, DISABLE_STALLING>(facade,
forward_core_heap,
reverse_core_heap,
middle,
weight,
min_core_edge_offset,
force_loop_forward,
force_loop_reverse);
routingStep<REVERSE_DIRECTION, DISABLE_STALLING>(facade,
reverse_core_heap,
forward_core_heap,
middle,
weight,
min_core_edge_offset,
force_loop_reverse,
force_loop_forward);
}
// No path found for both target nodes?
if (weight_upper_bound <= weight || SPECIAL_NODEID == middle)
{
weight = INVALID_EDGE_WEIGHT;
return;
}
// Was a paths over one of the forward/reverse nodes not found?
BOOST_ASSERT_MSG((SPECIAL_NODEID != middle && INVALID_EDGE_WEIGHT != weight), "no path found");
// we need to unpack sub path from core heaps
if (facade.IsCoreNode(middle))
{
if (weight != forward_core_heap.GetKey(middle) + reverse_core_heap.GetKey(middle))
{
// self loop
BOOST_ASSERT(forward_core_heap.GetData(middle).parent == middle &&
reverse_core_heap.GetData(middle).parent == middle);
packed_leg.push_back(middle);
packed_leg.push_back(middle);
}
else
{
std::vector<NodeID> packed_core_leg;
retrievePackedPathFromHeap(
forward_core_heap, reverse_core_heap, middle, packed_core_leg);
BOOST_ASSERT(packed_core_leg.size() > 0);
retrievePackedPathFromSingleHeap(forward_heap, packed_core_leg.front(), packed_leg);
std::reverse(packed_leg.begin(), packed_leg.end());
packed_leg.insert(packed_leg.end(), packed_core_leg.begin(), packed_core_leg.end());
retrievePackedPathFromSingleHeap(reverse_heap, packed_core_leg.back(), packed_leg);
}
}
else
{
if (weight != forward_heap.GetKey(middle) + reverse_heap.GetKey(middle))
{
// self loop
BOOST_ASSERT(forward_heap.GetData(middle).parent == middle &&
reverse_heap.GetData(middle).parent == middle);
packed_leg.push_back(middle);
packed_leg.push_back(middle);
}
else
{
retrievePackedPathFromHeap(forward_heap, reverse_heap, middle, packed_leg);
}
}
}
bool needsLoopForward(const PhantomNode &source_phantom, const PhantomNode &target_phantom) bool needsLoopForward(const PhantomNode &source_phantom, const PhantomNode &target_phantom)
{ {
return source_phantom.forward_segment_id.enabled && target_phantom.forward_segment_id.enabled && return source_phantom.forward_segment_id.enabled && target_phantom.forward_segment_id.enabled &&
@ -339,7 +155,7 @@ bool needsLoopBackwards(const PhantomNode &source_phantom, const PhantomNode &ta
target_phantom.GetReverseWeightPlusOffset(); target_phantom.GetReverseWeightPlusOffset();
} }
double getPathDistance(const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CH> &facade, double getPathDistance(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
const std::vector<NodeID> &packed_path, const std::vector<NodeID> &packed_path,
const PhantomNode &source_phantom, const PhantomNode &source_phantom,
const PhantomNode &target_phantom) const PhantomNode &target_phantom)
@ -398,49 +214,7 @@ double getPathDistance(const datafacade::ContiguousInternalMemoryDataFacade<algo
// Requires the heaps for be empty // Requires the heaps for be empty
// If heaps should be adjusted to be initialized outside of this function, // If heaps should be adjusted to be initialized outside of this function,
// the addition of force_loop parameters might be required // the addition of force_loop parameters might be required
double double getNetworkDistance(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
getNetworkDistance(const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CoreCH> &facade,
SearchEngineData::QueryHeap &forward_heap,
SearchEngineData::QueryHeap &reverse_heap,
SearchEngineData::QueryHeap &forward_core_heap,
SearchEngineData::QueryHeap &reverse_core_heap,
const PhantomNode &source_phantom,
const PhantomNode &target_phantom,
EdgeWeight weight_upper_bound)
{
forward_heap.Clear();
reverse_heap.Clear();
forward_core_heap.Clear();
reverse_core_heap.Clear();
insertNodesInHeaps(forward_heap, reverse_heap, {source_phantom, target_phantom});
EdgeWeight weight = INVALID_EDGE_WEIGHT;
std::vector<NodeID> packed_path;
search(facade,
forward_heap,
reverse_heap,
forward_core_heap,
reverse_core_heap,
weight,
packed_path,
DO_NOT_FORCE_LOOPS,
DO_NOT_FORCE_LOOPS,
weight_upper_bound);
double distance = std::numeric_limits<double>::max();
if (weight != INVALID_EDGE_WEIGHT)
{
return getPathDistance(facade, packed_path, source_phantom, target_phantom);
}
return distance;
}
// Requires the heaps for be empty
// If heaps should be adjusted to be initialized outside of this function,
// the addition of force_loop parameters might be required
double
getNetworkDistance(const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CH> &facade,
SearchEngineData::QueryHeap &forward_heap, SearchEngineData::QueryHeap &forward_heap,
SearchEngineData::QueryHeap &reverse_heap, SearchEngineData::QueryHeap &reverse_heap,
const PhantomNode &source_phantom, const PhantomNode &source_phantom,
@ -494,8 +268,235 @@ getNetworkDistance(const datafacade::ContiguousInternalMemoryDataFacade<algorith
return getPathDistance(facade, packed_path, source_phantom, target_phantom); return getPathDistance(facade, packed_path, source_phantom, target_phantom);
} }
} // namespace ch } // namespace ch
namespace corech
{
// Assumes that heaps are already setup correctly.
// A forced loop might be necessary, if source and target are on the same segment.
// If this is the case and the offsets of the respective direction are larger for the source
// than the target
// then a force loop is required (e.g. source_phantom.forward_segment_id ==
// target_phantom.forward_segment_id
// && source_phantom.GetForwardWeightPlusOffset() > target_phantom.GetForwardWeightPlusOffset())
// requires
// a force loop, if the heaps have been initialized with positive offsets.
void search(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
SearchEngineData::QueryHeap &forward_heap,
SearchEngineData::QueryHeap &reverse_heap,
SearchEngineData::QueryHeap &forward_core_heap,
SearchEngineData::QueryHeap &reverse_core_heap,
EdgeWeight &weight,
std::vector<NodeID> &packed_leg,
const bool force_loop_forward,
const bool force_loop_reverse,
EdgeWeight weight_upper_bound)
{
NodeID middle = SPECIAL_NODEID;
weight = weight_upper_bound;
using CoreEntryPoint = std::tuple<NodeID, EdgeWeight, NodeID>;
std::vector<CoreEntryPoint> forward_entry_points;
std::vector<CoreEntryPoint> reverse_entry_points;
// get offset to account for offsets on phantom nodes on compressed edges
const auto min_edge_offset = std::min(0, forward_heap.MinKey());
// we only every insert negative offsets for nodes in the forward heap
BOOST_ASSERT(reverse_heap.MinKey() >= 0);
// run two-Target Dijkstra routing step.
while (0 < (forward_heap.Size() + reverse_heap.Size()))
{
if (!forward_heap.Empty())
{
if (facade.IsCoreNode(forward_heap.Min()))
{
const NodeID node = forward_heap.DeleteMin();
const EdgeWeight key = forward_heap.GetKey(node);
forward_entry_points.emplace_back(node, key, forward_heap.GetData(node).parent);
}
else
{
ch::routingStep<FORWARD_DIRECTION>(facade,
forward_heap,
reverse_heap,
middle,
weight,
min_edge_offset,
force_loop_forward,
force_loop_reverse);
}
}
if (!reverse_heap.Empty())
{
if (facade.IsCoreNode(reverse_heap.Min()))
{
const NodeID node = reverse_heap.DeleteMin();
const EdgeWeight key = reverse_heap.GetKey(node);
reverse_entry_points.emplace_back(node, key, reverse_heap.GetData(node).parent);
}
else
{
ch::routingStep<REVERSE_DIRECTION>(facade,
reverse_heap,
forward_heap,
middle,
weight,
min_edge_offset,
force_loop_reverse,
force_loop_forward);
}
}
}
const auto insertInCoreHeap = [](const CoreEntryPoint &p,
SearchEngineData::QueryHeap &core_heap) {
NodeID id;
EdgeWeight weight;
NodeID parent;
// TODO this should use std::apply when we get c++17 support
std::tie(id, weight, parent) = p;
core_heap.Insert(id, weight, parent);
};
forward_core_heap.Clear();
for (const auto &p : forward_entry_points)
{
insertInCoreHeap(p, forward_core_heap);
}
reverse_core_heap.Clear();
for (const auto &p : reverse_entry_points)
{
insertInCoreHeap(p, reverse_core_heap);
}
// get offset to account for offsets on phantom nodes on compressed edges
EdgeWeight min_core_edge_offset = 0;
if (forward_core_heap.Size() > 0)
{
min_core_edge_offset = std::min(min_core_edge_offset, forward_core_heap.MinKey());
}
if (reverse_core_heap.Size() > 0 && reverse_core_heap.MinKey() < 0)
{
min_core_edge_offset = std::min(min_core_edge_offset, reverse_core_heap.MinKey());
}
BOOST_ASSERT(min_core_edge_offset <= 0);
// run two-target Dijkstra routing step on core with termination criterion
while (0 < forward_core_heap.Size() && 0 < reverse_core_heap.Size() &&
weight > (forward_core_heap.MinKey() + reverse_core_heap.MinKey()))
{
ch::routingStep<FORWARD_DIRECTION, ch::DISABLE_STALLING>(facade,
forward_core_heap,
reverse_core_heap,
middle,
weight,
min_core_edge_offset,
force_loop_forward,
force_loop_reverse);
ch::routingStep<REVERSE_DIRECTION, ch::DISABLE_STALLING>(facade,
reverse_core_heap,
forward_core_heap,
middle,
weight,
min_core_edge_offset,
force_loop_reverse,
force_loop_forward);
}
// No path found for both target nodes?
if (weight_upper_bound <= weight || SPECIAL_NODEID == middle)
{
weight = INVALID_EDGE_WEIGHT;
return;
}
// Was a paths over one of the forward/reverse nodes not found?
BOOST_ASSERT_MSG((SPECIAL_NODEID != middle && INVALID_EDGE_WEIGHT != weight), "no path found");
// we need to unpack sub path from core heaps
if (facade.IsCoreNode(middle))
{
if (weight != forward_core_heap.GetKey(middle) + reverse_core_heap.GetKey(middle))
{
// self loop
BOOST_ASSERT(forward_core_heap.GetData(middle).parent == middle &&
reverse_core_heap.GetData(middle).parent == middle);
packed_leg.push_back(middle);
packed_leg.push_back(middle);
}
else
{
std::vector<NodeID> packed_core_leg;
ch::retrievePackedPathFromHeap(
forward_core_heap, reverse_core_heap, middle, packed_core_leg);
BOOST_ASSERT(packed_core_leg.size() > 0);
ch::retrievePackedPathFromSingleHeap(forward_heap, packed_core_leg.front(), packed_leg);
std::reverse(packed_leg.begin(), packed_leg.end());
packed_leg.insert(packed_leg.end(), packed_core_leg.begin(), packed_core_leg.end());
ch::retrievePackedPathFromSingleHeap(reverse_heap, packed_core_leg.back(), packed_leg);
}
}
else
{
if (weight != forward_heap.GetKey(middle) + reverse_heap.GetKey(middle))
{
// self loop
BOOST_ASSERT(forward_heap.GetData(middle).parent == middle &&
reverse_heap.GetData(middle).parent == middle);
packed_leg.push_back(middle);
packed_leg.push_back(middle);
}
else
{
ch::retrievePackedPathFromHeap(forward_heap, reverse_heap, middle, packed_leg);
}
}
}
// Requires the heaps for be empty
// If heaps should be adjusted to be initialized outside of this function,
// the addition of force_loop parameters might be required
double getNetworkDistance(const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
SearchEngineData::QueryHeap &forward_heap,
SearchEngineData::QueryHeap &reverse_heap,
SearchEngineData::QueryHeap &forward_core_heap,
SearchEngineData::QueryHeap &reverse_core_heap,
const PhantomNode &source_phantom,
const PhantomNode &target_phantom,
EdgeWeight weight_upper_bound)
{
forward_heap.Clear();
reverse_heap.Clear();
forward_core_heap.Clear();
reverse_core_heap.Clear();
insertNodesInHeaps(forward_heap, reverse_heap, {source_phantom, target_phantom});
EdgeWeight weight = INVALID_EDGE_WEIGHT;
std::vector<NodeID> packed_path;
search(facade,
forward_heap,
reverse_heap,
forward_core_heap,
reverse_core_heap,
weight,
packed_path,
DO_NOT_FORCE_LOOPS,
DO_NOT_FORCE_LOOPS,
weight_upper_bound);
double distance = std::numeric_limits<double>::max();
if (weight != INVALID_EDGE_WEIGHT)
{
return ch::getPathDistance(facade, packed_path, source_phantom, target_phantom);
}
return distance;
}
} // namespace corech
} // namespace routing_algorithms } // namespace routing_algorithms
} // namespace engine } // namespace engine
} // namespace osrm } // namespace osrm

View File

@ -198,7 +198,7 @@ void search(const datafacade::ContiguousInternalMemoryDataFacade<AlgorithmT> &fa
} }
} }
void unpackLegs(const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CH> &facade, void unpackLegs(const datafacade::ContiguousInternalMemoryDataFacade<ch::Algorithm> &facade,
const std::vector<PhantomNodes> &phantom_nodes_vector, const std::vector<PhantomNodes> &phantom_nodes_vector,
const std::vector<NodeID> &total_packed_path, const std::vector<NodeID> &total_packed_path,
const std::vector<std::size_t> &packed_leg_begin, const std::vector<std::size_t> &packed_leg_begin,
@ -486,7 +486,7 @@ shortestPathSearchImpl(SearchEngineData &engine_working_data,
InternalRouteResult InternalRouteResult
shortestPathSearch(SearchEngineData &engine_working_data, shortestPathSearch(SearchEngineData &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CH> &facade, const datafacade::ContiguousInternalMemoryDataFacade<ch::Algorithm> &facade,
const std::vector<PhantomNodes> &phantom_nodes_vector, const std::vector<PhantomNodes> &phantom_nodes_vector,
const boost::optional<bool> continue_straight_at_waypoint) const boost::optional<bool> continue_straight_at_waypoint)
{ {
@ -496,7 +496,7 @@ shortestPathSearch(SearchEngineData &engine_working_data,
InternalRouteResult InternalRouteResult
shortestPathSearch(SearchEngineData &engine_working_data, shortestPathSearch(SearchEngineData &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CoreCH> &facade, const datafacade::ContiguousInternalMemoryDataFacade<corech::Algorithm> &facade,
const std::vector<PhantomNodes> &phantom_nodes_vector, const std::vector<PhantomNodes> &phantom_nodes_vector,
const boost::optional<bool> continue_straight_at_waypoint) const boost::optional<bool> continue_straight_at_waypoint)
{ {

View File

@ -8,7 +8,7 @@ namespace routing_algorithms
{ {
std::vector<TurnData> std::vector<TurnData>
getTileTurns(const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CH> &facade, getTileTurns(const datafacade::ContiguousInternalMemoryDataFacade<ch::Algorithm> &facade,
const std::vector<RTreeLeaf> &edges, const std::vector<RTreeLeaf> &edges,
const std::vector<std::size_t> &sorted_edge_indexes) const std::vector<std::size_t> &sorted_edge_indexes)
{ {

View File

@ -18,11 +18,14 @@ namespace osrm
OSRM::OSRM(engine::EngineConfig &config) OSRM::OSRM(engine::EngineConfig &config)
{ {
using CH = engine::routing_algorithms::ch::Algorithm;
using CoreCH = engine::routing_algorithms::corech::Algorithm;
using MLD = engine::routing_algorithms::mld::Algorithm;
if (config.algorithm == EngineConfig::Algorithm::CoreCH || if (config.algorithm == EngineConfig::Algorithm::CoreCH ||
config.algorithm == EngineConfig::Algorithm::CH) config.algorithm == EngineConfig::Algorithm::CH)
{ {
bool corech_compatible = bool corech_compatible = engine::Engine<CoreCH>::CheckCompability(config);
engine::Engine<engine::algorithm::CoreCH>::CheckCompability(config);
// Activate CoreCH if we can because it is faster // Activate CoreCH if we can because it is faster
if (config.algorithm == EngineConfig::Algorithm::CH && corech_compatible) if (config.algorithm == EngineConfig::Algorithm::CH && corech_compatible)
@ -40,13 +43,13 @@ OSRM::OSRM(engine::EngineConfig &config)
switch (config.algorithm) switch (config.algorithm)
{ {
case EngineConfig::Algorithm::CH: case EngineConfig::Algorithm::CH:
engine_ = std::make_unique<engine::Engine<engine::algorithm::CH>>(config); engine_ = std::make_unique<engine::Engine<CH>>(config);
break; break;
case EngineConfig::Algorithm::CoreCH: case EngineConfig::Algorithm::CoreCH:
engine_ = std::make_unique<engine::Engine<engine::algorithm::CoreCH>>(config); engine_ = std::make_unique<engine::Engine<CoreCH>>(config);
break; break;
case EngineConfig::Algorithm::MLD: case EngineConfig::Algorithm::MLD:
engine_ = std::make_unique<engine::Engine<engine::algorithm::MLD>>(config); engine_ = std::make_unique<engine::Engine<MLD>>(config);
break; break;
default: default:
util::exception("Algorithm not implemented!"); util::exception("Algorithm not implemented!");

View File

@ -43,7 +43,7 @@ BOOST_AUTO_TEST_CASE(hint_encoding_decoding_roundtrip)
const Coordinate coordinate; const Coordinate coordinate;
const PhantomNode phantom; const PhantomNode phantom;
const osrm::test::MockDataFacade<osrm::engine::algorithm::CH> facade{}; const osrm::test::MockDataFacade<osrm::engine::datafacade::CH> facade{};
const Hint hint{phantom, facade.GetCheckSum()}; const Hint hint{phantom, facade.GetCheckSum()};
@ -64,7 +64,7 @@ BOOST_AUTO_TEST_CASE(hint_encoding_decoding_roundtrip_bytewise)
const Coordinate coordinate; const Coordinate coordinate;
const PhantomNode phantom; const PhantomNode phantom;
const osrm::test::MockDataFacade<osrm::engine::algorithm::CH> facade{}; const osrm::test::MockDataFacade<osrm::engine::datafacade::CH> facade{};
const Hint hint{phantom, facade.GetCheckSum()}; const Hint hint{phantom, facade.GetCheckSum()};

View File

@ -238,8 +238,8 @@ class MockBaseDataFacade : public engine::datafacade::BaseDataFacade
template <typename AlgorithmT> class MockAlgorithmDataFacade; template <typename AlgorithmT> class MockAlgorithmDataFacade;
template <> template <>
class MockAlgorithmDataFacade<engine::algorithm::CH> class MockAlgorithmDataFacade<engine::datafacade::CH>
: public engine::datafacade::AlgorithmDataFacade<engine::algorithm::CH> : public engine::datafacade::AlgorithmDataFacade<engine::datafacade::CH>
{ {
private: private:
EdgeData foo; EdgeData foo;
@ -281,8 +281,8 @@ class MockAlgorithmDataFacade<engine::algorithm::CH>
}; };
template <> template <>
class MockAlgorithmDataFacade<engine::algorithm::CoreCH> class MockAlgorithmDataFacade<engine::datafacade::CoreCH>
: public engine::datafacade::AlgorithmDataFacade<engine::algorithm::CoreCH> : public engine::datafacade::AlgorithmDataFacade<engine::datafacade::CoreCH>
{ {
private: private:
EdgeData foo; EdgeData foo;
@ -297,10 +297,10 @@ class MockDataFacade final : public MockBaseDataFacade, public MockAlgorithmData
}; };
template <> template <>
class MockDataFacade<engine::algorithm::CoreCH> final class MockDataFacade<engine::datafacade::CoreCH> final
: public MockBaseDataFacade, : public MockBaseDataFacade,
public MockAlgorithmDataFacade<engine::algorithm::CH>, public MockAlgorithmDataFacade<engine::datafacade::CH>,
public MockAlgorithmDataFacade<engine::algorithm::CoreCH> public MockAlgorithmDataFacade<engine::datafacade::CoreCH>
{ {
}; };

View File

@ -360,8 +360,8 @@ BOOST_AUTO_TEST_CASE(radius_regression_test)
std::string nodes_path; std::string nodes_path;
build_rtree<GraphFixture, MiniStaticRTree>("test_angle", &fixture, leaves_path, nodes_path); build_rtree<GraphFixture, MiniStaticRTree>("test_angle", &fixture, leaves_path, nodes_path);
MiniStaticRTree rtree(nodes_path, leaves_path, fixture.coords); MiniStaticRTree rtree(nodes_path, leaves_path, fixture.coords);
MockDataFacade<engine::algorithm::CH> mockfacade; MockDataFacade<engine::datafacade::CH> mockfacade;
engine::GeospatialQuery<MiniStaticRTree, MockDataFacade<engine::algorithm::CH>> query( engine::GeospatialQuery<MiniStaticRTree, MockDataFacade<engine::datafacade::CH>> query(
rtree, fixture.coords, mockfacade); rtree, fixture.coords, mockfacade);
Coordinate input(FloatLongitude{5.2}, FloatLatitude{5.0}); Coordinate input(FloatLongitude{5.2}, FloatLatitude{5.0});
@ -387,8 +387,8 @@ BOOST_AUTO_TEST_CASE(bearing_tests)
std::string nodes_path; std::string nodes_path;
build_rtree<GraphFixture, MiniStaticRTree>("test_bearing", &fixture, leaves_path, nodes_path); build_rtree<GraphFixture, MiniStaticRTree>("test_bearing", &fixture, leaves_path, nodes_path);
MiniStaticRTree rtree(nodes_path, leaves_path, fixture.coords); MiniStaticRTree rtree(nodes_path, leaves_path, fixture.coords);
MockDataFacade<engine::algorithm::CH> mockfacade; MockDataFacade<engine::datafacade::CH> mockfacade;
engine::GeospatialQuery<MiniStaticRTree, MockDataFacade<engine::algorithm::CH>> query( engine::GeospatialQuery<MiniStaticRTree, MockDataFacade<engine::datafacade::CH>> query(
rtree, fixture.coords, mockfacade); rtree, fixture.coords, mockfacade);
Coordinate input(FloatLongitude{5.1}, FloatLatitude{5.0}); Coordinate input(FloatLongitude{5.1}, FloatLatitude{5.0});
@ -461,8 +461,8 @@ BOOST_AUTO_TEST_CASE(bbox_search_tests)
std::string nodes_path; std::string nodes_path;
build_rtree<GraphFixture, MiniStaticRTree>("test_bbox", &fixture, leaves_path, nodes_path); build_rtree<GraphFixture, MiniStaticRTree>("test_bbox", &fixture, leaves_path, nodes_path);
MiniStaticRTree rtree(nodes_path, leaves_path, fixture.coords); MiniStaticRTree rtree(nodes_path, leaves_path, fixture.coords);
MockDataFacade<engine::algorithm::CH> mockfacade; MockDataFacade<engine::datafacade::CH> mockfacade;
engine::GeospatialQuery<MiniStaticRTree, MockDataFacade<engine::algorithm::CH>> query( engine::GeospatialQuery<MiniStaticRTree, MockDataFacade<engine::datafacade::CH>> query(
rtree, fixture.coords, mockfacade); rtree, fixture.coords, mockfacade);
{ {