2014-11-28 09:33:08 -05:00
|
|
|
#ifndef SHORTEST_PATH_HPP
|
|
|
|
#define SHORTEST_PATH_HPP
|
2012-06-15 12:47:27 -04:00
|
|
|
|
2016-01-02 11:13:44 -05:00
|
|
|
#include "util/typedefs.hpp"
|
2012-06-15 12:47:27 -04:00
|
|
|
|
2016-01-02 11:13:44 -05:00
|
|
|
#include "engine/routing_algorithms/routing_base.hpp"
|
2015-11-30 23:28:57 -05:00
|
|
|
|
2017-01-05 06:18:45 -05:00
|
|
|
#include "engine/datafacade/datafacade_base.hpp"
|
2016-01-02 11:13:44 -05:00
|
|
|
#include "engine/search_engine_data.hpp"
|
|
|
|
#include "util/integer_range.hpp"
|
2015-11-30 23:28:57 -05:00
|
|
|
|
|
|
|
#include <boost/assert.hpp>
|
2016-01-28 10:28:44 -05:00
|
|
|
#include <boost/optional.hpp>
|
2017-01-05 06:18:45 -05:00
|
|
|
#include <memory>
|
2013-09-19 12:53:34 -04:00
|
|
|
|
2016-01-05 10:51:13 -05:00
|
|
|
namespace osrm
|
|
|
|
{
|
|
|
|
namespace engine
|
|
|
|
{
|
|
|
|
namespace routing_algorithms
|
|
|
|
{
|
|
|
|
|
2017-01-05 06:18:45 -05:00
|
|
|
class ShortestPathRouting final : public BasicRoutingInterface
|
2014-05-08 12:04:05 -04:00
|
|
|
{
|
2017-01-05 06:18:45 -05:00
|
|
|
using super = BasicRoutingInterface;
|
2014-08-19 07:01:38 -04:00
|
|
|
using QueryHeap = SearchEngineData::QueryHeap;
|
2014-05-08 12:04:05 -04:00
|
|
|
SearchEngineData &engine_working_data;
|
2016-01-07 04:33:47 -05:00
|
|
|
const static constexpr bool DO_NOT_FORCE_LOOP = false;
|
2014-05-08 12:04:05 -04:00
|
|
|
|
|
|
|
public:
|
2016-10-05 19:05:03 -04:00
|
|
|
ShortestPathRouting(SearchEngineData &engine_working_data)
|
|
|
|
: engine_working_data(engine_working_data)
|
2014-05-08 12:04:05 -04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
~ShortestPathRouting() {}
|
|
|
|
|
2015-11-30 23:28:57 -05:00
|
|
|
// allows a uturn at the target_phantom
|
|
|
|
// searches source forward/reverse -> target forward/reverse
|
2017-01-05 06:18:45 -05:00
|
|
|
void SearchWithUTurn(const std::shared_ptr<const datafacade::BaseDataFacade> facade,
|
2016-10-05 19:05:03 -04:00
|
|
|
QueryHeap &forward_heap,
|
2015-11-30 23:28:57 -05:00
|
|
|
QueryHeap &reverse_heap,
|
2016-03-07 15:26:12 -05:00
|
|
|
QueryHeap &forward_core_heap,
|
|
|
|
QueryHeap &reverse_core_heap,
|
2015-11-30 23:28:57 -05:00
|
|
|
const bool search_from_forward_node,
|
|
|
|
const bool search_from_reverse_node,
|
|
|
|
const bool search_to_forward_node,
|
|
|
|
const bool search_to_reverse_node,
|
|
|
|
const PhantomNode &source_phantom,
|
|
|
|
const PhantomNode &target_phantom,
|
2016-05-12 12:50:10 -04:00
|
|
|
const int total_weight_to_forward,
|
|
|
|
const int total_weight_to_reverse,
|
|
|
|
int &new_total_weight,
|
2017-01-05 06:18:45 -05:00
|
|
|
std::vector<NodeID> &leg_packed_path) const;
|
2015-11-30 23:28:57 -05:00
|
|
|
|
|
|
|
// searches shortest path between:
|
|
|
|
// source forward/reverse -> target forward
|
|
|
|
// source forward/reverse -> target reverse
|
2017-01-05 06:18:45 -05:00
|
|
|
void Search(const std::shared_ptr<const datafacade::BaseDataFacade> facade,
|
2016-10-05 19:05:03 -04:00
|
|
|
QueryHeap &forward_heap,
|
2015-11-30 23:28:57 -05:00
|
|
|
QueryHeap &reverse_heap,
|
2016-03-07 15:26:12 -05:00
|
|
|
QueryHeap &forward_core_heap,
|
|
|
|
QueryHeap &reverse_core_heap,
|
2015-11-30 23:28:57 -05:00
|
|
|
const bool search_from_forward_node,
|
|
|
|
const bool search_from_reverse_node,
|
|
|
|
const bool search_to_forward_node,
|
|
|
|
const bool search_to_reverse_node,
|
|
|
|
const PhantomNode &source_phantom,
|
|
|
|
const PhantomNode &target_phantom,
|
2016-05-12 12:50:10 -04:00
|
|
|
const int total_weight_to_forward,
|
|
|
|
const int total_weight_to_reverse,
|
|
|
|
int &new_total_weight_to_forward,
|
|
|
|
int &new_total_weight_to_reverse,
|
2015-11-30 23:28:57 -05:00
|
|
|
std::vector<NodeID> &leg_packed_path_forward,
|
2017-01-05 06:18:45 -05:00
|
|
|
std::vector<NodeID> &leg_packed_path_reverse) const;
|
2016-03-07 15:26:12 -05:00
|
|
|
|
2017-01-05 06:18:45 -05:00
|
|
|
void UnpackLegs(const std::shared_ptr<const datafacade::BaseDataFacade> facade,
|
2016-10-05 19:05:03 -04:00
|
|
|
const std::vector<PhantomNodes> &phantom_nodes_vector,
|
2015-11-30 23:28:57 -05:00
|
|
|
const std::vector<NodeID> &total_packed_path,
|
|
|
|
const std::vector<std::size_t> &packed_leg_begin,
|
|
|
|
const int shortest_path_length,
|
2017-01-05 06:18:45 -05:00
|
|
|
InternalRouteResult &raw_route_data) const;
|
2015-11-30 23:28:57 -05:00
|
|
|
|
2017-01-05 06:18:45 -05:00
|
|
|
void operator()(const std::shared_ptr<const datafacade::BaseDataFacade> facade,
|
2016-10-05 19:05:03 -04:00
|
|
|
const std::vector<PhantomNodes> &phantom_nodes_vector,
|
2016-04-12 12:47:00 -04:00
|
|
|
const boost::optional<bool> continue_straight_at_waypoint,
|
2017-01-05 06:18:45 -05:00
|
|
|
InternalRouteResult &raw_route_data) const;
|
2012-06-15 12:47:27 -04:00
|
|
|
};
|
2017-01-05 06:18:45 -05:00
|
|
|
} // namespace routing_algorithms
|
|
|
|
} // namespace engine
|
|
|
|
} // namespace osrm
|
2016-01-05 10:51:13 -05:00
|
|
|
|
2014-11-28 09:33:08 -05:00
|
|
|
#endif /* SHORTEST_PATH_HPP */
|