Add namespace around all files

This commit is contained in:
Patrick Niklaus
2016-01-05 16:51:13 +01:00
parent efc9007cbf
commit 6b18e4f7e9
194 changed files with 2648 additions and 1245 deletions
+30 -30
View File
@@ -57,7 +57,7 @@ template <typename DataFacadeT> class ApiResponseGenerator
// The output is tailored to the viaroute plugin.
void DescribeRoute(const RouteParameters &config,
const InternalRouteResult &raw_route,
osrm::json::Object &json_result);
util::json::Object &json_result);
// The following functions allow access to the different parts of the Describe Route
// functionality.
@@ -65,20 +65,20 @@ template <typename DataFacadeT> class ApiResponseGenerator
// In the normal situation, Describe Route is the desired usecase.
// generate an overview of a raw route
osrm::json::Object SummarizeRoute(const InternalRouteResult &raw_route,
util::json::Object SummarizeRoute(const InternalRouteResult &raw_route,
const Segments &segment_list) const;
// create an array containing all via-points/-indices used in the query
osrm::json::Array ListViaPoints(const InternalRouteResult &raw_route) const;
osrm::json::Array ListViaIndices(const Segments &segment_list) const;
util::json::Array ListViaPoints(const InternalRouteResult &raw_route) const;
util::json::Array ListViaIndices(const Segments &segment_list) const;
osrm::json::Value GetGeometry(const bool return_encoded, const Segments &segments) const;
util::json::Value GetGeometry(const bool return_encoded, const Segments &segments) const;
// TODO this dedicated creation seems unnecessary? Only used for route names
std::vector<Segment> BuildRouteSegments(const Segments &segment_list) const;
// adds checksum and locations
osrm::json::Object BuildHintData(const InternalRouteResult &raw_route) const;
util::json::Object BuildHintData(const InternalRouteResult &raw_route) const;
private:
// data access to translate ids back into names
@@ -94,7 +94,7 @@ ApiResponseGenerator<DataFacadeT>::ApiResponseGenerator(DataFacadeT *facade_)
template <typename DataFacadeT>
void ApiResponseGenerator<DataFacadeT>::DescribeRoute(const RouteParameters &config,
const InternalRouteResult &raw_route,
osrm::json::Object &json_result)
util::json::Object &json_result)
{
if( not raw_route.is_valid() ){
return;
@@ -129,7 +129,7 @@ void ApiResponseGenerator<DataFacadeT>::DescribeRoute(const RouteParameters &con
// Alternative Route Summaries are stored in an array to (down the line) allow multiple
// alternatives
osrm::json::Array json_alternate_route_summary_array;
util::json::Array json_alternate_route_summary_array;
json_alternate_route_summary_array.values.emplace_back(
SummarizeRoute(raw_route, alternate_segment_list));
json_result.values["alternative_summaries"] = json_alternate_route_summary_array;
@@ -139,14 +139,14 @@ void ApiResponseGenerator<DataFacadeT>::DescribeRoute(const RouteParameters &con
{
auto alternate_geometry_string =
GetGeometry(config.compression, alternate_segment_list);
osrm::json::Array json_alternate_geometries_array;
util::json::Array json_alternate_geometries_array;
json_alternate_geometries_array.values.emplace_back(std::move(alternate_geometry_string));
json_result.values["alternative_geometries"] = json_alternate_geometries_array;
}
if (config.print_instructions)
{
osrm::json::Array json_alternate_annotations_array;
util::json::Array json_alternate_annotations_array;
json_alternate_annotations_array.values.emplace_back(
guidance::AnnotateRoute(alternate_segment_list.Get(), facade));
json_result.values["alternative_instructions"] = json_alternate_annotations_array;
@@ -157,24 +157,24 @@ void ApiResponseGenerator<DataFacadeT>::DescribeRoute(const RouteParameters &con
auto alternate_segments = BuildRouteSegments(alternate_segment_list);
route_names = generate_route_names(path_segments, alternate_segments, facade);
osrm::json::Array json_alternate_names_array;
osrm::json::Array json_alternate_names;
util::json::Array json_alternate_names_array;
util::json::Array json_alternate_names;
json_alternate_names.values.push_back(route_names.alternative_path_name_1);
json_alternate_names.values.push_back(route_names.alternative_path_name_2);
json_alternate_names_array.values.emplace_back(std::move(json_alternate_names));
json_result.values["alternative_names"] = json_alternate_names_array;
json_result.values["found_alternative"] = osrm::json::True();
json_result.values["found_alternative"] = util::json::True();
}
else
{
json_result.values["found_alternative"] = osrm::json::False();
json_result.values["found_alternative"] = util::json::False();
// generate names for the main route on its own
auto path_segments = BuildRouteSegments(segment_list);
std::vector<detail::Segment> alternate_segments;
route_names = generate_route_names(path_segments, alternate_segments, facade);
}
osrm::json::Array json_route_names;
util::json::Array json_route_names;
json_route_names.values.push_back(route_names.shortest_path_name_1);
json_route_names.values.push_back(route_names.shortest_path_name_2);
json_result.values["route_name"] = json_route_names;
@@ -183,11 +183,11 @@ void ApiResponseGenerator<DataFacadeT>::DescribeRoute(const RouteParameters &con
}
template <typename DataFacadeT>
osrm::json::Object
util::json::Object
ApiResponseGenerator<DataFacadeT>::SummarizeRoute(const InternalRouteResult &raw_route,
const Segments &segment_list) const
{
osrm::json::Object json_route_summary;
util::json::Object json_route_summary;
if (not raw_route.segment_end_coordinates.empty())
{
const auto start_name_id = raw_route.segment_end_coordinates.front().source_phantom.name_id;
@@ -201,11 +201,11 @@ ApiResponseGenerator<DataFacadeT>::SummarizeRoute(const InternalRouteResult &raw
}
template <typename DataFacadeT>
osrm::json::Array
util::json::Array
ApiResponseGenerator<DataFacadeT>::ListViaPoints(const InternalRouteResult &raw_route) const
{
osrm::json::Array json_via_points_array;
osrm::json::Array json_first_coordinate;
util::json::Array json_via_points_array;
util::json::Array json_first_coordinate;
json_first_coordinate.values.emplace_back(
raw_route.segment_end_coordinates.front().source_phantom.location.lat /
COORDINATE_PRECISION);
@@ -216,7 +216,7 @@ ApiResponseGenerator<DataFacadeT>::ListViaPoints(const InternalRouteResult &raw_
for (const PhantomNodes &nodes : raw_route.segment_end_coordinates)
{
std::string tmp;
osrm::json::Array json_coordinate;
util::json::Array json_coordinate;
json_coordinate.values.emplace_back(nodes.target_phantom.location.lat / COORDINATE_PRECISION);
json_coordinate.values.emplace_back(nodes.target_phantom.location.lon / COORDINATE_PRECISION);
json_via_points_array.values.emplace_back(std::move(json_coordinate));
@@ -225,17 +225,17 @@ ApiResponseGenerator<DataFacadeT>::ListViaPoints(const InternalRouteResult &raw_
}
template <typename DataFacadeT>
osrm::json::Array
util::json::Array
ApiResponseGenerator<DataFacadeT>::ListViaIndices(const Segments &segment_list) const
{
osrm::json::Array via_indices;
util::json::Array via_indices;
via_indices.values.insert(via_indices.values.end(), segment_list.GetViaIndices().begin(),
segment_list.GetViaIndices().end());
return via_indices;
}
template <typename DataFacadeT>
osrm::json::Value ApiResponseGenerator<DataFacadeT>::GetGeometry(const bool return_encoded, const Segments &segments) const
util::json::Value ApiResponseGenerator<DataFacadeT>::GetGeometry(const bool return_encoded, const Segments &segments) const
{
if (return_encoded)
return PolylineFormatter().printEncodedString(segments.Get());
@@ -251,8 +251,8 @@ ApiResponseGenerator<DataFacadeT>::BuildRouteSegments(const Segments &segment_li
for (const auto &segment : segment_list.Get())
{
const auto current_turn = segment.turn_instruction;
if (TurnInstructionsClass::TurnIsNecessary(current_turn) and
(TurnInstruction::EnterRoundAbout != current_turn))
if (extractor::TurnInstructionsClass::TurnIsNecessary(current_turn) and
(extractor::TurnInstruction::EnterRoundAbout != current_turn))
{
detail::Segment seg = {segment.name_id, static_cast<int32_t>(segment.length),
@@ -264,14 +264,14 @@ ApiResponseGenerator<DataFacadeT>::BuildRouteSegments(const Segments &segment_li
}
template <typename DataFacadeT>
osrm::json::Object
util::json::Object
ApiResponseGenerator<DataFacadeT>::BuildHintData(const InternalRouteResult &raw_route) const
{
osrm::json::Object json_hint_object;
util::json::Object json_hint_object;
json_hint_object.values["checksum"] = facade->GetCheckSum();
osrm::json::Array json_location_hint_array;
util::json::Array json_location_hint_array;
std::string hint;
for (const auto i : osrm::irange<std::size_t>(0, raw_route.segment_end_coordinates.size()))
for (const auto i : util::irange<std::size_t>(0, raw_route.segment_end_coordinates.size()))
{
ObjectEncoder::EncodeToBase64(raw_route.segment_end_coordinates[i].source_phantom, hint);
json_location_hint_array.values.push_back(hint);
+19 -8
View File
@@ -17,12 +17,19 @@
#include <string>
#include <boost/optional.hpp>
using EdgeRange = osrm::range<EdgeID>;
namespace osrm
{
namespace engine
{
namespace datafacade
{
using EdgeRange = util::range<EdgeID>;
template <class EdgeDataT> class BaseDataFacade
{
public:
using RTreeLeaf = EdgeBasedNode;
using RTreeLeaf = extractor::EdgeBasedNode;
using EdgeData = EdgeDataT;
BaseDataFacade() {}
virtual ~BaseDataFacade() {}
@@ -53,7 +60,7 @@ template <class EdgeDataT> class BaseDataFacade
FindEdgeIndicateIfReverse(const NodeID from, const NodeID to, bool &result) const = 0;
// node and edge information access
virtual FixedPointCoordinate GetCoordinateOfNode(const unsigned id) const = 0;
virtual util::FixedPointCoordinate GetCoordinateOfNode(const unsigned id) const = 0;
virtual bool EdgeIsCompressed(const unsigned id) const = 0;
@@ -62,24 +69,24 @@ template <class EdgeDataT> class BaseDataFacade
virtual void GetUncompressedGeometry(const unsigned id,
std::vector<unsigned> &result_nodes) const = 0;
virtual TurnInstruction GetTurnInstructionForEdgeID(const unsigned id) const = 0;
virtual extractor::TurnInstruction GetTurnInstructionForEdgeID(const unsigned id) const = 0;
virtual TravelMode GetTravelModeForEdgeID(const unsigned id) const = 0;
virtual extractor::TravelMode GetTravelModeForEdgeID(const unsigned id) const = 0;
virtual std::vector<PhantomNodeWithDistance>
NearestPhantomNodesInRange(const FixedPointCoordinate &input_coordinate,
NearestPhantomNodesInRange(const util::FixedPointCoordinate &input_coordinate,
const float max_distance,
const int bearing = 0,
const int bearing_range = 180) = 0;
virtual std::vector<PhantomNodeWithDistance>
NearestPhantomNodes(const FixedPointCoordinate &input_coordinate,
NearestPhantomNodes(const util::FixedPointCoordinate &input_coordinate,
const unsigned max_results,
const int bearing = 0,
const int bearing_range = 180) = 0;
virtual std::pair<PhantomNode, PhantomNode>
NearestPhantomNodeWithAlternativeFromBigComponent(const FixedPointCoordinate &input_coordinate,
NearestPhantomNodeWithAlternativeFromBigComponent(const util::FixedPointCoordinate &input_coordinate,
const int bearing = 0,
const int bearing_range = 180) = 0;
@@ -96,4 +103,8 @@ template <class EdgeDataT> class BaseDataFacade
virtual std::string GetTimestamp() const = 0;
};
}
}
}
#endif // DATAFACADE_BASE_HPP
@@ -22,15 +22,22 @@
#include <limits>
namespace osrm
{
namespace engine
{
namespace datafacade
{
template <class EdgeDataT> class InternalDataFacade final : public BaseDataFacade<EdgeDataT>
{
private:
using super = BaseDataFacade<EdgeDataT>;
using QueryGraph = StaticGraph<typename super::EdgeData>;
using QueryGraph = util::StaticGraph<typename super::EdgeData>;
using InputEdge = typename QueryGraph::InputEdge;
using RTreeLeaf = typename super::RTreeLeaf;
using InternalRTree = StaticRTree<RTreeLeaf, ShM<FixedPointCoordinate, false>::vector, false>;
using InternalRTree = util::StaticRTree<RTreeLeaf, util::ShM<util::FixedPointCoordinate, false>::vector, false>;
using InternalGeospatialQuery = GeospatialQuery<InternalRTree>;
InternalDataFacade() {}
@@ -40,32 +47,32 @@ template <class EdgeDataT> class InternalDataFacade final : public BaseDataFacad
std::unique_ptr<QueryGraph> m_query_graph;
std::string m_timestamp;
std::shared_ptr<ShM<FixedPointCoordinate, false>::vector> m_coordinate_list;
ShM<NodeID, false>::vector m_via_node_list;
ShM<unsigned, false>::vector m_name_ID_list;
ShM<TurnInstruction, false>::vector m_turn_instruction_list;
ShM<TravelMode, false>::vector m_travel_mode_list;
ShM<char, false>::vector m_names_char_list;
ShM<bool, false>::vector m_edge_is_compressed;
ShM<unsigned, false>::vector m_geometry_indices;
ShM<unsigned, false>::vector m_geometry_list;
ShM<bool, false>::vector m_is_core_node;
std::shared_ptr<util::ShM<util::FixedPointCoordinate, false>::vector> m_coordinate_list;
util::ShM<NodeID, false>::vector m_via_node_list;
util::ShM<unsigned, false>::vector m_name_ID_list;
util::ShM<extractor::TurnInstruction, false>::vector m_turn_instruction_list;
util::ShM<extractor::TravelMode, false>::vector m_travel_mode_list;
util::ShM<char, false>::vector m_names_char_list;
util::ShM<bool, false>::vector m_edge_is_compressed;
util::ShM<unsigned, false>::vector m_geometry_indices;
util::ShM<unsigned, false>::vector m_geometry_list;
util::ShM<bool, false>::vector m_is_core_node;
boost::thread_specific_ptr<InternalRTree> m_static_rtree;
boost::thread_specific_ptr<InternalGeospatialQuery> m_geospatial_query;
boost::filesystem::path ram_index_path;
boost::filesystem::path file_index_path;
RangeTable<16, false> m_name_table;
util::RangeTable<16, false> m_name_table;
void LoadTimestamp(const boost::filesystem::path &timestamp_path)
{
if (boost::filesystem::exists(timestamp_path))
{
SimpleLogger().Write() << "Loading Timestamp";
util::SimpleLogger().Write() << "Loading Timestamp";
boost::filesystem::ifstream timestamp_stream(timestamp_path);
if (!timestamp_stream)
{
SimpleLogger().Write(logWARNING) << timestamp_path << " not found";
util::SimpleLogger().Write(logWARNING) << timestamp_path << " not found";
}
getline(timestamp_stream, m_timestamp);
timestamp_stream.close();
@@ -82,22 +89,22 @@ template <class EdgeDataT> class InternalDataFacade final : public BaseDataFacad
void LoadGraph(const boost::filesystem::path &hsgr_path)
{
typename ShM<typename QueryGraph::NodeArrayEntry, false>::vector node_list;
typename ShM<typename QueryGraph::EdgeArrayEntry, false>::vector edge_list;
typename util::ShM<typename QueryGraph::NodeArrayEntry, false>::vector node_list;
typename util::ShM<typename QueryGraph::EdgeArrayEntry, false>::vector edge_list;
SimpleLogger().Write() << "loading graph from " << hsgr_path.string();
util::SimpleLogger().Write() << "loading graph from " << hsgr_path.string();
m_number_of_nodes = readHSGRFromStream(hsgr_path, node_list, edge_list, &m_check_sum);
BOOST_ASSERT_MSG(0 != node_list.size(), "node list empty");
// BOOST_ASSERT_MSG(0 != edge_list.size(), "edge list empty");
SimpleLogger().Write() << "loaded " << node_list.size() << " nodes and " << edge_list.size()
util::SimpleLogger().Write() << "loaded " << node_list.size() << " nodes and " << edge_list.size()
<< " edges";
m_query_graph = std::unique_ptr<QueryGraph>(new QueryGraph(node_list, edge_list));
BOOST_ASSERT_MSG(0 == node_list.size(), "node list not flushed");
BOOST_ASSERT_MSG(0 == edge_list.size(), "edge list not flushed");
SimpleLogger().Write() << "Data checksum is " << m_check_sum;
util::SimpleLogger().Write() << "Data checksum is " << m_check_sum;
}
void LoadNodeAndEdgeInformation(const boost::filesystem::path &nodes_file,
@@ -105,15 +112,15 @@ template <class EdgeDataT> class InternalDataFacade final : public BaseDataFacad
{
boost::filesystem::ifstream nodes_input_stream(nodes_file, std::ios::binary);
QueryNode current_node;
extractor::QueryNode current_node;
unsigned number_of_coordinates = 0;
nodes_input_stream.read((char *)&number_of_coordinates, sizeof(unsigned));
m_coordinate_list =
std::make_shared<std::vector<FixedPointCoordinate>>(number_of_coordinates);
std::make_shared<std::vector<util::FixedPointCoordinate>>(number_of_coordinates);
for (unsigned i = 0; i < number_of_coordinates; ++i)
{
nodes_input_stream.read((char *)&current_node, sizeof(QueryNode));
m_coordinate_list->at(i) = FixedPointCoordinate(current_node.lat, current_node.lon);
nodes_input_stream.read((char *)&current_node, sizeof(extractor::QueryNode));
m_coordinate_list->at(i) = util::FixedPointCoordinate(current_node.lat, current_node.lon);
BOOST_ASSERT((std::abs(m_coordinate_list->at(i).lat) >> 30) == 0);
BOOST_ASSERT((std::abs(m_coordinate_list->at(i).lon) >> 30) == 0);
}
@@ -130,10 +137,10 @@ template <class EdgeDataT> class InternalDataFacade final : public BaseDataFacad
unsigned compressed = 0;
OriginalEdgeData current_edge_data;
extractor::OriginalEdgeData current_edge_data;
for (unsigned i = 0; i < number_of_edges; ++i)
{
edges_input_stream.read((char *)&(current_edge_data), sizeof(OriginalEdgeData));
edges_input_stream.read((char *)&(current_edge_data), sizeof(extractor::OriginalEdgeData));
m_via_node_list[i] = current_edge_data.via_node;
m_name_ID_list[i] = current_edge_data.name_id;
m_turn_instruction_list[i] = current_edge_data.turn_instruction;
@@ -220,7 +227,7 @@ template <class EdgeDataT> class InternalDataFacade final : public BaseDataFacad
name_stream.read((char *)&m_names_char_list[0], number_of_chars * sizeof(char));
if (0 == m_names_char_list.size())
{
SimpleLogger().Write(logWARNING) << "list of street names is empty";
util::SimpleLogger().Write(logWARNING) << "list of street names is empty";
}
name_stream.close();
}
@@ -242,29 +249,29 @@ template <class EdgeDataT> class InternalDataFacade final : public BaseDataFacad
{
const auto it = server_paths.find(path);
if (it == end_it || !boost::filesystem::is_regular_file(it->second))
throw osrm::exception("no valid " + path + " file given in ini file");
throw util::exception("no valid " + path + " file given in ini file");
return it->second;
};
ram_index_path = file_for("ramindex");
file_index_path = file_for("fileindex");
SimpleLogger().Write() << "loading graph data";
util::SimpleLogger().Write() << "loading graph data";
LoadGraph(file_for("hsgrdata"));
SimpleLogger().Write() << "loading edge information";
util::SimpleLogger().Write() << "loading edge information";
LoadNodeAndEdgeInformation(file_for("nodesdata"), file_for("edgesdata"));
SimpleLogger().Write() << "loading core information";
util::SimpleLogger().Write() << "loading core information";
LoadCoreInformation(file_for("coredata"));
SimpleLogger().Write() << "loading geometries";
util::SimpleLogger().Write() << "loading geometries";
LoadGeometries(file_for("geometries"));
SimpleLogger().Write() << "loading timestamp";
util::SimpleLogger().Write() << "loading timestamp";
LoadTimestamp(file_for("timestamp"));
SimpleLogger().Write() << "loading street names";
util::SimpleLogger().Write() << "loading street names";
LoadStreetNames(file_for("namesdata"));
}
@@ -312,7 +319,7 @@ template <class EdgeDataT> class InternalDataFacade final : public BaseDataFacad
}
// node and edge information access
FixedPointCoordinate GetCoordinateOfNode(const unsigned id) const override final
util::FixedPointCoordinate GetCoordinateOfNode(const unsigned id) const override final
{
return m_coordinate_list->at(id);
};
@@ -322,18 +329,18 @@ template <class EdgeDataT> class InternalDataFacade final : public BaseDataFacad
return m_edge_is_compressed.at(id);
}
TurnInstruction GetTurnInstructionForEdgeID(const unsigned id) const override final
extractor::TurnInstruction GetTurnInstructionForEdgeID(const unsigned id) const override final
{
return m_turn_instruction_list.at(id);
}
TravelMode GetTravelModeForEdgeID(const unsigned id) const override final
extractor::TravelMode GetTravelModeForEdgeID(const unsigned id) const override final
{
return m_travel_mode_list.at(id);
}
std::vector<PhantomNodeWithDistance>
NearestPhantomNodesInRange(const FixedPointCoordinate &input_coordinate,
NearestPhantomNodesInRange(const util::FixedPointCoordinate &input_coordinate,
const float max_distance,
const int bearing = 0,
const int bearing_range = 180) override final
@@ -349,7 +356,7 @@ template <class EdgeDataT> class InternalDataFacade final : public BaseDataFacad
}
std::vector<PhantomNodeWithDistance>
NearestPhantomNodes(const FixedPointCoordinate &input_coordinate,
NearestPhantomNodes(const util::FixedPointCoordinate &input_coordinate,
const unsigned max_results,
const int bearing = 0,
const int bearing_range = 180) override final
@@ -365,7 +372,7 @@ template <class EdgeDataT> class InternalDataFacade final : public BaseDataFacad
}
std::pair<PhantomNode, PhantomNode>
NearestPhantomNodeWithAlternativeFromBigComponent(const FixedPointCoordinate &input_coordinate,
NearestPhantomNodeWithAlternativeFromBigComponent(const util::FixedPointCoordinate &input_coordinate,
const int bearing = 0,
const int bearing_range = 180) override final
{
@@ -438,4 +445,8 @@ template <class EdgeDataT> class InternalDataFacade final : public BaseDataFacad
std::string GetTimestamp() const override final { return m_timestamp; }
};
}
}
}
#endif // INTERNAL_DATAFACADE_HPP
@@ -4,6 +4,13 @@
#include <boost/interprocess/sync/named_mutex.hpp>
#include <boost/interprocess/sync/named_condition.hpp>
namespace osrm
{
namespace engine
{
namespace datafacade
{
struct SharedBarriers
{
@@ -30,4 +37,8 @@ struct SharedBarriers
int number_of_queries;
};
}
}
}
#endif // SHARED_BARRIERS_HPP
+66 -55
View File
@@ -19,19 +19,26 @@
#include <limits>
#include <memory>
namespace osrm
{
namespace engine
{
namespace datafacade
{
template <class EdgeDataT> class SharedDataFacade final : public BaseDataFacade<EdgeDataT>
{
private:
using EdgeData = EdgeDataT;
using super = BaseDataFacade<EdgeData>;
using QueryGraph = StaticGraph<EdgeData, true>;
using GraphNode = typename StaticGraph<EdgeData, true>::NodeArrayEntry;
using GraphEdge = typename StaticGraph<EdgeData, true>::EdgeArrayEntry;
using NameIndexBlock = typename RangeTable<16, true>::BlockT;
using QueryGraph = util::StaticGraph<EdgeData, true>;
using GraphNode = typename QueryGraph::NodeArrayEntry;
using GraphEdge = typename QueryGraph::EdgeArrayEntry;
using NameIndexBlock = typename util::RangeTable<16, true>::BlockT;
using InputEdge = typename QueryGraph::InputEdge;
using RTreeLeaf = typename super::RTreeLeaf;
using SharedRTree = StaticRTree<RTreeLeaf, ShM<FixedPointCoordinate, true>::vector, true>;
using SharedRTree = util::StaticRTree<RTreeLeaf, util::ShM<util::FixedPointCoordinate, true>::vector, true>;
using SharedGeospatialQuery = GeospatialQuery<SharedRTree>;
using TimeStampedRTreePair = std::pair<unsigned, std::shared_ptr<SharedRTree>>;
using RTreeNode = typename SharedRTree::TreeNode;
@@ -46,33 +53,33 @@ template <class EdgeDataT> class SharedDataFacade final : public BaseDataFacade<
unsigned m_check_sum;
std::unique_ptr<QueryGraph> m_query_graph;
std::unique_ptr<SharedMemory> m_layout_memory;
std::unique_ptr<SharedMemory> m_large_memory;
std::unique_ptr<datastore::SharedMemory> m_layout_memory;
std::unique_ptr<datastore::SharedMemory> m_large_memory;
std::string m_timestamp;
std::shared_ptr<ShM<FixedPointCoordinate, true>::vector> m_coordinate_list;
ShM<NodeID, true>::vector m_via_node_list;
ShM<unsigned, true>::vector m_name_ID_list;
ShM<TurnInstruction, true>::vector m_turn_instruction_list;
ShM<TravelMode, true>::vector m_travel_mode_list;
ShM<char, true>::vector m_names_char_list;
ShM<unsigned, true>::vector m_name_begin_indices;
ShM<bool, true>::vector m_edge_is_compressed;
ShM<unsigned, true>::vector m_geometry_indices;
ShM<unsigned, true>::vector m_geometry_list;
ShM<bool, true>::vector m_is_core_node;
std::shared_ptr<util::ShM<util::FixedPointCoordinate, true>::vector> m_coordinate_list;
util::ShM<NodeID, true>::vector m_via_node_list;
util::ShM<unsigned, true>::vector m_name_ID_list;
util::ShM<extractor::TurnInstruction, true>::vector m_turn_instruction_list;
util::ShM<extractor::TravelMode, true>::vector m_travel_mode_list;
util::ShM<char, true>::vector m_names_char_list;
util::ShM<unsigned, true>::vector m_name_begin_indices;
util::ShM<bool, true>::vector m_edge_is_compressed;
util::ShM<unsigned, true>::vector m_geometry_indices;
util::ShM<unsigned, true>::vector m_geometry_list;
util::ShM<bool, true>::vector m_is_core_node;
boost::thread_specific_ptr<std::pair<unsigned, std::shared_ptr<SharedRTree>>> m_static_rtree;
boost::thread_specific_ptr<SharedGeospatialQuery> m_geospatial_query;
boost::filesystem::path file_index_path;
std::shared_ptr<RangeTable<16, true>> m_name_table;
std::shared_ptr<util::RangeTable<16, true>> m_name_table;
void LoadChecksum()
{
m_check_sum =
*data_layout->GetBlockPtr<unsigned>(shared_memory, SharedDataLayout::HSGR_CHECKSUM);
SimpleLogger().Write() << "set checksum: " << m_check_sum;
util::SimpleLogger().Write() << "set checksum: " << m_check_sum;
}
void LoadTimestamp()
@@ -93,7 +100,7 @@ template <class EdgeDataT> class SharedDataFacade final : public BaseDataFacade<
data_layout->GetBlockPtr<RTreeNode>(shared_memory, SharedDataLayout::R_SEARCH_TREE);
m_static_rtree.reset(new TimeStampedRTreePair(
CURRENT_TIMESTAMP,
osrm::make_unique<SharedRTree>(
util::make_unique<SharedRTree>(
tree_ptr, data_layout->num_entries[SharedDataLayout::R_SEARCH_TREE],
file_index_path, m_coordinate_list)));
m_geospatial_query.reset(
@@ -108,9 +115,9 @@ template <class EdgeDataT> class SharedDataFacade final : public BaseDataFacade<
GraphEdge *graph_edges_ptr =
data_layout->GetBlockPtr<GraphEdge>(shared_memory, SharedDataLayout::GRAPH_EDGE_LIST);
typename ShM<GraphNode, true>::vector node_list(
typename util::ShM<GraphNode, true>::vector node_list(
graph_nodes_ptr, data_layout->num_entries[SharedDataLayout::GRAPH_NODE_LIST]);
typename ShM<GraphEdge, true>::vector edge_list(
typename util::ShM<GraphEdge, true>::vector edge_list(
graph_edges_ptr, data_layout->num_entries[SharedDataLayout::GRAPH_EDGE_LIST]);
m_query_graph.reset(new QueryGraph(node_list, edge_list));
}
@@ -118,27 +125,27 @@ template <class EdgeDataT> class SharedDataFacade final : public BaseDataFacade<
void LoadNodeAndEdgeInformation()
{
FixedPointCoordinate *coordinate_list_ptr = data_layout->GetBlockPtr<FixedPointCoordinate>(
util::FixedPointCoordinate *coordinate_list_ptr = data_layout->GetBlockPtr<util::FixedPointCoordinate>(
shared_memory, SharedDataLayout::COORDINATE_LIST);
m_coordinate_list = osrm::make_unique<ShM<FixedPointCoordinate, true>::vector>(
m_coordinate_list = util::make_unique<util::ShM<util::FixedPointCoordinate, true>::vector>(
coordinate_list_ptr, data_layout->num_entries[SharedDataLayout::COORDINATE_LIST]);
TravelMode *travel_mode_list_ptr =
data_layout->GetBlockPtr<TravelMode>(shared_memory, SharedDataLayout::TRAVEL_MODE);
typename ShM<TravelMode, true>::vector travel_mode_list(
extractor::TravelMode *travel_mode_list_ptr =
data_layout->GetBlockPtr<extractor::TravelMode>(shared_memory, SharedDataLayout::TRAVEL_MODE);
typename util::ShM<extractor::TravelMode, true>::vector travel_mode_list(
travel_mode_list_ptr, data_layout->num_entries[SharedDataLayout::TRAVEL_MODE]);
m_travel_mode_list.swap(travel_mode_list);
TurnInstruction *turn_instruction_list_ptr = data_layout->GetBlockPtr<TurnInstruction>(
extractor::TurnInstruction *turn_instruction_list_ptr = data_layout->GetBlockPtr<extractor::TurnInstruction>(
shared_memory, SharedDataLayout::TURN_INSTRUCTION);
typename ShM<TurnInstruction, true>::vector turn_instruction_list(
typename util::ShM<extractor::TurnInstruction, true>::vector turn_instruction_list(
turn_instruction_list_ptr,
data_layout->num_entries[SharedDataLayout::TURN_INSTRUCTION]);
m_turn_instruction_list.swap(turn_instruction_list);
unsigned *name_id_list_ptr =
data_layout->GetBlockPtr<unsigned>(shared_memory, SharedDataLayout::NAME_ID_LIST);
typename ShM<unsigned, true>::vector name_id_list(
typename util::ShM<unsigned, true>::vector name_id_list(
name_id_list_ptr, data_layout->num_entries[SharedDataLayout::NAME_ID_LIST]);
m_name_ID_list.swap(name_id_list);
}
@@ -147,7 +154,7 @@ template <class EdgeDataT> class SharedDataFacade final : public BaseDataFacade<
{
NodeID *via_node_list_ptr =
data_layout->GetBlockPtr<NodeID>(shared_memory, SharedDataLayout::VIA_NODE_LIST);
typename ShM<NodeID, true>::vector via_node_list(
typename util::ShM<NodeID, true>::vector via_node_list(
via_node_list_ptr, data_layout->num_entries[SharedDataLayout::VIA_NODE_LIST]);
m_via_node_list.swap(via_node_list);
}
@@ -158,16 +165,16 @@ template <class EdgeDataT> class SharedDataFacade final : public BaseDataFacade<
data_layout->GetBlockPtr<unsigned>(shared_memory, SharedDataLayout::NAME_OFFSETS);
NameIndexBlock *blocks_ptr =
data_layout->GetBlockPtr<NameIndexBlock>(shared_memory, SharedDataLayout::NAME_BLOCKS);
typename ShM<unsigned, true>::vector name_offsets(
typename util::ShM<unsigned, true>::vector name_offsets(
offsets_ptr, data_layout->num_entries[SharedDataLayout::NAME_OFFSETS]);
typename ShM<NameIndexBlock, true>::vector name_blocks(
typename util::ShM<NameIndexBlock, true>::vector name_blocks(
blocks_ptr, data_layout->num_entries[SharedDataLayout::NAME_BLOCKS]);
char *names_list_ptr =
data_layout->GetBlockPtr<char>(shared_memory, SharedDataLayout::NAME_CHAR_LIST);
typename ShM<char, true>::vector names_char_list(
typename util::ShM<char, true>::vector names_char_list(
names_list_ptr, data_layout->num_entries[SharedDataLayout::NAME_CHAR_LIST]);
m_name_table = osrm::make_unique<RangeTable<16, true>>(
m_name_table = util::make_unique<util::RangeTable<16, true>>(
name_offsets, name_blocks, static_cast<unsigned>(names_char_list.size()));
m_names_char_list.swap(names_char_list);
@@ -182,7 +189,7 @@ template <class EdgeDataT> class SharedDataFacade final : public BaseDataFacade<
unsigned *core_marker_ptr =
data_layout->GetBlockPtr<unsigned>(shared_memory, SharedDataLayout::CORE_MARKER);
typename ShM<bool, true>::vector is_core_node(
typename util::ShM<bool, true>::vector is_core_node(
core_marker_ptr, data_layout->num_entries[SharedDataLayout::CORE_MARKER]);
m_is_core_node.swap(is_core_node);
}
@@ -191,20 +198,20 @@ template <class EdgeDataT> class SharedDataFacade final : public BaseDataFacade<
{
unsigned *geometries_compressed_ptr = data_layout->GetBlockPtr<unsigned>(
shared_memory, SharedDataLayout::GEOMETRIES_INDICATORS);
typename ShM<bool, true>::vector edge_is_compressed(
typename util::ShM<bool, true>::vector edge_is_compressed(
geometries_compressed_ptr,
data_layout->num_entries[SharedDataLayout::GEOMETRIES_INDICATORS]);
m_edge_is_compressed.swap(edge_is_compressed);
unsigned *geometries_index_ptr =
data_layout->GetBlockPtr<unsigned>(shared_memory, SharedDataLayout::GEOMETRIES_INDEX);
typename ShM<unsigned, true>::vector geometry_begin_indices(
typename util::ShM<unsigned, true>::vector geometry_begin_indices(
geometries_index_ptr, data_layout->num_entries[SharedDataLayout::GEOMETRIES_INDEX]);
m_geometry_indices.swap(geometry_begin_indices);
unsigned *geometries_list_ptr =
data_layout->GetBlockPtr<unsigned>(shared_memory, SharedDataLayout::GEOMETRIES_LIST);
typename ShM<unsigned, true>::vector geometry_list(
typename util::ShM<unsigned, true>::vector geometry_list(
geometries_list_ptr, data_layout->num_entries[SharedDataLayout::GEOMETRIES_LIST]);
m_geometry_list.swap(geometry_list);
}
@@ -214,7 +221,7 @@ template <class EdgeDataT> class SharedDataFacade final : public BaseDataFacade<
SharedDataFacade()
{
data_timestamp_ptr = (SharedDataTimestamp *)SharedMemoryFactory::Get(
data_timestamp_ptr = (SharedDataTimestamp *)datastore::SharedMemoryFactory::Get(
CURRENT_REGIONS, sizeof(SharedDataTimestamp), false, false)
->Ptr();
CURRENT_LAYOUT = LAYOUT_NONE;
@@ -232,18 +239,18 @@ template <class EdgeDataT> class SharedDataFacade final : public BaseDataFacade<
CURRENT_TIMESTAMP != data_timestamp_ptr->timestamp)
{
// release the previous shared memory segments
SharedMemory::Remove(CURRENT_LAYOUT);
SharedMemory::Remove(CURRENT_DATA);
datastore::SharedMemory::Remove(CURRENT_LAYOUT);
datastore::SharedMemory::Remove(CURRENT_DATA);
CURRENT_LAYOUT = data_timestamp_ptr->layout;
CURRENT_DATA = data_timestamp_ptr->data;
CURRENT_TIMESTAMP = data_timestamp_ptr->timestamp;
m_layout_memory.reset(SharedMemoryFactory::Get(CURRENT_LAYOUT));
m_layout_memory.reset(datastore::SharedMemoryFactory::Get(CURRENT_LAYOUT));
data_layout = (SharedDataLayout *)(m_layout_memory->Ptr());
m_large_memory.reset(SharedMemoryFactory::Get(CURRENT_DATA));
m_large_memory.reset(datastore::SharedMemoryFactory::Get(CURRENT_DATA));
shared_memory = (char *)(m_large_memory->Ptr());
const char *file_index_ptr =
@@ -251,8 +258,8 @@ template <class EdgeDataT> class SharedDataFacade final : public BaseDataFacade<
file_index_path = boost::filesystem::path(file_index_ptr);
if (!boost::filesystem::exists(file_index_path))
{
SimpleLogger().Write(logDEBUG) << "Leaf file name " << file_index_path.string();
throw osrm::exception("Could not load leaf index file. "
util::SimpleLogger().Write(logDEBUG) << "Leaf file name " << file_index_path.string();
throw util::exception("Could not load leaf index file. "
"Is any data loaded into shared memory?");
}
@@ -267,12 +274,12 @@ template <class EdgeDataT> class SharedDataFacade final : public BaseDataFacade<
data_layout->PrintInformation();
SimpleLogger().Write() << "number of geometries: " << m_coordinate_list->size();
util::SimpleLogger().Write() << "number of geometries: " << m_coordinate_list->size();
for (unsigned i = 0; i < m_coordinate_list->size(); ++i)
{
if (!GetCoordinateOfNode(i).IsValid())
{
SimpleLogger().Write() << "coordinate " << i << " not valid";
util::SimpleLogger().Write() << "coordinate " << i << " not valid";
}
}
}
@@ -322,7 +329,7 @@ template <class EdgeDataT> class SharedDataFacade final : public BaseDataFacade<
}
// node and edge information access
FixedPointCoordinate GetCoordinateOfNode(const NodeID id) const override final
util::FixedPointCoordinate GetCoordinateOfNode(const NodeID id) const override final
{
return m_coordinate_list->at(id);
};
@@ -348,18 +355,18 @@ template <class EdgeDataT> class SharedDataFacade final : public BaseDataFacade<
return m_via_node_list.at(id);
}
TurnInstruction GetTurnInstructionForEdgeID(const unsigned id) const override final
extractor::TurnInstruction GetTurnInstructionForEdgeID(const unsigned id) const override final
{
return m_turn_instruction_list.at(id);
}
TravelMode GetTravelModeForEdgeID(const unsigned id) const override final
extractor::TravelMode GetTravelModeForEdgeID(const unsigned id) const override final
{
return m_travel_mode_list.at(id);
}
std::vector<PhantomNodeWithDistance>
NearestPhantomNodesInRange(const FixedPointCoordinate &input_coordinate,
NearestPhantomNodesInRange(const util::FixedPointCoordinate &input_coordinate,
const float max_distance,
const int bearing = 0,
const int bearing_range = 180) override final
@@ -375,7 +382,7 @@ template <class EdgeDataT> class SharedDataFacade final : public BaseDataFacade<
}
std::vector<PhantomNodeWithDistance>
NearestPhantomNodes(const FixedPointCoordinate &input_coordinate,
NearestPhantomNodes(const util::FixedPointCoordinate &input_coordinate,
const unsigned max_results,
const int bearing = 0,
const int bearing_range = 180) override final
@@ -391,7 +398,7 @@ template <class EdgeDataT> class SharedDataFacade final : public BaseDataFacade<
}
std::pair<PhantomNode, PhantomNode>
NearestPhantomNodeWithAlternativeFromBigComponent(const FixedPointCoordinate &input_coordinate,
NearestPhantomNodeWithAlternativeFromBigComponent(const util::FixedPointCoordinate &input_coordinate,
const int bearing = 0,
const int bearing_range = 180) override final
{
@@ -446,4 +453,8 @@ template <class EdgeDataT> class SharedDataFacade final : public BaseDataFacade<
std::string GetTimestamp() const override final { return m_timestamp; }
};
}
}
}
#endif // SHARED_DATAFACADE_HPP
+31 -20
View File
@@ -8,6 +8,13 @@
#include <array>
namespace osrm
{
namespace engine
{
namespace datafacade
{
namespace
{
// Added at the start and end of each block as sanity check
@@ -46,41 +53,41 @@ struct SharedDataLayout
void PrintInformation() const
{
SimpleLogger().Write(logDEBUG) << "NAME_OFFSETS "
util::SimpleLogger().Write(logDEBUG) << "NAME_OFFSETS "
<< ": " << GetBlockSize(NAME_OFFSETS);
SimpleLogger().Write(logDEBUG) << "NAME_BLOCKS "
util::SimpleLogger().Write(logDEBUG) << "NAME_BLOCKS "
<< ": " << GetBlockSize(NAME_BLOCKS);
SimpleLogger().Write(logDEBUG) << "NAME_CHAR_LIST "
util::SimpleLogger().Write(logDEBUG) << "NAME_CHAR_LIST "
<< ": " << GetBlockSize(NAME_CHAR_LIST);
SimpleLogger().Write(logDEBUG) << "NAME_ID_LIST "
util::SimpleLogger().Write(logDEBUG) << "NAME_ID_LIST "
<< ": " << GetBlockSize(NAME_ID_LIST);
SimpleLogger().Write(logDEBUG) << "VIA_NODE_LIST "
util::SimpleLogger().Write(logDEBUG) << "VIA_NODE_LIST "
<< ": " << GetBlockSize(VIA_NODE_LIST);
SimpleLogger().Write(logDEBUG) << "GRAPH_NODE_LIST "
util::SimpleLogger().Write(logDEBUG) << "GRAPH_NODE_LIST "
<< ": " << GetBlockSize(GRAPH_NODE_LIST);
SimpleLogger().Write(logDEBUG) << "GRAPH_EDGE_LIST "
util::SimpleLogger().Write(logDEBUG) << "GRAPH_EDGE_LIST "
<< ": " << GetBlockSize(GRAPH_EDGE_LIST);
SimpleLogger().Write(logDEBUG) << "COORDINATE_LIST "
util::SimpleLogger().Write(logDEBUG) << "COORDINATE_LIST "
<< ": " << GetBlockSize(COORDINATE_LIST);
SimpleLogger().Write(logDEBUG) << "TURN_INSTRUCTION "
util::SimpleLogger().Write(logDEBUG) << "TURN_INSTRUCTION "
<< ": " << GetBlockSize(TURN_INSTRUCTION);
SimpleLogger().Write(logDEBUG) << "TRAVEL_MODE "
util::SimpleLogger().Write(logDEBUG) << "TRAVEL_MODE "
<< ": " << GetBlockSize(TRAVEL_MODE);
SimpleLogger().Write(logDEBUG) << "R_SEARCH_TREE "
util::SimpleLogger().Write(logDEBUG) << "R_SEARCH_TREE "
<< ": " << GetBlockSize(R_SEARCH_TREE);
SimpleLogger().Write(logDEBUG) << "GEOMETRIES_INDEX "
util::SimpleLogger().Write(logDEBUG) << "GEOMETRIES_INDEX "
<< ": " << GetBlockSize(GEOMETRIES_INDEX);
SimpleLogger().Write(logDEBUG) << "GEOMETRIES_LIST "
util::SimpleLogger().Write(logDEBUG) << "GEOMETRIES_LIST "
<< ": " << GetBlockSize(GEOMETRIES_LIST);
SimpleLogger().Write(logDEBUG) << "GEOMETRIES_INDICATORS"
util::SimpleLogger().Write(logDEBUG) << "GEOMETRIES_INDICATORS"
<< ": " << GetBlockSize(GEOMETRIES_INDICATORS);
SimpleLogger().Write(logDEBUG) << "HSGR_CHECKSUM "
util::SimpleLogger().Write(logDEBUG) << "HSGR_CHECKSUM "
<< ": " << GetBlockSize(HSGR_CHECKSUM);
SimpleLogger().Write(logDEBUG) << "TIMESTAMP "
util::SimpleLogger().Write(logDEBUG) << "TIMESTAMP "
<< ": " << GetBlockSize(TIMESTAMP);
SimpleLogger().Write(logDEBUG) << "FILE_INDEX_PATH "
util::SimpleLogger().Write(logDEBUG) << "FILE_INDEX_PATH "
<< ": " << GetBlockSize(FILE_INDEX_PATH);
SimpleLogger().Write(logDEBUG) << "CORE_MARKER "
util::SimpleLogger().Write(logDEBUG) << "CORE_MARKER "
<< ": " << GetBlockSize(CORE_MARKER);
}
@@ -135,11 +142,11 @@ struct SharedDataLayout
bool end_canary_alive = std::equal(CANARY, CANARY + sizeof(CANARY), end_canary_ptr);
if (!start_canary_alive)
{
throw osrm::exception("Start canary of block corrupted.");
throw util::exception("Start canary of block corrupted.");
}
if (!end_canary_alive)
{
throw osrm::exception("End canary of block corrupted.");
throw util::exception("End canary of block corrupted.");
}
}
@@ -165,4 +172,8 @@ struct SharedDataTimestamp
unsigned timestamp;
};
}
}
}
#endif /* SHARED_DATA_TYPE_HPP */
+8
View File
@@ -8,6 +8,11 @@
#include <utility>
#include <vector>
namespace osrm
{
namespace engine
{
/* This class object computes the bitvector of indicating generalized input
* points according to the (Ramer-)Douglas-Peucker algorithm.
*
@@ -51,4 +56,7 @@ class DouglasPeucker
void Run(std::vector<SegmentInformation> &input_geometry, const unsigned zoom_level);
};
}
}
#endif /* DOUGLAS_PEUCKER_HPP_ */
+18 -10
View File
@@ -13,6 +13,11 @@
#include <memory>
#include <vector>
namespace osrm
{
namespace engine
{
// Implements complex queries on top of an RTree and builds PhantomNodes from it.
//
// Only holds a weak reference on the RTree!
@@ -30,7 +35,7 @@ template <typename RTreeT> class GeospatialQuery
// Returns nearest PhantomNodes in the given bearing range within max_distance.
// Does not filter by small/big component!
std::vector<PhantomNodeWithDistance>
NearestPhantomNodesInRange(const FixedPointCoordinate &input_coordinate,
NearestPhantomNodesInRange(const util::FixedPointCoordinate &input_coordinate,
const double max_distance,
const int bearing = 0,
const int bearing_range = 180)
@@ -52,7 +57,7 @@ template <typename RTreeT> class GeospatialQuery
// Returns max_results nearest PhantomNodes in the given bearing range.
// Does not filter by small/big component!
std::vector<PhantomNodeWithDistance>
NearestPhantomNodes(const FixedPointCoordinate &input_coordinate,
NearestPhantomNodes(const util::FixedPointCoordinate &input_coordinate,
const unsigned max_results,
const int bearing = 0,
const int bearing_range = 180)
@@ -73,7 +78,7 @@ template <typename RTreeT> class GeospatialQuery
// Returns the nearest phantom node. If this phantom node is not from a big component
// a second phantom node is return that is the nearest coordinate in a big component.
std::pair<PhantomNode, PhantomNode>
NearestPhantomNodeWithAlternativeFromBigComponent(const FixedPointCoordinate &input_coordinate,
NearestPhantomNodeWithAlternativeFromBigComponent(const util::FixedPointCoordinate &input_coordinate,
const int bearing = 0,
const int bearing_range = 180)
{
@@ -117,7 +122,7 @@ template <typename RTreeT> class GeospatialQuery
private:
std::vector<PhantomNodeWithDistance>
MakePhantomNodes(const FixedPointCoordinate &input_coordinate,
MakePhantomNodes(const util::FixedPointCoordinate &input_coordinate,
const std::vector<EdgeData> &results) const
{
std::vector<PhantomNodeWithDistance> distance_and_phantoms(results.size());
@@ -129,12 +134,12 @@ template <typename RTreeT> class GeospatialQuery
return distance_and_phantoms;
}
PhantomNodeWithDistance MakePhantomNode(const FixedPointCoordinate &input_coordinate,
PhantomNodeWithDistance MakePhantomNode(const util::FixedPointCoordinate &input_coordinate,
const EdgeData &data) const
{
FixedPointCoordinate point_on_segment;
util::FixedPointCoordinate point_on_segment;
double ratio;
const auto current_perpendicular_distance = coordinate_calculation::perpendicularDistance(
const auto current_perpendicular_distance = util::coordinate_calculation::perpendicularDistance(
coordinates->at(data.u), coordinates->at(data.v), input_coordinate, point_on_segment,
ratio);
@@ -159,18 +164,18 @@ template <typename RTreeT> class GeospatialQuery
const int filter_bearing_range)
{
const double forward_edge_bearing =
coordinate_calculation::bearing(coordinates->at(segment.u), coordinates->at(segment.v));
util::coordinate_calculation::bearing(coordinates->at(segment.u), coordinates->at(segment.v));
const double backward_edge_bearing = (forward_edge_bearing + 180) > 360
? (forward_edge_bearing - 180)
: (forward_edge_bearing + 180);
const bool forward_bearing_valid =
bearing::CheckInBounds(std::round(forward_edge_bearing), filter_bearing,
util::bearing::CheckInBounds(std::round(forward_edge_bearing), filter_bearing,
filter_bearing_range) &&
segment.forward_edge_based_node_id != SPECIAL_NODEID;
const bool backward_bearing_valid =
bearing::CheckInBounds(std::round(backward_edge_bearing), filter_bearing,
util::bearing::CheckInBounds(std::round(backward_edge_bearing), filter_bearing,
filter_bearing_range) &&
segment.reverse_edge_based_node_id != SPECIAL_NODEID;
return std::make_pair(forward_bearing_valid, backward_bearing_valid);
@@ -180,4 +185,7 @@ template <typename RTreeT> class GeospatialQuery
const std::shared_ptr<CoordinateList> coordinates;
};
}
}
#endif
+16 -15
View File
@@ -9,6 +9,7 @@
#include "engine/segment_information.hpp"
#include "util/integer_range.hpp"
#include "util/coordinate_calculation.hpp"
#include "util/container.hpp"
#include "extractor/turn_instructions.hpp"
#include <boost/assert.hpp>
@@ -124,7 +125,7 @@ void SegmentList<DataFacadeT>::InitRoute(const PhantomNode &node, const bool tra
const auto travel_mode =
(traversed_in_reverse ? node.backward_travel_mode : node.forward_travel_mode);
AppendSegment(node.location, PathData(0, node.name_id, TurnInstruction::HeadOn,
AppendSegment(node.location, PathData(0, node.name_id, extractor::TurnInstruction::HeadOn,
segment_duration, travel_mode));
}
@@ -142,10 +143,10 @@ void SegmentList<DataFacadeT>::AddLeg(const std::vector<PathData> &leg_data,
const EdgeWeight segment_duration =
(traversed_in_reverse ? target_node.reverse_weight : target_node.forward_weight);
const TravelMode travel_mode =
const extractor::TravelMode travel_mode =
(traversed_in_reverse ? target_node.backward_travel_mode : target_node.forward_travel_mode);
segments.emplace_back(target_node.location, target_node.name_id, segment_duration, 0.f,
is_via_leg ? TurnInstruction::ReachViaLocation : TurnInstruction::NoTurn,
is_via_leg ? extractor::TurnInstruction::ReachViaLocation : extractor::TurnInstruction::NoTurn,
true, true, travel_mode);
}
@@ -187,12 +188,12 @@ void SegmentList<DataFacadeT>::AppendSegment(const FixedPointCoordinate &coordin
}
// make sure mode changes are announced, even when there otherwise is no turn
const auto getTurn = [](const PathData &path_point, const TravelMode previous_mode)
const auto getTurn = [](const PathData &path_point, const extractor::TravelMode previous_mode)
{
if (TurnInstruction::NoTurn == path_point.turn_instruction and
if (extractor::TurnInstruction::NoTurn == path_point.turn_instruction and
previous_mode != path_point.travel_mode and path_point.segment_duration > 0)
{
return TurnInstruction::GoStraight;
return extractor::TurnInstruction::GoStraight;
}
return path_point.turn_instruction;
};
@@ -215,11 +216,11 @@ void SegmentList<DataFacadeT>::Finalize(const bool extract_alternative,
return;
segments[0].length = 0.f;
for (const auto i : osrm::irange<std::size_t>(1, segments.size()))
for (const auto i : util::irange<std::size_t>(1, segments.size()))
{
// move down names by one, q&d hack
segments[i - 1].name_id = segments[i].name_id;
segments[i].length = coordinate_calculation::greatCircleDistance(segments[i - 1].location,
segments[i].length = util::coordinate_calculation::greatCircleDistance(segments[i - 1].location,
segments[i].location);
}
@@ -229,7 +230,7 @@ void SegmentList<DataFacadeT>::Finalize(const bool extract_alternative,
double path_length = 0;
for (const auto i : osrm::irange<std::size_t>(1, segments.size()))
for (const auto i : util::irange<std::size_t>(1, segments.size()))
{
path_length += segments[i].length;
segment_length += segments[i].length;
@@ -237,7 +238,7 @@ void SegmentList<DataFacadeT>::Finalize(const bool extract_alternative,
segments[segment_start_index].length = segment_length;
segments[segment_start_index].duration = segment_duration;
if (TurnInstruction::NoTurn != segments[i].turn_instruction)
if (extractor::TurnInstruction::NoTurn != segments[i].turn_instruction)
{
BOOST_ASSERT(segments[i].necessary);
segment_length = 0;
@@ -257,14 +258,14 @@ void SegmentList<DataFacadeT>::Finalize(const bool extract_alternative,
{
segments.pop_back();
segments.back().necessary = true;
segments.back().turn_instruction = TurnInstruction::NoTurn;
segments.back().turn_instruction = extractor::TurnInstruction::NoTurn;
}
if (segments.size() > 2 && std::numeric_limits<float>::epsilon() > segments.front().length &&
!(segments.begin() + 1)->is_via_location)
{
segments.erase(segments.begin());
segments.front().turn_instruction = TurnInstruction::HeadOn;
segments.front().turn_instruction = extractor::TurnInstruction::HeadOn;
segments.front().necessary = true;
}
@@ -287,9 +288,9 @@ void SegmentList<DataFacadeT>::Finalize(const bool extract_alternative,
via_indices.push_back(necessary_segments);
const double post_turn_bearing =
coordinate_calculation::bearing(first.location, second.location);
util::coordinate_calculation::bearing(first.location, second.location);
const double pre_turn_bearing =
coordinate_calculation::bearing(second.location, first.location);
util::coordinate_calculation::bearing(second.location, first.location);
first.post_turn_bearing = static_cast<short>(post_turn_bearing * 10);
first.pre_turn_bearing = static_cast<short>(pre_turn_bearing * 10);
@@ -297,7 +298,7 @@ void SegmentList<DataFacadeT>::Finalize(const bool extract_alternative,
};
// calculate which segments are necessary and update segments for bearings
osrm::for_each_pair(segments, markNecessarySegments);
util::for_each_pair(segments, markNecessarySegments);
via_indices.push_back(necessary_segments);
BOOST_ASSERT(via_indices.size() >= 2);
@@ -22,10 +22,10 @@ namespace engine
namespace guidance
{
template< typename DataFacadeT >
inline osrm::json::Array
inline util::json::Array
AnnotateRoute(const std::vector<SegmentInformation> &route_segments, DataFacadeT* facade)
{
osrm::json::Array json_instruction_array;
util::json::Array json_instruction_array;
if( route_segments.empty() )
return json_instruction_array;
// Segment information has following format:
@@ -45,11 +45,11 @@ AnnotateRoute(const std::vector<SegmentInformation> &route_segments, DataFacadeT
//Generate annotations for every segment
for (const SegmentInformation &segment : route_segments)
{
osrm::json::Array json_instruction_row;
TurnInstruction current_instruction = segment.turn_instruction;
if (TurnInstructionsClass::TurnIsNecessary(current_instruction))
util::json::Array json_instruction_row;
extractor::TurnInstruction current_instruction = segment.turn_instruction;
if (extractor::TurnInstructionsClass::TurnIsNecessary(current_instruction))
{
if (TurnInstruction::EnterRoundAbout == current_instruction)
if (extractor::TurnInstruction::EnterRoundAbout == current_instruction)
{
round_about.name_id = segment.name_id;
round_about.start_index = necessary_segments_running_index;
@@ -57,10 +57,10 @@ AnnotateRoute(const std::vector<SegmentInformation> &route_segments, DataFacadeT
else
{
std::string current_turn_instruction;
if (TurnInstruction::LeaveRoundAbout == current_instruction)
if (extractor::TurnInstruction::LeaveRoundAbout == current_instruction)
{
temp_instruction =
std::to_string(cast::enum_to_underlying(TurnInstruction::EnterRoundAbout));
std::to_string(util::cast::enum_to_underlying(extractor::TurnInstruction::EnterRoundAbout));
current_turn_instruction += temp_instruction;
current_turn_instruction += "-";
temp_instruction = std::to_string(round_about.leave_at_exit + 1);
@@ -70,7 +70,7 @@ AnnotateRoute(const std::vector<SegmentInformation> &route_segments, DataFacadeT
else
{
temp_instruction =
std::to_string(cast::enum_to_underlying(current_instruction));
std::to_string(util::cast::enum_to_underlying(current_instruction));
current_turn_instruction += temp_instruction;
}
json_instruction_row.values.emplace_back(std::move(current_turn_instruction));
@@ -84,7 +84,7 @@ AnnotateRoute(const std::vector<SegmentInformation> &route_segments, DataFacadeT
// post turn bearing
const double post_turn_bearing_value = (segment.post_turn_bearing / 10.);
json_instruction_row.values.push_back(bearing::get(post_turn_bearing_value));
json_instruction_row.values.push_back(util::bearing::get(post_turn_bearing_value));
json_instruction_row.values.push_back(
static_cast<std::uint32_t>(std::round(post_turn_bearing_value)));
@@ -92,14 +92,14 @@ AnnotateRoute(const std::vector<SegmentInformation> &route_segments, DataFacadeT
// pre turn bearing
const double pre_turn_bearing_value = (segment.pre_turn_bearing / 10.);
json_instruction_row.values.push_back(bearing::get(pre_turn_bearing_value));
json_instruction_row.values.push_back(util::bearing::get(pre_turn_bearing_value));
json_instruction_row.values.push_back(
static_cast<std::uint32_t>(std::round(pre_turn_bearing_value)));
json_instruction_array.values.push_back(json_instruction_row);
}
}
else if (TurnInstruction::StayOnRoundAbout == current_instruction)
else if (extractor::TurnInstruction::StayOnRoundAbout == current_instruction)
{
++round_about.leave_at_exit;
}
@@ -109,18 +109,18 @@ AnnotateRoute(const std::vector<SegmentInformation> &route_segments, DataFacadeT
}
}
osrm::json::Array json_last_instruction_row;
util::json::Array json_last_instruction_row;
temp_instruction =
std::to_string(cast::enum_to_underlying(TurnInstruction::ReachedYourDestination));
std::to_string(util::cast::enum_to_underlying(extractor::TurnInstruction::ReachedYourDestination));
json_last_instruction_row.values.emplace_back( std::move(temp_instruction));
json_last_instruction_row.values.push_back("");
json_last_instruction_row.values.push_back(0);
json_last_instruction_row.values.push_back(necessary_segments_running_index - 1);
json_last_instruction_row.values.push_back(0);
json_last_instruction_row.values.push_back("0m");
json_last_instruction_row.values.push_back(bearing::get(0.0));
json_last_instruction_row.values.push_back(util::bearing::get(0.0));
json_last_instruction_row.values.push_back(0.);
json_last_instruction_row.values.push_back(bearing::get(0.0));
json_last_instruction_row.values.push_back(util::bearing::get(0.0));
json_last_instruction_row.values.push_back(0.);
json_instruction_array.values.emplace_back(std::move(json_last_instruction_row));
+13 -5
View File
@@ -10,19 +10,24 @@
#include <vector>
namespace osrm
{
namespace engine
{
struct PathData
{
PathData()
: node(SPECIAL_NODEID), name_id(INVALID_EDGE_WEIGHT), segment_duration(INVALID_EDGE_WEIGHT),
turn_instruction(TurnInstruction::NoTurn), travel_mode(TRAVEL_MODE_INACCESSIBLE)
turn_instruction(extractor::TurnInstruction::NoTurn), travel_mode(TRAVEL_MODE_INACCESSIBLE)
{
}
PathData(NodeID node,
unsigned name_id,
TurnInstruction turn_instruction,
extractor::TurnInstruction turn_instruction,
EdgeWeight segment_duration,
TravelMode travel_mode)
extractor::TravelMode travel_mode)
: node(node), name_id(name_id), segment_duration(segment_duration),
turn_instruction(turn_instruction), travel_mode(travel_mode)
{
@@ -30,8 +35,8 @@ struct PathData
NodeID node;
unsigned name_id;
EdgeWeight segment_duration;
TurnInstruction turn_instruction;
TravelMode travel_mode : 4;
extractor::TurnInstruction turn_instruction;
extractor::TravelMode travel_mode : 4;
};
struct InternalRouteResult
@@ -61,4 +66,7 @@ struct InternalRouteResult
}
};
}
}
#endif // RAW_ROUTE_DATA_H
@@ -6,6 +6,13 @@
#include <vector>
#include <utility>
namespace osrm
{
namespace engine
{
namespace map_matching
{
struct NormalDistribution
{
NormalDistribution(const double mean, const double standard_deviation)
@@ -88,4 +95,8 @@ class BayesClassifier
double negative_apriori_probability;
};
}
}
}
#endif // BAYES_CLASSIFIER_HPP
@@ -12,14 +12,15 @@
namespace osrm
{
namespace matching
namespace engine
{
namespace map_matching
{
static const double log_2_pi = std::log(2. * M_PI);
static const double IMPOSSIBLE_LOG_PROB = -std::numeric_limits<double>::infinity();
static const double MINIMAL_LOG_PROB = std::numeric_limits<double>::lowest();
static const std::size_t INVALID_STATE = std::numeric_limits<std::size_t>::max();
} // namespace matching
} // namespace osrm
// closures to precompute log -> only simple floating point operations
struct EmissionLogProbability
@@ -33,7 +34,7 @@ struct EmissionLogProbability
double operator()(const double distance) const
{
return -0.5 * (osrm::matching::log_2_pi + (distance / sigma_z) * (distance / sigma_z)) -
return -0.5 * (log_2_pi + (distance / sigma_z) * (distance / sigma_z)) -
log_sigma_z;
}
};
@@ -70,7 +71,7 @@ template <class CandidateLists> struct HiddenMarkovModel
suspicious.resize(candidates_list.size());
pruned.resize(candidates_list.size());
breakage.resize(candidates_list.size());
for (const auto i : osrm::irange<std::size_t>(0u, candidates_list.size()))
for (const auto i : util::irange<std::size_t>(0u, candidates_list.size()))
{
const auto &num_candidates = candidates_list[i].size();
// add empty vectors
@@ -92,9 +93,9 @@ template <class CandidateLists> struct HiddenMarkovModel
BOOST_ASSERT(viterbi.size() == parents.size() && parents.size() == path_lengths.size() &&
path_lengths.size() == pruned.size() && pruned.size() == breakage.size());
for (const auto t : osrm::irange(initial_timestamp, viterbi.size()))
for (const auto t : util::irange(initial_timestamp, viterbi.size()))
{
std::fill(viterbi[t].begin(), viterbi[t].end(), osrm::matching::IMPOSSIBLE_LOG_PROB);
std::fill(viterbi[t].begin(), viterbi[t].end(), IMPOSSIBLE_LOG_PROB);
std::fill(parents[t].begin(), parents[t].end(), std::make_pair(0u, 0u));
std::fill(path_lengths[t].begin(), path_lengths[t].end(), 0);
std::fill(suspicious[t].begin(), suspicious[t].end(), true);
@@ -110,13 +111,13 @@ template <class CandidateLists> struct HiddenMarkovModel
{
BOOST_ASSERT(initial_timestamp < num_points);
for (const auto s : osrm::irange<std::size_t>(0u, viterbi[initial_timestamp].size()))
for (const auto s : util::irange<std::size_t>(0u, viterbi[initial_timestamp].size()))
{
viterbi[initial_timestamp][s] =
emission_log_probability(candidates_list[initial_timestamp][s].distance);
parents[initial_timestamp][s] = std::make_pair(initial_timestamp, s);
pruned[initial_timestamp][s] =
viterbi[initial_timestamp][s] < osrm::matching::MINIMAL_LOG_PROB;
viterbi[initial_timestamp][s] < MINIMAL_LOG_PROB;
suspicious[initial_timestamp][s] = false;
breakage[initial_timestamp] =
@@ -128,7 +129,7 @@ template <class CandidateLists> struct HiddenMarkovModel
if (initial_timestamp >= num_points)
{
return osrm::matching::INVALID_STATE;
return INVALID_STATE;
}
BOOST_ASSERT(initial_timestamp > 0);
@@ -140,4 +141,8 @@ template <class CandidateLists> struct HiddenMarkovModel
}
};
}
}
}
#endif // HIDDEN_MARKOV_MODEL
+8
View File
@@ -11,6 +11,11 @@
#include <string>
#include <vector>
namespace osrm
{
namespace engine
{
struct ObjectEncoder
{
using base64_t = boost::archive::iterators::base64_from_binary<
@@ -59,4 +64,7 @@ struct ObjectEncoder
}
};
}
}
#endif /* OBJECT_ENCODER_HPP */
+29 -8
View File
@@ -1,9 +1,6 @@
#ifndef OSRM_IMPL_HPP
#define OSRM_IMPL_HPP
class BasePlugin;
struct RouteParameters;
#include "contractor/query_edge.hpp"
#include "osrm/json_container.hpp"
@@ -14,31 +11,55 @@ struct RouteParameters;
#include <unordered_map>
#include <string>
namespace osrm
{
namespace util
{
namespace json
{
struct Object;
}
}
namespace engine
{
struct RouteParameters;
namespace plugins
{
class BasePlugin;
}
namespace datafacade
{
struct SharedBarriers;
template <class EdgeDataT> class BaseDataFacade;
}
class OSRM::OSRM_impl final
{
private:
using PluginMap = std::unordered_map<std::string, std::unique_ptr<BasePlugin>>;
using PluginMap = std::unordered_map<std::string, std::unique_ptr<plugins::BasePlugin>>;
public:
OSRM_impl(LibOSRMConfig &lib_config);
OSRM_impl(const OSRM_impl &) = delete;
int RunQuery(const RouteParameters &route_parameters, osrm::json::Object &json_result);
int RunQuery(const RouteParameters &route_parameters, util::json::Object &json_result);
private:
void RegisterPlugin(BasePlugin *plugin);
void RegisterPlugin(plugins::BasePlugin *plugin);
PluginMap plugin_map;
// will only be initialized if shared memory is used
std::unique_ptr<SharedBarriers> barrier;
std::unique_ptr<datafacade::SharedBarriers> barrier;
// base class pointer to the objects
BaseDataFacade<QueryEdge::EdgeData> *query_data_facade;
datafacade::BaseDataFacade<contractor::QueryEdge::EdgeData> *query_data_facade;
// decrease number of concurrent queries
void decrease_concurrent_query_count();
// increase number of concurrent queries
void increase_concurrent_query_count();
};
}
}
#endif // OSRM_IMPL_HPP
+15 -7
View File
@@ -10,6 +10,11 @@
#include <utility>
#include <vector>
namespace osrm
{
namespace engine
{
struct PhantomNode
{
PhantomNode(NodeID forward_node_id,
@@ -22,14 +27,14 @@ struct PhantomNode
unsigned packed_geometry_id,
bool is_tiny_component,
unsigned component_id,
FixedPointCoordinate &location,
util::FixedPointCoordinate &location,
unsigned short fwd_segment_position,
TravelMode forward_travel_mode,
TravelMode backward_travel_mode);
extractor::TravelMode forward_travel_mode,
extractor::TravelMode backward_travel_mode);
PhantomNode();
template <class OtherT> PhantomNode(const OtherT &other, const FixedPointCoordinate &foot_point)
template <class OtherT> PhantomNode(const OtherT &other, const util::FixedPointCoordinate &foot_point)
{
forward_node_id = other.forward_edge_based_node_id;
reverse_node_id = other.reverse_edge_based_node_id;
@@ -70,12 +75,12 @@ struct PhantomNode
#ifndef _MSC_VER
static_assert(sizeof(ComponentType) == 4, "ComponentType needs to 4 bytes big");
#endif
FixedPointCoordinate location;
util::FixedPointCoordinate location;
unsigned short fwd_segment_position;
// note 4 bits would suffice for each,
// but the saved byte would be padding anyway
TravelMode forward_travel_mode;
TravelMode backward_travel_mode;
extractor::TravelMode forward_travel_mode;
extractor::TravelMode backward_travel_mode;
int GetForwardWeightPlusOffset() const;
@@ -133,4 +138,7 @@ inline std::ostream &operator<<(std::ostream &out, const PhantomNode &pn)
return out;
}
}
}
#endif // PHANTOM_NODES_H
+21 -10
View File
@@ -16,6 +16,13 @@
#include <string>
#include <vector>
namespace osrm
{
namespace engine
{
namespace plugins
{
template <class DataFacadeT> class DistanceTablePlugin final : public BasePlugin
{
private:
@@ -27,7 +34,7 @@ template <class DataFacadeT> class DistanceTablePlugin final : public BasePlugin
: max_locations_distance_table(max_locations_distance_table), descriptor_string("table"),
facade(facade)
{
search_engine_ptr = osrm::make_unique<SearchEngine<DataFacadeT>>(facade);
search_engine_ptr = util::make_unique<SearchEngine<DataFacadeT>>(facade);
}
virtual ~DistanceTablePlugin() {}
@@ -35,7 +42,7 @@ template <class DataFacadeT> class DistanceTablePlugin final : public BasePlugin
const std::string GetDescriptor() const override final { return descriptor_string; }
Status HandleRequest(const RouteParameters &route_parameters,
osrm::json::Object &json_result) override final
util::json::Object &json_result) override final
{
if (!check_all_coordinates(route_parameters.coordinates))
{
@@ -82,7 +89,7 @@ template <class DataFacadeT> class DistanceTablePlugin final : public BasePlugin
std::vector<PhantomNodePair> phantom_node_target_vector(number_of_destination);
auto phantom_node_source_out_iter = phantom_node_source_vector.begin();
auto phantom_node_target_out_iter = phantom_node_target_vector.begin();
for (const auto i : osrm::irange<std::size_t>(0u, route_parameters.coordinates.size()))
for (const auto i : util::irange<std::size_t>(0u, route_parameters.coordinates.size()))
{
if (checksum_OK && i < route_parameters.hints.size() &&
!route_parameters.hints[i].empty())
@@ -176,10 +183,10 @@ template <class DataFacadeT> class DistanceTablePlugin final : public BasePlugin
return Status::EmptyResult;
}
osrm::json::Array matrix_json_array;
for (const auto row : osrm::irange<std::size_t>(0, number_of_sources))
util::json::Array matrix_json_array;
for (const auto row : util::irange<std::size_t>(0, number_of_sources))
{
osrm::json::Array json_row;
util::json::Array json_row;
auto row_begin_iterator = result_table->begin() + (row * number_of_destination);
auto row_end_iterator = result_table->begin() + ((row + 1) * number_of_destination);
json_row.values.insert(json_row.values.end(), row_begin_iterator, row_end_iterator);
@@ -187,19 +194,19 @@ template <class DataFacadeT> class DistanceTablePlugin final : public BasePlugin
}
json_result.values["distance_table"] = matrix_json_array;
osrm::json::Array target_coord_json_array;
util::json::Array target_coord_json_array;
for (const auto &phantom : snapped_target_phantoms)
{
osrm::json::Array json_coord;
util::json::Array json_coord;
json_coord.values.push_back(phantom.location.lat / COORDINATE_PRECISION);
json_coord.values.push_back(phantom.location.lon / COORDINATE_PRECISION);
target_coord_json_array.values.push_back(json_coord);
}
json_result.values["destination_coordinates"] = target_coord_json_array;
osrm::json::Array source_coord_json_array;
util::json::Array source_coord_json_array;
for (const auto &phantom : snapped_source_phantoms)
{
osrm::json::Array json_coord;
util::json::Array json_coord;
json_coord.values.push_back(phantom.location.lat / COORDINATE_PRECISION);
json_coord.values.push_back(phantom.location.lon / COORDINATE_PRECISION);
source_coord_json_array.values.push_back(json_coord);
@@ -213,4 +220,8 @@ template <class DataFacadeT> class DistanceTablePlugin final : public BasePlugin
DataFacadeT *facade;
};
}
}
}
#endif // DISTANCE_TABLE_HPP
+17 -6
View File
@@ -7,6 +7,13 @@
#include <string>
namespace osrm
{
namespace engine
{
namespace plugins
{
class HelloWorldPlugin final : public BasePlugin
{
private:
@@ -18,7 +25,7 @@ class HelloWorldPlugin final : public BasePlugin
const std::string GetDescriptor() const override final { return descriptor_string; }
Status HandleRequest(const RouteParameters &routeParameters,
osrm::json::Object &json_result) override final
util::json::Object &json_result) override final
{
std::string temp_string;
json_result.values["title"] = "Hello World";
@@ -41,12 +48,12 @@ class HelloWorldPlugin final : public BasePlugin
temp_string = std::to_string(routeParameters.coordinates.size());
json_result.values["location_count"] = temp_string;
osrm::json::Array json_locations;
util::json::Array json_locations;
unsigned counter = 0;
for (const FixedPointCoordinate &coordinate : routeParameters.coordinates)
for (const util::FixedPointCoordinate &coordinate : routeParameters.coordinates)
{
osrm::json::Object json_location;
osrm::json::Array json_coordinates;
util::json::Object json_location;
util::json::Array json_coordinates;
json_coordinates.values.push_back(
static_cast<double>(coordinate.lat / COORDINATE_PRECISION));
@@ -59,7 +66,7 @@ class HelloWorldPlugin final : public BasePlugin
json_result.values["locations"] = json_locations;
json_result.values["hint_count"] = routeParameters.hints.size();
osrm::json::Array json_hints;
util::json::Array json_hints;
counter = 0;
for (const std::string &current_hint : routeParameters.hints)
{
@@ -74,4 +81,8 @@ class HelloWorldPlugin final : public BasePlugin
std::string descriptor_string;
};
}
}
}
#endif // HELLO_WORLD_HPP
+42 -28
View File
@@ -23,11 +23,21 @@
#include <string>
#include <vector>
namespace osrm
{
namespace engine
{
namespace plugins
{
template <class DataFacadeT> class MapMatchingPlugin : public BasePlugin
{
std::shared_ptr<SearchEngine<DataFacadeT>> search_engine_ptr;
using ClassifierT = BayesClassifier<LaplaceDistribution, LaplaceDistribution, double>;
using SubMatching = routing_algorithms::SubMatching;
using SubMatchingList = routing_algorithms::SubMatchingList;
using CandidateLists = routing_algorithms::CandidateLists;
using ClassifierT = map_matching::BayesClassifier<map_matching::LaplaceDistribution, map_matching::LaplaceDistribution, double>;
using TraceClassification = ClassifierT::ClassificationT;
public:
@@ -36,8 +46,8 @@ template <class DataFacadeT> class MapMatchingPlugin : public BasePlugin
max_locations_map_matching(max_locations_map_matching),
// the values where derived from fitting a laplace distribution
// to the values of manually classified traces
classifier(LaplaceDistribution(0.005986, 0.016646),
LaplaceDistribution(0.054385, 0.458432),
classifier(map_matching::LaplaceDistribution(0.005986, 0.016646),
map_matching::LaplaceDistribution(0.054385, 0.458432),
0.696774) // valid apriori probability
{
search_engine_ptr = std::make_shared<SearchEngine<DataFacadeT>>(facade);
@@ -65,28 +75,28 @@ template <class DataFacadeT> class MapMatchingPlugin : public BasePlugin
return label_with_confidence;
}
osrm::matching::CandidateLists getCandidates(
const std::vector<FixedPointCoordinate> &input_coords,
CandidateLists getCandidates(
const std::vector<util::FixedPointCoordinate> &input_coords,
const std::vector<std::pair<const int, const boost::optional<int>>> &input_bearings,
const double gps_precision,
std::vector<double> &sub_trace_lengths)
{
osrm::matching::CandidateLists candidates_lists;
CandidateLists candidates_lists;
// assuming the gps_precision is the standart-diviation of normal distribution that models
// GPS noise (in this model) this should give us the correct candidate with >0.95
double query_radius = 3 * gps_precision;
double last_distance =
coordinate_calculation::haversineDistance(input_coords[0], input_coords[1]);
util::coordinate_calculation::haversineDistance(input_coords[0], input_coords[1]);
sub_trace_lengths.resize(input_coords.size());
sub_trace_lengths[0] = 0;
for (const auto current_coordinate : osrm::irange<std::size_t>(0, input_coords.size()))
for (const auto current_coordinate : util::irange<std::size_t>(0, input_coords.size()))
{
bool allow_uturn = false;
if (0 < current_coordinate)
{
last_distance = coordinate_calculation::haversineDistance(
last_distance = util::coordinate_calculation::haversineDistance(
input_coords[current_coordinate - 1], input_coords[current_coordinate]);
sub_trace_lengths[current_coordinate] +=
@@ -95,7 +105,7 @@ template <class DataFacadeT> class MapMatchingPlugin : public BasePlugin
if (input_coords.size() - 1 > current_coordinate && 0 < current_coordinate)
{
double turn_angle = ComputeAngle::OfThreeFixedPointCoordinates(
double turn_angle = util::ComputeAngle::OfThreeFixedPointCoordinates(
input_coords[current_coordinate - 1], input_coords[current_coordinate],
input_coords[current_coordinate + 1]);
@@ -146,7 +156,7 @@ template <class DataFacadeT> class MapMatchingPlugin : public BasePlugin
if (!allow_uturn)
{
const auto compact_size = candidates.size();
for (const auto i : osrm::irange<std::size_t>(0, compact_size))
for (const auto i : util::irange<std::size_t>(0, compact_size))
{
// Split edge if it is bidirectional and append reverse direction to end of list
if (candidates[i].phantom_node.forward_node_id != SPECIAL_NODEID &&
@@ -175,24 +185,24 @@ template <class DataFacadeT> class MapMatchingPlugin : public BasePlugin
return candidates_lists;
}
osrm::json::Object submatchingToJSON(const osrm::matching::SubMatching &sub,
util::json::Object submatchingToJSON(const SubMatching &sub,
const RouteParameters &route_parameters,
const InternalRouteResult &raw_route)
{
osrm::json::Object subtrace;
util::json::Object subtrace;
if (route_parameters.classify)
{
subtrace.values["confidence"] = sub.confidence;
}
auto response_generator = osrm::engine::MakeApiResponseGenerator(facade);
auto response_generator = MakeApiResponseGenerator(facade);
subtrace.values["hint_data"] = response_generator.BuildHintData(raw_route);
if (route_parameters.geometry || route_parameters.print_instructions)
{
using SegmentList = osrm::engine::guidance::SegmentList<DataFacadeT>;
using SegmentList = guidance::SegmentList<DataFacadeT>;
//Passing false to extract_alternative extracts the route.
const constexpr bool EXTRACT_ROUTE = false;
// by passing false to segment_list, we skip the douglas peucker simplification
@@ -210,28 +220,28 @@ template <class DataFacadeT> class MapMatchingPlugin : public BasePlugin
if (route_parameters.print_instructions)
{
subtrace.values["instructions"] =
osrm::engine::guidance::AnnotateRoute<DataFacadeT>(
guidance::AnnotateRoute<DataFacadeT>(
segment_list.Get(), facade);
}
osrm::json::Object json_route_summary;
util::json::Object json_route_summary;
json_route_summary.values["total_distance"] = segment_list.GetDistance();
json_route_summary.values["total_time"] = segment_list.GetDuration();
subtrace.values["route_summary"] = json_route_summary;
}
subtrace.values["indices"] = osrm::json::make_array(sub.indices);
subtrace.values["indices"] = util::json::make_array(sub.indices);
osrm::json::Array points;
util::json::Array points;
for (const auto &node : sub.nodes)
{
points.values.emplace_back(
osrm::json::make_array(node.location.lat / COORDINATE_PRECISION,
util::json::make_array(node.location.lat / COORDINATE_PRECISION,
node.location.lon / COORDINATE_PRECISION));
}
subtrace.values["matched_points"] = points;
osrm::json::Array names;
util::json::Array names;
for (const auto &node : sub.nodes)
{
names.values.emplace_back(facade->get_name_for_id(node.name_id));
@@ -242,7 +252,7 @@ template <class DataFacadeT> class MapMatchingPlugin : public BasePlugin
}
Status HandleRequest(const RouteParameters &route_parameters,
osrm::json::Object &json_result) final override
util::json::Object &json_result) final override
{
// enforce maximum number of locations for performance reasons
if (max_locations_map_matching > 0 &&
@@ -296,16 +306,16 @@ template <class DataFacadeT> class MapMatchingPlugin : public BasePlugin
}
// setup logging if enabled
if (osrm::json::Logger::get())
osrm::json::Logger::get()->initialize("matching");
if (util::json::Logger::get())
util::json::Logger::get()->initialize("matching");
// call the actual map matching
osrm::matching::SubMatchingList sub_matchings;
SubMatchingList sub_matchings;
search_engine_ptr->map_matching(candidates_lists, input_coords, input_timestamps,
route_parameters.matching_beta,
route_parameters.gps_precision, sub_matchings);
osrm::json::Array matchings;
util::json::Array matchings;
for (auto &sub : sub_matchings)
{
// classify result
@@ -349,8 +359,8 @@ template <class DataFacadeT> class MapMatchingPlugin : public BasePlugin
matchings.values.emplace_back(submatchingToJSON(sub, route_parameters, raw_route));
}
if (osrm::json::Logger::get())
osrm::json::Logger::get()->render("matching", json_result);
if (util::json::Logger::get())
util::json::Logger::get()->render("matching", json_result);
json_result.values["matchings"] = matchings;
if (sub_matchings.empty())
@@ -370,4 +380,8 @@ template <class DataFacadeT> class MapMatchingPlugin : public BasePlugin
ClassifierT classifier;
};
}
}
}
#endif // MATCH_HPP
+17 -6
View File
@@ -8,6 +8,13 @@
#include <string>
namespace osrm
{
namespace engine
{
namespace plugins
{
/*
* This Plugin locates the nearest point on a street in the road network for a given coordinate.
*/
@@ -20,7 +27,7 @@ template <class DataFacadeT> class NearestPlugin final : public BasePlugin
const std::string GetDescriptor() const override final { return descriptor_string; }
Status HandleRequest(const RouteParameters &route_parameters,
osrm::json::Object &json_result) override final
util::json::Object &json_result) override final
{
// check number of parameters
if (route_parameters.coordinates.empty() ||
@@ -58,15 +65,15 @@ template <class DataFacadeT> class NearestPlugin final : public BasePlugin
json_result.values["status_message"] = "Found nearest edge";
if (number_of_results > 1)
{
osrm::json::Array results;
util::json::Array results;
auto vector_length = phantom_node_vector.size();
for (const auto i :
osrm::irange<std::size_t>(0, std::min(number_of_results, vector_length)))
util::irange<std::size_t>(0, std::min(number_of_results, vector_length)))
{
const auto &node = phantom_node_vector[i].phantom_node;
osrm::json::Array json_coordinate;
osrm::json::Object result;
util::json::Array json_coordinate;
util::json::Object result;
json_coordinate.values.push_back(node.location.lat / COORDINATE_PRECISION);
json_coordinate.values.push_back(node.location.lon / COORDINATE_PRECISION);
result.values["mapped coordinate"] = json_coordinate;
@@ -77,7 +84,7 @@ template <class DataFacadeT> class NearestPlugin final : public BasePlugin
}
else
{
osrm::json::Array json_coordinate;
util::json::Array json_coordinate;
json_coordinate.values.push_back(
phantom_node_vector.front().phantom_node.location.lat / COORDINATE_PRECISION);
json_coordinate.values.push_back(
@@ -95,4 +102,8 @@ template <class DataFacadeT> class NearestPlugin final : public BasePlugin
std::string descriptor_string;
};
}
}
}
#endif /* NEAREST_HPP */
+14 -3
View File
@@ -11,6 +11,13 @@
#include <string>
#include <vector>
namespace osrm
{
namespace engine
{
namespace plugins
{
class BasePlugin
{
public:
@@ -26,12 +33,12 @@ class BasePlugin
// Maybe someone can explain the pure virtual destructor thing to me (dennis)
virtual ~BasePlugin() {}
virtual const std::string GetDescriptor() const = 0;
virtual Status HandleRequest(const RouteParameters &, osrm::json::Object &) = 0;
virtual bool check_all_coordinates(const std::vector<FixedPointCoordinate> &coordinates,
virtual Status HandleRequest(const RouteParameters &, util::json::Object &) = 0;
virtual bool check_all_coordinates(const std::vector<util::FixedPointCoordinate> &coordinates,
const unsigned min = 2) const final
{
if (min > coordinates.size() || std::any_of(std::begin(coordinates), std::end(coordinates),
[](const FixedPointCoordinate &coordinate)
[](const util::FixedPointCoordinate &coordinate)
{
return !coordinate.IsValid();
}))
@@ -106,4 +113,8 @@ class BasePlugin
}
};
}
}
}
#endif /* BASE_PLUGIN_HPP */
+12 -1
View File
@@ -7,6 +7,13 @@
#include <string>
namespace osrm
{
namespace engine
{
namespace plugins
{
template <class DataFacadeT> class TimestampPlugin final : public BasePlugin
{
public:
@@ -16,7 +23,7 @@ template <class DataFacadeT> class TimestampPlugin final : public BasePlugin
}
const std::string GetDescriptor() const override final { return descriptor_string; }
Status HandleRequest(const RouteParameters &route_parameters,
osrm::json::Object &json_result) override final
util::json::Object &json_result) override final
{
(void)route_parameters; // unused
@@ -30,4 +37,8 @@ template <class DataFacadeT> class TimestampPlugin final : public BasePlugin
std::string descriptor_string;
};
}
}
}
#endif /* TIMESTAMP_PLUGIN_H */
+26 -15
View File
@@ -25,6 +25,13 @@
#include <vector>
#include <iterator>
namespace osrm
{
namespace engine
{
namespace plugins
{
template <class DataFacadeT> class RoundTripPlugin final : public BasePlugin
{
private:
@@ -37,7 +44,7 @@ template <class DataFacadeT> class RoundTripPlugin final : public BasePlugin
explicit RoundTripPlugin(DataFacadeT *facade, int max_locations_trip)
: descriptor_string("trip"), facade(facade), max_locations_trip(max_locations_trip)
{
search_engine_ptr = osrm::make_unique<SearchEngine<DataFacadeT>>(facade);
search_engine_ptr = util::make_unique<SearchEngine<DataFacadeT>>(facade);
}
const std::string GetDescriptor() const override final { return descriptor_string; }
@@ -51,7 +58,7 @@ template <class DataFacadeT> class RoundTripPlugin final : public BasePlugin
phantom_node_list.reserve(route_parameters.coordinates.size());
// find phantom nodes for all input coords
for (const auto i : osrm::irange<std::size_t>(0, route_parameters.coordinates.size()))
for (const auto i : util::irange<std::size_t>(0, route_parameters.coordinates.size()))
{
// if client hints are helpful, encode hints
if (checksum_OK && i < route_parameters.hints.size() &&
@@ -129,7 +136,7 @@ template <class DataFacadeT> class RoundTripPlugin final : public BasePlugin
// identifies and splits the graph in its strongly connected components (scc)
// and returns an SCC_Component
SCC_Component SplitUnaccessibleLocations(const std::size_t number_of_locations,
const DistTableWrapper<EdgeWeight> &result_table)
const util::DistTableWrapper<EdgeWeight> &result_table)
{
if (std::find(std::begin(result_table), std::end(result_table), INVALID_EDGE_WEIGHT) ==
@@ -142,9 +149,9 @@ template <class DataFacadeT> class RoundTripPlugin final : public BasePlugin
}
// Run TarjanSCC
auto wrapper = std::make_shared<MatrixGraphWrapper<EdgeWeight>>(result_table.GetTable(),
auto wrapper = std::make_shared<util::MatrixGraphWrapper<EdgeWeight>>(result_table.GetTable(),
number_of_locations);
auto scc = TarjanSCC<MatrixGraphWrapper<EdgeWeight>>(wrapper);
auto scc = extractor::TarjanSCC<util::MatrixGraphWrapper<EdgeWeight>>(wrapper);
scc.run();
const auto number_of_components = scc.get_number_of_components();
@@ -174,9 +181,9 @@ template <class DataFacadeT> class RoundTripPlugin final : public BasePlugin
}
void SetLocPermutationOutput(const std::vector<NodeID> &permutation,
osrm::json::Object &json_result)
util::json::Object &json_result)
{
osrm::json::Array json_permutation;
util::json::Array json_permutation;
json_permutation.values.insert(std::end(json_permutation.values), std::begin(permutation),
std::end(permutation));
json_result.values["permutation"] = json_permutation;
@@ -218,7 +225,7 @@ template <class DataFacadeT> class RoundTripPlugin final : public BasePlugin
}
Status HandleRequest(const RouteParameters &route_parameters,
osrm::json::Object &json_result) override final
util::json::Object &json_result) override final
{
if (max_locations_trip > 0 &&
(static_cast<int>(route_parameters.coordinates.size()) > max_locations_trip))
@@ -259,7 +266,7 @@ template <class DataFacadeT> class RoundTripPlugin final : public BasePlugin
const auto number_of_locations = phantom_node_list.size();
// compute the distance table of all phantom nodes
const auto result_table = DistTableWrapper<EdgeWeight>(
const auto result_table = util::DistTableWrapper<EdgeWeight>(
*search_engine_ptr->distance_table(phantom_node_list, phantom_node_list),
number_of_locations);
@@ -295,16 +302,16 @@ template <class DataFacadeT> class RoundTripPlugin final : public BasePlugin
if (component_size < BF_MAX_FEASABLE)
{
scc_route =
osrm::trip::BruteForceTrip(start, end, number_of_locations, result_table);
trip::BruteForceTrip(start, end, number_of_locations, result_table);
}
else
{
scc_route = osrm::trip::FarthestInsertionTrip(start, end, number_of_locations,
scc_route = trip::FarthestInsertionTrip(start, end, number_of_locations,
result_table);
}
// use this output if debugging of route is needed:
// SimpleLogger().Write() << "Route #" << k << ": " << [&scc_route]()
// util::SimpleLogger().Write() << "Route #" << k << ": " << [&scc_route]()
// {
// std::string s = "";
// for (auto x : scc_route)
@@ -333,13 +340,13 @@ template <class DataFacadeT> class RoundTripPlugin final : public BasePlugin
// prepare JSON output
// create a json object for every trip
osrm::json::Array trip;
util::json::Array trip;
for (std::size_t i = 0; i < route_result.size(); ++i)
{
osrm::json::Object scc_trip;
util::json::Object scc_trip;
// annotate comp_route[i] as a json trip
auto generator = osrm::engine::MakeApiResponseGenerator(facade);
auto generator = MakeApiResponseGenerator(facade);
generator.DescribeRoute(route_parameters, comp_route[i], scc_trip);
// set permutation output
@@ -360,4 +367,8 @@ template <class DataFacadeT> class RoundTripPlugin final : public BasePlugin
}
};
}
}
}
#endif // TRIP_HPP
+16 -5
View File
@@ -20,6 +20,13 @@
#include <string>
#include <vector>
namespace osrm
{
namespace engine
{
namespace plugins
{
template <class DataFacadeT> class ViaRoutePlugin final : public BasePlugin
{
private:
@@ -33,7 +40,7 @@ template <class DataFacadeT> class ViaRoutePlugin final : public BasePlugin
: descriptor_string("viaroute"), facade(facade),
max_locations_viaroute(max_locations_viaroute)
{
search_engine_ptr = osrm::make_unique<SearchEngine<DataFacadeT>>(facade);
search_engine_ptr = util::make_unique<SearchEngine<DataFacadeT>>(facade);
}
virtual ~ViaRoutePlugin() {}
@@ -41,7 +48,7 @@ template <class DataFacadeT> class ViaRoutePlugin final : public BasePlugin
const std::string GetDescriptor() const override final { return descriptor_string; }
Status HandleRequest(const RouteParameters &route_parameters,
osrm::json::Object &json_result) override final
util::json::Object &json_result) override final
{
if (max_locations_viaroute > 0 &&
(static_cast<int>(route_parameters.coordinates.size()) > max_locations_viaroute))
@@ -70,7 +77,7 @@ template <class DataFacadeT> class ViaRoutePlugin final : public BasePlugin
std::vector<PhantomNodePair> phantom_node_pair_list(route_parameters.coordinates.size());
const bool checksum_OK = (route_parameters.check_sum == facade->GetCheckSum());
for (const auto i : osrm::irange<std::size_t>(0, route_parameters.coordinates.size()))
for (const auto i : util::irange<std::size_t>(0, route_parameters.coordinates.size()))
{
if (checksum_OK && i < route_parameters.hints.size() &&
!route_parameters.hints[i].empty())
@@ -108,7 +115,7 @@ template <class DataFacadeT> class ViaRoutePlugin final : public BasePlugin
{
raw_route.segment_end_coordinates.push_back(PhantomNodes{first_node, second_node});
};
osrm::for_each_pair(snapped_phantoms, build_phantom_pairs);
util::for_each_pair(snapped_phantoms, build_phantom_pairs);
if (1 == raw_route.segment_end_coordinates.size())
{
@@ -131,7 +138,7 @@ template <class DataFacadeT> class ViaRoutePlugin final : public BasePlugin
bool no_route = INVALID_EDGE_WEIGHT == raw_route.shortest_path_length;
auto generator = osrm::engine::MakeApiResponseGenerator(facade);
auto generator = MakeApiResponseGenerator(facade);
generator.DescribeRoute(route_parameters, raw_route, json_result);
// we can only know this after the fact, different SCC ids still
@@ -160,4 +167,8 @@ template <class DataFacadeT> class ViaRoutePlugin final : public BasePlugin
}
};
}
}
}
#endif // VIA_ROUTE_HPP
+11 -3
View File
@@ -1,13 +1,18 @@
#ifndef POLYLINECOMPRESSOR_H_
#define POLYLINECOMPRESSOR_H_
struct SegmentInformation;
#include "osrm/coordinate.hpp"
#include <string>
#include <vector>
namespace osrm
{
namespace engine
{
struct SegmentInformation;
class PolylineCompressor
{
private:
@@ -18,7 +23,10 @@ class PolylineCompressor
public:
std::string get_encoded_string(const std::vector<SegmentInformation> &polyline) const;
std::vector<FixedPointCoordinate> decode_string(const std::string &geometry_string) const;
std::vector<util::FixedPointCoordinate> decode_string(const std::string &geometry_string) const;
};
}
}
#endif /* POLYLINECOMPRESSOR_H_ */
+12 -4
View File
@@ -1,18 +1,26 @@
#ifndef POLYLINE_FORMATTER_HPP
#define POLYLINE_FORMATTER_HPP
struct SegmentInformation;
#include "osrm/json_container.hpp"
#include <string>
#include <vector>
namespace osrm
{
namespace engine
{
struct SegmentInformation;
struct PolylineFormatter
{
osrm::json::String printEncodedString(const std::vector<SegmentInformation> &polyline) const;
util::json::String printEncodedString(const std::vector<SegmentInformation> &polyline) const;
osrm::json::Array printUnencodedString(const std::vector<SegmentInformation> &polyline) const;
util::json::Array printUnencodedString(const std::vector<SegmentInformation> &polyline) const;
};
}
}
#endif /* POLYLINE_FORMATTER_HPP */
+8
View File
@@ -7,6 +7,11 @@
#include <string>
#include <vector>
namespace osrm
{
namespace engine
{
struct RouteNames
{
std::string shortest_path_name_1;
@@ -135,4 +140,7 @@ template <class DataFacadeT, class SegmentT> struct ExtractRouteNames
}
};
}
}
#endif // EXTRACT_ROUTE_NAMES_H
@@ -13,6 +13,13 @@
#include <vector>
namespace osrm
{
namespace engine
{
namespace routing_algorithms
{
const double VIAPATH_ALPHA = 0.10;
const double VIAPATH_EPSILON = 0.15; // alternative at most 15% longer
const double VIAPATH_GAMMA = 0.75; // alternative shares at most 75% with the shortest.
@@ -81,7 +88,7 @@ class AlternativeRouting final
if (phantom_node_pair.source_phantom.forward_node_id != SPECIAL_NODEID)
{
// SimpleLogger().Write(logDEBUG) << "fwd-a insert: " <<
// util::SimpleLogger().Write(logDEBUG) << "fwd-a insert: " <<
// phantom_node_pair.source_phantom.forward_node_id << ", w: " <<
// -phantom_node_pair.source_phantom.GetForwardWeightPlusOffset();
forward_heap1.Insert(phantom_node_pair.source_phantom.forward_node_id,
@@ -90,7 +97,7 @@ class AlternativeRouting final
}
if (phantom_node_pair.source_phantom.reverse_node_id != SPECIAL_NODEID)
{
// SimpleLogger().Write(logDEBUG) << "fwd-b insert: " <<
// util::SimpleLogger().Write(logDEBUG) << "fwd-b insert: " <<
// phantom_node_pair.source_phantom.reverse_node_id << ", w: " <<
// -phantom_node_pair.source_phantom.GetReverseWeightPlusOffset();
forward_heap1.Insert(phantom_node_pair.source_phantom.reverse_node_id,
@@ -100,7 +107,7 @@ class AlternativeRouting final
if (phantom_node_pair.target_phantom.forward_node_id != SPECIAL_NODEID)
{
// SimpleLogger().Write(logDEBUG) << "rev-a insert: " <<
// util::SimpleLogger().Write(logDEBUG) << "rev-a insert: " <<
// phantom_node_pair.target_phantom.forward_node_id << ", w: " <<
// phantom_node_pair.target_phantom.GetForwardWeightPlusOffset();
reverse_heap1.Insert(phantom_node_pair.target_phantom.forward_node_id,
@@ -109,7 +116,7 @@ class AlternativeRouting final
}
if (phantom_node_pair.target_phantom.reverse_node_id != SPECIAL_NODEID)
{
// SimpleLogger().Write(logDEBUG) << "rev-b insert: " <<
// util::SimpleLogger().Write(logDEBUG) << "rev-b insert: " <<
// phantom_node_pair.target_phantom.reverse_node_id << ", w: " <<
// phantom_node_pair.target_phantom.GetReverseWeightPlusOffset();
reverse_heap1.Insert(phantom_node_pair.target_phantom.reverse_node_id,
@@ -141,7 +148,7 @@ class AlternativeRouting final
return;
}
osrm::sort_unique_resize(via_node_candidate_list);
util::sort_unique_resize(via_node_candidate_list);
std::vector<NodeID> packed_forward_path;
std::vector<NodeID> packed_reverse_path;
@@ -204,10 +211,10 @@ class AlternativeRouting final
}
}
// SimpleLogger().Write(logDEBUG) << "fwd_search_space size: " <<
// util::SimpleLogger().Write(logDEBUG) << "fwd_search_space size: " <<
// forward_search_space.size() << ", marked " << approximated_forward_sharing.size() << "
// nodes";
// SimpleLogger().Write(logDEBUG) << "rev_search_space size: " <<
// util::SimpleLogger().Write(logDEBUG) << "rev_search_space size: " <<
// reverse_search_space.size() << ", marked " << approximated_reverse_sharing.size() << "
// nodes";
@@ -403,7 +410,7 @@ class AlternativeRouting final
// First partially unpack s-->v until paths deviate, note length of common path.
const int64_t s_v_min_path_size =
static_cast<int64_t>(std::min(packed_s_v_path.size(), packed_shortest_path.size())) - 1;
for (const int64_t current_node : osrm::irange<int64_t>(0, s_v_min_path_size))
for (const int64_t current_node : util::irange<int64_t>(0, s_v_min_path_size))
{
if (packed_s_v_path[current_node] == packed_shortest_path[current_node] &&
packed_s_v_path[current_node + 1] == packed_shortest_path[current_node + 1])
@@ -519,7 +526,7 @@ class AlternativeRouting final
// //compute forward sharing
// while( (packed_alternate_path[aindex] == packed_shortest_path[aindex]) &&
// (packed_alternate_path[aindex+1] == packed_shortest_path[aindex+1]) ) {
// // SimpleLogger().Write() << "retrieving edge (" <<
// // util::SimpleLogger().Write() << "retrieving edge (" <<
// packed_alternate_path[aindex] << "," << packed_alternate_path[aindex+1] << ")";
// EdgeID edgeID = facade->FindEdgeInEitherDirection(packed_alternate_path[aindex],
// packed_alternate_path[aindex+1]);
@@ -557,7 +564,7 @@ class AlternativeRouting final
const NodeID node = forward_heap.DeleteMin();
const int distance = forward_heap.GetKey(node);
// const NodeID parentnode = forward_heap.GetData(node).parent;
// SimpleLogger().Write() << (is_forward_directed ? "[fwd] " : "[rev] ") << "settled edge ("
// util::SimpleLogger().Write() << (is_forward_directed ? "[fwd] " : "[rev] ") << "settled edge ("
// << parentnode << "," << node << "), dist: " << distance;
const int scaled_distance =
@@ -581,10 +588,10 @@ class AlternativeRouting final
{
*middle_node = node;
*upper_bound_to_shortest_path_distance = new_distance;
// SimpleLogger().Write() << "accepted middle_node " << *middle_node << " at
// util::SimpleLogger().Write() << "accepted middle_node " << *middle_node << " at
// distance " << new_distance;
// } else {
// SimpleLogger().Write() << "discarded middle_node " << *middle_node << "
// util::SimpleLogger().Write() << "discarded middle_node " << *middle_node << "
// at distance " << new_distance;
}
}
@@ -840,4 +847,8 @@ class AlternativeRouting final
}
};
}
}
}
#endif /* ALTERNATIVE_PATH_ROUTING_HPP */
@@ -10,6 +10,13 @@
#include "util/timing_util.hpp"
#include "util/typedefs.hpp"
namespace osrm
{
namespace engine
{
namespace routing_algorithms
{
/// This is a striped down version of the general shortest path algorithm.
/// The general algorithm always computes two queries for each leg. This is only
/// necessary in case of vias, where the directions of the start node is constrainted
@@ -125,4 +132,8 @@ class DirectShortestPathRouting final
}
};
}
}
}
#endif /* DIRECT_SHORTEST_PATH_HPP */
@@ -12,6 +12,13 @@
#include <unordered_map>
#include <vector>
namespace osrm
{
namespace engine
{
namespace routing_algorithms
{
template <class DataFacadeT>
class ManyToManyRouting final
: public BasicRoutingInterface<DataFacadeT, ManyToManyRouting<DataFacadeT>>
@@ -226,4 +233,8 @@ class ManyToManyRouting final
return false;
}
};
}
}
}
#endif
@@ -19,7 +19,9 @@
namespace osrm
{
namespace matching
namespace engine
{
namespace routing_algorithms
{
struct SubMatching
@@ -32,15 +34,12 @@ struct SubMatching
using CandidateList = std::vector<PhantomNodeWithDistance>;
using CandidateLists = std::vector<CandidateList>;
using HMM = HiddenMarkovModel<CandidateLists>;
using HMM = map_matching::HiddenMarkovModel<CandidateLists>;
using SubMatchingList = std::vector<SubMatching>;
constexpr static const unsigned MAX_BROKEN_STATES = 10;
constexpr static const double MAX_SPEED = 180 / 3.6; // 180km -> m/s
constexpr static const unsigned SUSPICIOUS_DISTANCE_DELTA = 100;
}
}
// implements a hidden markov model map matching algorithm
template <class DataFacadeT>
@@ -71,12 +70,12 @@ class MapMatching final : public BasicRoutingInterface<DataFacadeT, MapMatching<
{
}
void operator()(const osrm::matching::CandidateLists &candidates_list,
const std::vector<FixedPointCoordinate> &trace_coordinates,
void operator()(const CandidateLists &candidates_list,
const std::vector<util::FixedPointCoordinate> &trace_coordinates,
const std::vector<unsigned> &trace_timestamps,
const double matching_beta,
const double gps_precision,
osrm::matching::SubMatchingList &sub_matchings) const
SubMatchingList &sub_matchings) const
{
BOOST_ASSERT(candidates_list.size() == trace_coordinates.size());
BOOST_ASSERT(candidates_list.size() > 1);
@@ -94,12 +93,12 @@ class MapMatching final : public BasicRoutingInterface<DataFacadeT, MapMatching<
return 1u;
}
}();
const auto max_broken_time = median_sample_time * osrm::matching::MAX_BROKEN_STATES;
const auto max_broken_time = median_sample_time * MAX_BROKEN_STATES;
const auto max_distance_delta = [&]()
{
if (use_timestamps)
{
return median_sample_time * osrm::matching::MAX_SPEED;
return median_sample_time * MAX_SPEED;
}
else
{
@@ -108,18 +107,18 @@ class MapMatching final : public BasicRoutingInterface<DataFacadeT, MapMatching<
}();
// TODO replace default values with table lookup based on sampling frequency
EmissionLogProbability emission_log_probability(gps_precision);
TransitionLogProbability transition_log_probability(matching_beta);
map_matching::EmissionLogProbability emission_log_probability(gps_precision);
map_matching::TransitionLogProbability transition_log_probability(matching_beta);
osrm::matching::HMM model(candidates_list, emission_log_probability);
HMM model(candidates_list, emission_log_probability);
std::size_t initial_timestamp = model.initialize(0);
if (initial_timestamp == osrm::matching::INVALID_STATE)
if (initial_timestamp == map_matching::INVALID_STATE)
{
return;
}
MatchingDebugInfo matching_debug(osrm::json::Logger::get());
util::MatchingDebugInfo matching_debug(util::json::Logger::get());
matching_debug.initialize(candidates_list);
engine_working_data.InitializeOrClearFirstThreadLocalStorage(
@@ -128,7 +127,7 @@ class MapMatching final : public BasicRoutingInterface<DataFacadeT, MapMatching<
QueryHeap &forward_heap = *(engine_working_data.forward_heap_1);
QueryHeap &reverse_heap = *(engine_working_data.reverse_heap_1);
std::size_t breakage_begin = osrm::matching::INVALID_STATE;
std::size_t breakage_begin = map_matching::INVALID_STATE;
std::vector<std::size_t> split_points;
std::vector<std::size_t> prev_unbroken_timestamps;
prev_unbroken_timestamps.reserve(candidates_list.size());
@@ -149,16 +148,16 @@ class MapMatching final : public BasicRoutingInterface<DataFacadeT, MapMatching<
else
{
trace_split = trace_split || (t - prev_unbroken_timestamps.back() >
osrm::matching::MAX_BROKEN_STATES);
MAX_BROKEN_STATES);
}
if (trace_split)
{
std::size_t split_index = t;
if (breakage_begin != osrm::matching::INVALID_STATE)
if (breakage_begin != map_matching::INVALID_STATE)
{
split_index = breakage_begin;
breakage_begin = osrm::matching::INVALID_STATE;
breakage_begin = map_matching::INVALID_STATE;
}
split_points.push_back(split_index);
@@ -166,7 +165,7 @@ class MapMatching final : public BasicRoutingInterface<DataFacadeT, MapMatching<
model.clear(split_index);
std::size_t new_start = model.initialize(split_index);
// no new start was found -> stop viterbi calculation
if (new_start == osrm::matching::INVALID_STATE)
if (new_start == map_matching::INVALID_STATE)
{
break;
}
@@ -196,17 +195,17 @@ class MapMatching final : public BasicRoutingInterface<DataFacadeT, MapMatching<
const auto &current_coordinate = trace_coordinates[t];
const auto haversine_distance =
coordinate_calculation::haversineDistance(prev_coordinate, current_coordinate);
util::coordinate_calculation::haversineDistance(prev_coordinate, current_coordinate);
// compute d_t for this timestamp and the next one
for (const auto s : osrm::irange<std::size_t>(0u, prev_viterbi.size()))
for (const auto s : util::irange<std::size_t>(0u, prev_viterbi.size()))
{
if (prev_pruned[s])
{
continue;
}
for (const auto s_prime : osrm::irange<std::size_t>(0u, current_viterbi.size()))
for (const auto s_prime : util::irange<std::size_t>(0u, current_viterbi.size()))
{
// how likely is candidate s_prime at time t to be emitted?
// FIXME this can be pre-computed
@@ -248,7 +247,7 @@ class MapMatching final : public BasicRoutingInterface<DataFacadeT, MapMatching<
current_lengths[s_prime] = network_distance;
current_pruned[s_prime] = false;
current_suspicious[s_prime] =
d_t > osrm::matching::SUSPICIOUS_DISTANCE_DELTA;
d_t > SUSPICIOUS_DISTANCE_DELTA;
model.breakage[t] = false;
}
}
@@ -282,7 +281,7 @@ class MapMatching final : public BasicRoutingInterface<DataFacadeT, MapMatching<
std::size_t sub_matching_begin = initial_timestamp;
for (const auto sub_matching_end : split_points)
{
osrm::matching::SubMatching matching;
SubMatching matching;
std::size_t parent_timestamp_index = sub_matching_end - 1;
while (parent_timestamp_index >= sub_matching_begin &&
@@ -338,7 +337,7 @@ class MapMatching final : public BasicRoutingInterface<DataFacadeT, MapMatching<
matching.length = 0.0;
matching.nodes.resize(reconstructed_indices.size());
matching.indices.resize(reconstructed_indices.size());
for (const auto i : osrm::irange<std::size_t>(0u, reconstructed_indices.size()))
for (const auto i : util::irange<std::size_t>(0u, reconstructed_indices.size()))
{
const auto timestamp_index = reconstructed_indices[i].first;
const auto location_index = reconstructed_indices[i].second;
@@ -357,6 +356,10 @@ class MapMatching final : public BasicRoutingInterface<DataFacadeT, MapMatching<
}
};
}
}
}
//[1] "Hidden Markov Map Matching Through Noise and Sparseness"; P. Newson and J. Krumm; 2009; ACM
// GIS
@@ -10,6 +10,11 @@
#include <stack>
namespace osrm
{
namespace engine
{
SearchEngineData::SearchEngineHeapPtr SearchEngineData::forward_heap_1;
SearchEngineData::SearchEngineHeapPtr SearchEngineData::reverse_heap_1;
SearchEngineData::SearchEngineHeapPtr SearchEngineData::forward_heap_2;
@@ -17,6 +22,10 @@ SearchEngineData::SearchEngineHeapPtr SearchEngineData::reverse_heap_2;
SearchEngineData::SearchEngineHeapPtr SearchEngineData::forward_heap_3;
SearchEngineData::SearchEngineHeapPtr SearchEngineData::reverse_heap_3;
namespace routing_algorithms
{
template <class DataFacadeT, class Derived> class BasicRoutingInterface
{
private:
@@ -222,8 +231,8 @@ template <class DataFacadeT, class Derived> class BasicRoutingInterface
{
BOOST_ASSERT_MSG(!ed.shortcut, "original edge flagged as shortcut");
unsigned name_index = facade->GetNameIndexFromEdgeID(ed.id);
const TurnInstruction turn_instruction = facade->GetTurnInstructionForEdgeID(ed.id);
const TravelMode travel_mode = facade->GetTravelModeForEdgeID(ed.id);
const extractor::TurnInstruction turn_instruction = facade->GetTurnInstructionForEdgeID(ed.id);
const extractor::TravelMode travel_mode = facade->GetTravelModeForEdgeID(ed.id);
if (!facade->EdgeIsCompressed(ed.id))
{
@@ -251,7 +260,7 @@ template <class DataFacadeT, class Derived> class BasicRoutingInterface
for (std::size_t i = start_index; i < end_index; ++i)
{
unpacked_path.emplace_back(id_vector[i], name_index,
TurnInstruction::NoTurn, 0, travel_mode);
extractor::TurnInstruction::NoTurn, 0, travel_mode);
}
unpacked_path.back().turn_instruction = turn_instruction;
unpacked_path.back().segment_duration = ed.distance;
@@ -296,7 +305,7 @@ template <class DataFacadeT, class Derived> class BasicRoutingInterface
BOOST_ASSERT(i < id_vector.size());
BOOST_ASSERT(phantom_node_pair.target_phantom.forward_travel_mode > 0);
unpacked_path.emplace_back(PathData{
id_vector[i], phantom_node_pair.target_phantom.name_id, TurnInstruction::NoTurn,
id_vector[i], phantom_node_pair.target_phantom.name_id, extractor::TurnInstruction::NoTurn,
0, phantom_node_pair.target_phantom.forward_travel_mode});
}
}
@@ -642,21 +651,25 @@ template <class DataFacadeT, class Derived> class BasicRoutingInterface
nodes.target_phantom = target_phantom;
UnpackPath(packed_leg.begin(), packed_leg.end(), nodes, unpacked_path);
FixedPointCoordinate previous_coordinate = source_phantom.location;
FixedPointCoordinate current_coordinate;
util::FixedPointCoordinate previous_coordinate = source_phantom.location;
util::FixedPointCoordinate current_coordinate;
distance = 0;
for (const auto &p : unpacked_path)
{
current_coordinate = facade->GetCoordinateOfNode(p.node);
distance += coordinate_calculation::haversineDistance(previous_coordinate,
distance += util::coordinate_calculation::haversineDistance(previous_coordinate,
current_coordinate);
previous_coordinate = current_coordinate;
}
distance += coordinate_calculation::haversineDistance(previous_coordinate,
distance += util::coordinate_calculation::haversineDistance(previous_coordinate,
target_phantom.location);
}
return distance;
}
};
}
}
}
#endif // ROUTING_BASE_HPP
@@ -10,6 +10,13 @@
#include <boost/assert.hpp>
namespace osrm
{
namespace engine
{
namespace routing_algorithms
{
template <class DataFacadeT>
class ShortestPathRouting final
: public BasicRoutingInterface<DataFacadeT, ShortestPathRouting<DataFacadeT>>
@@ -262,7 +269,7 @@ class ShortestPathRouting final
raw_route_data.shortest_path_length = shortest_path_length;
for (const auto current_leg : osrm::irange<std::size_t>(0, packed_leg_begin.size() - 1))
for (const auto current_leg : util::irange<std::size_t>(0, packed_leg_begin.size() - 1))
{
auto leg_begin = total_packed_path.begin() + packed_leg_begin[current_leg];
auto leg_end = total_packed_path.begin() + packed_leg_begin[current_leg + 1];
@@ -515,4 +522,8 @@ class ShortestPathRouting final
}
};
}
}
}
#endif /* SHORTEST_PATH_HPP */
+13 -5
View File
@@ -10,6 +10,11 @@
#include <type_traits>
namespace osrm
{
namespace engine
{
template <class DataFacadeT> class SearchEngine
{
private:
@@ -17,11 +22,11 @@ template <class DataFacadeT> class SearchEngine
SearchEngineData engine_working_data;
public:
ShortestPathRouting<DataFacadeT> shortest_path;
DirectShortestPathRouting<DataFacadeT> direct_shortest_path;
AlternativeRouting<DataFacadeT> alternative_path;
ManyToManyRouting<DataFacadeT> distance_table;
MapMatching<DataFacadeT> map_matching;
routing_algorithms::ShortestPathRouting<DataFacadeT> shortest_path;
routing_algorithms::DirectShortestPathRouting<DataFacadeT> direct_shortest_path;
routing_algorithms::AlternativeRouting<DataFacadeT> alternative_path;
routing_algorithms::ManyToManyRouting<DataFacadeT> distance_table;
routing_algorithms::MapMatching<DataFacadeT> map_matching;
explicit SearchEngine(DataFacadeT *facade)
: facade(facade), shortest_path(facade, engine_working_data),
@@ -37,4 +42,7 @@ template <class DataFacadeT> class SearchEngine
~SearchEngine() {}
};
}
}
#endif // SEARCH_ENGINE_HPP
+9 -1
View File
@@ -6,6 +6,11 @@
#include "util/typedefs.hpp"
#include "util/binary_heap.hpp"
namespace osrm
{
namespace engine
{
struct HeapData
{
NodeID parent;
@@ -14,7 +19,7 @@ struct HeapData
struct SearchEngineData
{
using QueryHeap = BinaryHeap<NodeID, NodeID, int, HeapData, UnorderedMapStorage<NodeID, int>>;
using QueryHeap = util::BinaryHeap<NodeID, NodeID, int, HeapData, util::UnorderedMapStorage<NodeID, int>>;
using SearchEngineHeapPtr = boost::thread_specific_ptr<QueryHeap>;
static SearchEngineHeapPtr forward_heap_1;
@@ -31,4 +36,7 @@ struct SearchEngineData
void InitializeOrClearThirdThreadLocalStorage(const unsigned number_of_nodes);
};
}
}
#endif // SEARCH_ENGINE_DATA_HPP
+18 -11
View File
@@ -2,53 +2,60 @@
#define SEGMENT_INFORMATION_HPP
#include "extractor/turn_instructions.hpp"
#include "extractor/travel_mode.hpp"
#include "util/typedefs.hpp"
#include "osrm/coordinate.hpp"
#include <utility>
namespace osrm
{
namespace engine
{
// Struct fits everything in one cache line
struct SegmentInformation
{
FixedPointCoordinate location;
util::FixedPointCoordinate location;
NodeID name_id;
EdgeWeight duration;
float length;
short pre_turn_bearing; // more than enough [0..3600] fits into 12 bits
short post_turn_bearing;
TurnInstruction turn_instruction;
TravelMode travel_mode;
extractor::TurnInstruction turn_instruction;
extractor::TravelMode travel_mode;
bool necessary;
bool is_via_location;
explicit SegmentInformation(FixedPointCoordinate location,
explicit SegmentInformation(util::FixedPointCoordinate location,
const NodeID name_id,
const EdgeWeight duration,
const float length,
const TurnInstruction turn_instruction,
const extractor::TurnInstruction turn_instruction,
const bool necessary,
const bool is_via_location,
const TravelMode travel_mode)
const extractor::TravelMode travel_mode)
: location(std::move(location)), name_id(name_id), duration(duration), length(length),
pre_turn_bearing(0), post_turn_bearing(0), turn_instruction(turn_instruction),
travel_mode(travel_mode), necessary(necessary), is_via_location(is_via_location)
{
}
explicit SegmentInformation(FixedPointCoordinate location,
explicit SegmentInformation(util::FixedPointCoordinate location,
const NodeID name_id,
const EdgeWeight duration,
const float length,
const TurnInstruction turn_instruction,
const TravelMode travel_mode)
const extractor::TurnInstruction turn_instruction,
const extractor::TravelMode travel_mode)
: location(std::move(location)), name_id(name_id), duration(duration), length(length),
pre_turn_bearing(0), post_turn_bearing(0), turn_instruction(turn_instruction),
travel_mode(travel_mode), necessary(turn_instruction != TurnInstruction::NoTurn),
travel_mode(travel_mode), necessary(turn_instruction != extractor::TurnInstruction::NoTurn),
is_via_location(false)
{
}
};
}
}
#endif /* SEGMENT_INFORMATION_HPP */
+8 -4
View File
@@ -16,11 +16,13 @@
namespace osrm
{
namespace engine
{
namespace trip
{
// computes the distance of a given permutation
EdgeWeight ReturnDistance(const DistTableWrapper<EdgeWeight> &dist_table,
EdgeWeight ReturnDistance(const util::DistTableWrapper<EdgeWeight> &dist_table,
const std::vector<NodeID> &location_order,
const EdgeWeight min_route_dist,
const std::size_t component_size)
@@ -44,7 +46,7 @@ template <typename NodeIDIterator>
std::vector<NodeID> BruteForceTrip(const NodeIDIterator start,
const NodeIDIterator end,
const std::size_t number_of_locations,
const DistTableWrapper<EdgeWeight> &dist_table)
const util::DistTableWrapper<EdgeWeight> &dist_table)
{
(void)number_of_locations; // unused
@@ -76,6 +78,8 @@ std::vector<NodeID> BruteForceTrip(const NodeIDIterator start,
return route;
}
} // end namespace trip
} // end namespace osrm
}
}
}
#endif // TRIP_BRUTE_FORCE_HPP
@@ -15,6 +15,8 @@
namespace osrm
{
namespace engine
{
namespace trip
{
@@ -23,7 +25,7 @@ namespace trip
using NodeIDIter = std::vector<NodeID>::iterator;
std::pair<EdgeWeight, NodeIDIter>
GetShortestRoundTrip(const NodeID new_loc,
const DistTableWrapper<EdgeWeight> &dist_table,
const util::DistTableWrapper<EdgeWeight> &dist_table,
const std::size_t number_of_locations,
std::vector<NodeID> &route)
{
@@ -76,7 +78,7 @@ std::vector<NodeID> FindRoute(const std::size_t &number_of_locations,
const std::size_t &component_size,
const NodeIDIterator &start,
const NodeIDIterator &end,
const DistTableWrapper<EdgeWeight> &dist_table,
const util::DistTableWrapper<EdgeWeight> &dist_table,
const NodeID &start1,
const NodeID &start2)
{
@@ -138,7 +140,7 @@ template <typename NodeIDIterator>
std::vector<NodeID> FarthestInsertionTrip(const NodeIDIterator &start,
const NodeIDIterator &end,
const std::size_t number_of_locations,
const DistTableWrapper<EdgeWeight> &dist_table)
const util::DistTableWrapper<EdgeWeight> &dist_table)
{
//////////////////////////////////////////////////////////////////////////////////////////////////
// START FARTHEST INSERTION HERE
@@ -189,7 +191,8 @@ std::vector<NodeID> FarthestInsertionTrip(const NodeIDIterator &start,
return FindRoute(number_of_locations, component_size, start, end, dist_table, max_from, max_to);
}
} // end namespace trip
} // end namespace osrm
}
}
}
#endif // TRIP_FARTHEST_INSERTION_HPP
@@ -15,13 +15,16 @@
namespace osrm
{
namespace engine
{
namespace trip
{
template <typename NodeIDIterator>
std::vector<NodeID> NearestNeighbourTrip(const NodeIDIterator &start,
const NodeIDIterator &end,
const std::size_t number_of_locations,
const DistTableWrapper<EdgeWeight> &dist_table)
const util::DistTableWrapper<EdgeWeight> &dist_table)
{
//////////////////////////////////////////////////////////////////////////////////////////////////
// START GREEDY NEAREST NEIGHBOUR HERE
@@ -90,6 +93,8 @@ std::vector<NodeID> NearestNeighbourTrip(const NodeIDIterator &start,
return route;
}
} // end namespace trip
} // end namespace osrm
#endif // TRIP_NEAREST_NEIGHBOUR_HPP
}
}
}
#endif // TRIP_NEAREST_NEIGHBOUR_HPP
+6 -1
View File
@@ -14,6 +14,8 @@
namespace osrm
{
namespace engine
{
namespace trip
{
@@ -32,6 +34,9 @@ void TabuSearchTrip(const PhantomNodeArray &phantom_node_vector,
std::vector<int> &min_loc_permutation)
{
}
}
}
#endif // TRIP_BRUTE_FORCE_HPP
}
#endif // TRIP_BRUTE_FORCE_HPP