Make explicit fallback to CH heaps in CoreCH algorithms

This commit is contained in:
Michael Krasnyk
2017-04-11 21:22:07 +02:00
committed by Patrick Niklaus
parent 1de031ed06
commit e498ad3ee7
10 changed files with 52 additions and 41 deletions
+1 -1
View File
@@ -132,7 +132,7 @@ template <typename Algorithm> class Engine final : public EngineInterface
private:
std::unique_ptr<DataFacadeProvider<Algorithm>> facade_provider;
mutable SearchEngineData<Algorithm> heaps;
mutable SearchEngineData<typename RoutingAlgorithms<Algorithm>::HeapAlgorithm> heaps;
const plugins::ViaRoutePlugin route_plugin;
const plugins::TablePlugin table_plugin;
+12 -2
View File
@@ -57,7 +57,16 @@ class RoutingAlgorithmsInterface
template <typename Algorithm> class RoutingAlgorithms final : public RoutingAlgorithmsInterface
{
public:
RoutingAlgorithms(SearchEngineData<Algorithm> &heaps,
// HeapAlgorithm is an explicit heap algorithm type to be used with Algorithm
// - CH algorithms use CH heap
// - CoreCH algorithms use CH heap
// - MLD algorithms use MLD heap
using HeapAlgorithm = typename std::conditional<
std::is_same<Algorithm, routing_algorithms::corech::Algorithm>::value,
routing_algorithms::ch::Algorithm,
Algorithm>::type;
RoutingAlgorithms(SearchEngineData<HeapAlgorithm> &heaps,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade)
: heaps(heaps), facade(facade)
{
@@ -122,7 +131,8 @@ template <typename Algorithm> class RoutingAlgorithms final : public RoutingAlgo
}
private:
SearchEngineData<Algorithm> &heaps;
SearchEngineData<HeapAlgorithm> &heaps;
// Owned by shared-ptr passed to the query
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade;
};
@@ -21,11 +21,15 @@ namespace routing_algorithms
/// by the previous route.
/// This variation is only an optimazation for graphs with slow queries, for example
/// not fully contracted graphs.
template <typename Algorithm>
InternalRouteResult
directShortestPathSearch(SearchEngineData<Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
const PhantomNodes &phantom_nodes);
InternalRouteResult directShortestPathSearch(
SearchEngineData<ch::Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<ch::Algorithm> &facade,
const PhantomNodes &phantom_nodes);
InternalRouteResult directShortestPathSearch(
SearchEngineData<ch::Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<corech::Algorithm> &facade,
const PhantomNodes &phantom_nodes);
InternalRouteResult directShortestPathSearch(
SearchEngineData<mld::Algorithm> &engine_working_data,
@@ -22,8 +22,8 @@ static const constexpr double DEFAULT_GPS_PRECISION = 5;
//[1] "Hidden Markov Map Matching Through Noise and Sparseness";
// P. Newson and J. Krumm; 2009; ACM GIS
template <typename Algorithm>
SubMatchingList mapMatching(SearchEngineData<Algorithm> &engine_working_data,
template <typename Algorithm, typename SearchEngineData>
SubMatchingList mapMatching(SearchEngineData &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
const CandidateLists &candidates_list,
const std::vector<util::Coordinate> &trace_coordinates,
@@ -388,8 +388,8 @@ namespace corech
// a force loop, if the heaps have been initialized with positive offsets.
void search(SearchEngineData<Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<corech::Algorithm> &facade,
SearchEngineData<Algorithm>::QueryHeap &forward_heap,
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
SearchEngineData<ch::Algorithm>::QueryHeap &forward_heap,
SearchEngineData<ch::Algorithm>::QueryHeap &reverse_heap,
int &weight,
std::vector<NodeID> &packed_leg,
const bool force_loop_forward,
@@ -403,8 +403,8 @@ void search(SearchEngineData<Algorithm> &engine_working_data,
double
getNetworkDistance(SearchEngineData<Algorithm> &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<corech::Algorithm> &facade,
SearchEngineData<Algorithm>::QueryHeap &forward_heap,
SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
SearchEngineData<ch::Algorithm>::QueryHeap &forward_heap,
SearchEngineData<ch::Algorithm>::QueryHeap &reverse_heap,
const PhantomNode &source_phantom,
const PhantomNode &target_phantom,
int duration_upper_bound = INVALID_EDGE_WEIGHT);
@@ -13,9 +13,9 @@ namespace engine
namespace routing_algorithms
{
template <typename Algorithm>
template <typename Algorithm, typename SearchEngineData>
InternalRouteResult
shortestPathSearch(SearchEngineData<Algorithm> &engine_working_data,
shortestPathSearch(SearchEngineData &engine_working_data,
const datafacade::ContiguousInternalMemoryDataFacade<Algorithm> &facade,
const std::vector<PhantomNodes> &phantom_nodes_vector,
const boost::optional<bool> continue_straight_at_waypoint);