copy dummy cache over implement retrievePackedPathFromSearchSpace calculate packed_path_from_source_to_middle debugging the retrievePackedPathFromSearchSpace function implementation adding in packed_path_from_source_to_middle cache is partway working unpack path and get duration that way the computeDurationForEdge method comment out cache clean up the code move vector creation and allocation to outside of loop hack to not return vectors on facade.GetUncompressedForwardDurations and facade.GetUncompressedReverseDurations clean up hack add exclude_index to cache key clearing cache with timestamp rebase against vectors->range pr swapped out unordered_map cache with a boost_lru implementation calculation for cache size cleaned up comment about cache size calculations unit tests cache uses unsigned char for exclude index clean up cache and unit tests pass in a hashed key to the threadlocal cache 500 mb threadlocal 2 t fixes and a rebase correct calculation
124 lines
4.2 KiB
C++
124 lines
4.2 KiB
C++
#ifndef SEARCH_ENGINE_DATA_HPP
|
|
#define SEARCH_ENGINE_DATA_HPP
|
|
|
|
#include "engine/algorithm.hpp"
|
|
#include "engine/unpacking_cache.hpp"
|
|
#include "util/query_heap.hpp"
|
|
#include "util/typedefs.hpp"
|
|
|
|
#include <boost/thread/tss.hpp>
|
|
|
|
namespace osrm
|
|
{
|
|
namespace engine
|
|
{
|
|
|
|
// Algorithm-dependent heaps
|
|
// - CH algorithms use CH heaps
|
|
// - CoreCH algorithms use CH
|
|
// - MLD algorithms use MLD heaps
|
|
|
|
template <typename Algorithm> struct SearchEngineData
|
|
{
|
|
};
|
|
|
|
struct HeapData
|
|
{
|
|
NodeID parent;
|
|
/* explicit */ HeapData(NodeID p) : parent(p) {}
|
|
};
|
|
|
|
struct ManyToManyHeapData : HeapData
|
|
{
|
|
EdgeWeight duration;
|
|
ManyToManyHeapData(NodeID p, EdgeWeight duration) : HeapData(p), duration(duration) {}
|
|
};
|
|
|
|
template <> struct SearchEngineData<routing_algorithms::ch::Algorithm>
|
|
{
|
|
using QueryHeap = util::
|
|
QueryHeap<NodeID, NodeID, EdgeWeight, HeapData, util::UnorderedMapStorage<NodeID, int>>;
|
|
|
|
using ManyToManyQueryHeap = util::QueryHeap<NodeID,
|
|
NodeID,
|
|
EdgeWeight,
|
|
ManyToManyHeapData,
|
|
util::UnorderedMapStorage<NodeID, int>>;
|
|
|
|
using SearchEngineHeapPtr = boost::thread_specific_ptr<QueryHeap>;
|
|
using ManyToManyHeapPtr = boost::thread_specific_ptr<ManyToManyQueryHeap>;
|
|
using UnpackingCachePtr = boost::thread_specific_ptr<UnpackingCache>;
|
|
|
|
static SearchEngineHeapPtr forward_heap_1;
|
|
static SearchEngineHeapPtr reverse_heap_1;
|
|
static SearchEngineHeapPtr forward_heap_2;
|
|
static SearchEngineHeapPtr reverse_heap_2;
|
|
static SearchEngineHeapPtr forward_heap_3;
|
|
static SearchEngineHeapPtr reverse_heap_3;
|
|
static ManyToManyHeapPtr many_to_many_heap;
|
|
static UnpackingCachePtr unpacking_cache;
|
|
|
|
void InitializeOrClearFirstThreadLocalStorage(unsigned number_of_nodes);
|
|
|
|
void InitializeOrClearSecondThreadLocalStorage(unsigned number_of_nodes);
|
|
|
|
void InitializeOrClearThirdThreadLocalStorage(unsigned number_of_nodes);
|
|
|
|
void InitializeOrClearManyToManyThreadLocalStorage(unsigned number_of_nodes);
|
|
|
|
void InitializeOrClearUnpackingCacheThreadLocalStorage(unsigned timestamp);
|
|
};
|
|
|
|
struct MultiLayerDijkstraHeapData
|
|
{
|
|
NodeID parent;
|
|
bool from_clique_arc;
|
|
MultiLayerDijkstraHeapData(NodeID p) : parent(p), from_clique_arc(false) {}
|
|
MultiLayerDijkstraHeapData(NodeID p, bool from) : parent(p), from_clique_arc(from) {}
|
|
};
|
|
|
|
struct ManyToManyMultiLayerDijkstraHeapData : MultiLayerDijkstraHeapData
|
|
{
|
|
EdgeWeight duration;
|
|
ManyToManyMultiLayerDijkstraHeapData(NodeID p, EdgeWeight duration)
|
|
: MultiLayerDijkstraHeapData(p), duration(duration)
|
|
{
|
|
}
|
|
ManyToManyMultiLayerDijkstraHeapData(NodeID p, bool from, EdgeWeight duration)
|
|
: MultiLayerDijkstraHeapData(p, from), duration(duration)
|
|
{
|
|
}
|
|
};
|
|
|
|
template <> struct SearchEngineData<routing_algorithms::mld::Algorithm>
|
|
{
|
|
using QueryHeap = util::QueryHeap<NodeID,
|
|
NodeID,
|
|
EdgeWeight,
|
|
MultiLayerDijkstraHeapData,
|
|
util::TwoLevelStorage<NodeID, int>>;
|
|
|
|
using ManyToManyQueryHeap = util::QueryHeap<NodeID,
|
|
NodeID,
|
|
EdgeWeight,
|
|
ManyToManyMultiLayerDijkstraHeapData,
|
|
util::TwoLevelStorage<NodeID, int>>;
|
|
|
|
using SearchEngineHeapPtr = boost::thread_specific_ptr<QueryHeap>;
|
|
using ManyToManyHeapPtr = boost::thread_specific_ptr<ManyToManyQueryHeap>;
|
|
|
|
static SearchEngineHeapPtr forward_heap_1;
|
|
static SearchEngineHeapPtr reverse_heap_1;
|
|
static ManyToManyHeapPtr many_to_many_heap;
|
|
|
|
void InitializeOrClearFirstThreadLocalStorage(unsigned number_of_nodes,
|
|
unsigned number_of_boundary_nodes);
|
|
|
|
void InitializeOrClearManyToManyThreadLocalStorage(unsigned number_of_nodes,
|
|
unsigned number_of_boundary_nodes);
|
|
};
|
|
}
|
|
}
|
|
|
|
#endif // SEARCH_ENGINE_DATA_HPP
|