Port OSRM, Engine and Datafacades to be algorithm aware
This commit is contained in:
committed by
Patrick Niklaus
parent
71e95c92b6
commit
2fa8d0f534
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "engine/api/match_parameters.hpp"
|
||||
#include "engine/plugins/plugin_base.hpp"
|
||||
#include "engine/routing_algorithms.hpp"
|
||||
|
||||
#include "engine/map_matching/bayes_classifier.hpp"
|
||||
#include "engine/routing_algorithms/map_matching.hpp"
|
||||
@@ -24,23 +25,19 @@ class MatchPlugin : public BasePlugin
|
||||
using SubMatching = map_matching::SubMatching;
|
||||
using SubMatchingList = routing_algorithms::SubMatchingList;
|
||||
using CandidateLists = routing_algorithms::CandidateLists;
|
||||
static const constexpr double DEFAULT_GPS_PRECISION = 5;
|
||||
static const constexpr double RADIUS_MULTIPLIER = 3;
|
||||
|
||||
MatchPlugin(const int max_locations_map_matching)
|
||||
: map_matching(heaps, DEFAULT_GPS_PRECISION), shortest_path(heaps),
|
||||
max_locations_map_matching(max_locations_map_matching)
|
||||
: max_locations_map_matching(max_locations_map_matching)
|
||||
{
|
||||
}
|
||||
|
||||
Status HandleRequest(const std::shared_ptr<const datafacade::BaseDataFacade> facade,
|
||||
Status HandleRequest(const datafacade::ContiguousInternalMemoryDataFacadeBase &facade,
|
||||
const RoutingAlgorithmsInterface &algorithms,
|
||||
const api::MatchParameters ¶meters,
|
||||
util::json::Object &json_result) const;
|
||||
|
||||
private:
|
||||
mutable SearchEngineData heaps;
|
||||
mutable routing_algorithms::MapMatching map_matching;
|
||||
mutable routing_algorithms::ShortestPathRouting shortest_path;
|
||||
const int max_locations_map_matching;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
#define NEAREST_HPP
|
||||
|
||||
#include "engine/api/nearest_parameters.hpp"
|
||||
#include "engine/datafacade/contiguous_internalmem_datafacade.hpp"
|
||||
#include "engine/plugins/plugin_base.hpp"
|
||||
#include "engine/routing_algorithms.hpp"
|
||||
#include "osrm/json_container.hpp"
|
||||
|
||||
namespace osrm
|
||||
@@ -17,7 +19,8 @@ class NearestPlugin final : public BasePlugin
|
||||
public:
|
||||
explicit NearestPlugin(const int max_results);
|
||||
|
||||
Status HandleRequest(const std::shared_ptr<const datafacade::BaseDataFacade> facade,
|
||||
Status HandleRequest(const datafacade::ContiguousInternalMemoryDataFacadeBase &facade,
|
||||
const RoutingAlgorithmsInterface &algorithms,
|
||||
const api::NearestParameters ¶ms,
|
||||
util::json::Object &result) const;
|
||||
|
||||
|
||||
@@ -273,14 +273,15 @@ class BasePlugin
|
||||
}
|
||||
|
||||
// we didn't find a fitting node, return error
|
||||
if (!phantom_node_pairs[i].first.IsValid(facade.GetNumberOfNodes()))
|
||||
if (!phantom_node_pairs[i].first.IsValid())
|
||||
{
|
||||
// TODO document why?
|
||||
// This ensures the list of phantom nodes only consists of valid nodes.
|
||||
// We can use this on the call-site to detect an error.
|
||||
phantom_node_pairs.pop_back();
|
||||
break;
|
||||
}
|
||||
BOOST_ASSERT(phantom_node_pairs[i].first.IsValid(facade.GetNumberOfNodes()));
|
||||
BOOST_ASSERT(phantom_node_pairs[i].second.IsValid(facade.GetNumberOfNodes()));
|
||||
BOOST_ASSERT(phantom_node_pairs[i].first.IsValid());
|
||||
BOOST_ASSERT(phantom_node_pairs[i].second.IsValid());
|
||||
}
|
||||
return phantom_node_pairs;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "engine/plugins/plugin_base.hpp"
|
||||
|
||||
#include "engine/api/table_parameters.hpp"
|
||||
#include "engine/routing_algorithms.hpp"
|
||||
#include "engine/routing_algorithms/many_to_many.hpp"
|
||||
#include "engine/search_engine_data.hpp"
|
||||
#include "util/json_container.hpp"
|
||||
@@ -20,13 +21,12 @@ class TablePlugin final : public BasePlugin
|
||||
public:
|
||||
explicit TablePlugin(const int max_locations_distance_table);
|
||||
|
||||
Status HandleRequest(const std::shared_ptr<const datafacade::BaseDataFacade> facade,
|
||||
Status HandleRequest(const datafacade::ContiguousInternalMemoryDataFacadeBase &facade,
|
||||
const RoutingAlgorithmsInterface &algorithms,
|
||||
const api::TableParameters ¶ms,
|
||||
util::json::Object &result) const;
|
||||
|
||||
private:
|
||||
mutable SearchEngineData heaps;
|
||||
mutable routing_algorithms::ManyToManyRouting distance_table;
|
||||
const int max_locations_distance_table;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
#include "engine/api/tile_parameters.hpp"
|
||||
#include "engine/plugins/plugin_base.hpp"
|
||||
#include "engine/routing_algorithms/routing_base.hpp"
|
||||
#include "engine/routing_algorithms/shortest_path.hpp"
|
||||
#include "engine/routing_algorithms.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
/*
|
||||
* This plugin generates Mapbox Vector tiles that show the internal
|
||||
@@ -26,7 +26,8 @@ namespace plugins
|
||||
class TilePlugin final : public BasePlugin
|
||||
{
|
||||
public:
|
||||
Status HandleRequest(const std::shared_ptr<const datafacade::BaseDataFacade> facade,
|
||||
Status HandleRequest(const datafacade::ContiguousInternalMemoryDataFacadeBase &facade,
|
||||
const RoutingAlgorithmsInterface &algorithms,
|
||||
const api::TileParameters ¶meters,
|
||||
std::string &pbf_buffer) const;
|
||||
};
|
||||
|
||||
@@ -4,10 +4,9 @@
|
||||
#include "engine/plugins/plugin_base.hpp"
|
||||
|
||||
#include "engine/api/trip_parameters.hpp"
|
||||
#include "engine/routing_algorithms/many_to_many.hpp"
|
||||
#include "engine/routing_algorithms/shortest_path.hpp"
|
||||
#include "engine/routing_algorithms.hpp"
|
||||
|
||||
#include "osrm/json_container.hpp"
|
||||
#include "util/json_container.hpp"
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
@@ -29,23 +28,18 @@ namespace plugins
|
||||
class TripPlugin final : public BasePlugin
|
||||
{
|
||||
private:
|
||||
mutable SearchEngineData heaps;
|
||||
mutable routing_algorithms::ShortestPathRouting shortest_path;
|
||||
mutable routing_algorithms::ManyToManyRouting duration_table;
|
||||
const int max_locations_trip;
|
||||
|
||||
InternalRouteResult ComputeRoute(const std::shared_ptr<const datafacade::BaseDataFacade> facade,
|
||||
InternalRouteResult ComputeRoute(const RoutingAlgorithmsInterface &algorithms,
|
||||
const std::vector<PhantomNode> &phantom_node_list,
|
||||
const std::vector<NodeID> &trip,
|
||||
const bool roundtrip) const;
|
||||
|
||||
public:
|
||||
explicit TripPlugin(const int max_locations_trip_)
|
||||
: shortest_path(heaps), duration_table(heaps), max_locations_trip(max_locations_trip_)
|
||||
{
|
||||
}
|
||||
explicit TripPlugin(const int max_locations_trip_) : max_locations_trip(max_locations_trip_) {}
|
||||
|
||||
Status HandleRequest(const std::shared_ptr<const datafacade::BaseDataFacade> facade,
|
||||
Status HandleRequest(const datafacade::ContiguousInternalMemoryDataFacadeBase &facade,
|
||||
const RoutingAlgorithmsInterface &algorithms,
|
||||
const api::TripParameters ¶meters,
|
||||
util::json::Object &json_result) const;
|
||||
};
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
#ifndef VIA_ROUTE_HPP
|
||||
#define VIA_ROUTE_HPP
|
||||
|
||||
#include "engine/api/route_api.hpp"
|
||||
#include "engine/datafacade/datafacade_base.hpp"
|
||||
#include "engine/plugins/plugin_base.hpp"
|
||||
|
||||
#include "engine/routing_algorithms/alternative_path.hpp"
|
||||
#include "engine/routing_algorithms/direct_shortest_path.hpp"
|
||||
#include "engine/routing_algorithms/shortest_path.hpp"
|
||||
#include "engine/api/route_api.hpp"
|
||||
#include "engine/datafacade/datafacade_base.hpp"
|
||||
#include "engine/routing_algorithms.hpp"
|
||||
#include "engine/search_engine_data.hpp"
|
||||
#include "util/json_container.hpp"
|
||||
|
||||
@@ -28,16 +26,13 @@ namespace plugins
|
||||
class ViaRoutePlugin final : public BasePlugin
|
||||
{
|
||||
private:
|
||||
mutable SearchEngineData heaps;
|
||||
mutable routing_algorithms::ShortestPathRouting shortest_path;
|
||||
mutable routing_algorithms::AlternativeRouting alternative_path;
|
||||
mutable routing_algorithms::DirectShortestPathRouting direct_shortest_path;
|
||||
const int max_locations_viaroute;
|
||||
|
||||
public:
|
||||
explicit ViaRoutePlugin(int max_locations_viaroute);
|
||||
|
||||
Status HandleRequest(const std::shared_ptr<const datafacade::BaseDataFacade> facade,
|
||||
Status HandleRequest(const datafacade::ContiguousInternalMemoryDataFacadeBase &facade,
|
||||
const RoutingAlgorithmsInterface &algorithms,
|
||||
const api::RouteParameters &route_parameters,
|
||||
util::json::Object &json_result) const;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user