Fix bug in refactor

This commit is contained in:
Patrick Niklaus 2017-02-28 23:43:11 +00:00 committed by Patrick Niklaus
parent 30ff0fa977
commit 0ac1f99f9c
7 changed files with 45 additions and 40 deletions

View File

@ -70,6 +70,8 @@ template <typename AlgorithmT> class RoutingAlgorithms final : public RoutingAlg
{
}
virtual ~RoutingAlgorithms() = default;
InternalRouteResult
AlternativePathSearch(const PhantomNodes &phantom_node_pair) const final override
{

View File

@ -128,7 +128,7 @@ we need to add an offset to the termination criterion.
static constexpr bool ENABLE_STALLING = true;
static constexpr bool DISABLE_STALLING = false;
static constexpr bool DO_NOT_FORCE_LOOPS = false;
template<bool DIRECTION, bool STALLING=ENABLE_STALLING>
template <bool DIRECTION, bool STALLING = ENABLE_STALLING>
void routingStep(const datafacade::ContiguousInternalMemoryDataFacade<algorithm::CH> &facade,
SearchEngineData::QueryHeap &forward_heap,
SearchEngineData::QueryHeap &reverse_heap,

View File

@ -81,11 +81,11 @@ ViaRoutePlugin::HandleRequest(const datafacade::ContiguousInternalMemoryDataFaca
? *route_parameters.continue_straight
: facade.GetContinueStraightDefault();
InternalRouteResult raw_route;
auto build_phantom_pairs = [&raw_route, continue_straight_at_waypoint](
std::vector<PhantomNodes> start_end_nodes;
auto build_phantom_pairs = [&start_end_nodes, continue_straight_at_waypoint](
const PhantomNode &first_node, const PhantomNode &second_node) {
raw_route.segment_end_coordinates.push_back(PhantomNodes{first_node, second_node});
auto &last_inserted = raw_route.segment_end_coordinates.back();
start_end_nodes.push_back(PhantomNodes{first_node, second_node});
auto &last_inserted = start_end_nodes.back();
// enable forward direction if possible
if (last_inserted.source_phantom.forward_segment_id.id != SPECIAL_SEGMENTID)
{
@ -101,20 +101,20 @@ ViaRoutePlugin::HandleRequest(const datafacade::ContiguousInternalMemoryDataFaca
};
util::for_each_pair(snapped_phantoms, build_phantom_pairs);
if (1 == raw_route.segment_end_coordinates.size() && algorithms.HasAlternativePathSearch() &&
InternalRouteResult raw_route;
if (1 == start_end_nodes.size() && algorithms.HasAlternativePathSearch() &&
route_parameters.alternatives)
{
raw_route = algorithms.AlternativePathSearch(raw_route.segment_end_coordinates.front());
raw_route = algorithms.AlternativePathSearch(start_end_nodes.front());
}
else if (1 == raw_route.segment_end_coordinates.size() &&
algorithms.HasDirectShortestPathSearch())
else if (1 == start_end_nodes.size() && algorithms.HasDirectShortestPathSearch())
{
raw_route = algorithms.DirectShortestPathSearch(raw_route.segment_end_coordinates.front());
raw_route = algorithms.DirectShortestPathSearch(start_end_nodes.front());
}
else
{
raw_route = algorithms.ShortestPathSearch(raw_route.segment_end_coordinates,
route_parameters.continue_straight);
raw_route =
algorithms.ShortestPathSearch(start_end_nodes, route_parameters.continue_straight);
}
// we can only know this after the fact, different SCC ids still

View File

@ -567,6 +567,7 @@ alternativePathSearch(SearchEngineData &engine_working_data,
const PhantomNodes &phantom_node_pair)
{
InternalRouteResult raw_route_data;
raw_route_data.segment_end_coordinates = {phantom_node_pair};
std::vector<NodeID> alternative_path;
std::vector<NodeID> via_node_candidate_list;
std::vector<SearchSpaceEdge> forward_search_space;

View File

@ -56,6 +56,7 @@ extractRoute(const datafacade::ContiguousInternalMemoryDataFacade<AlgorithmT> &f
const PhantomNodes &nodes)
{
InternalRouteResult raw_route_data;
raw_route_data.segment_end_coordinates = {nodes};
// No path found for both target nodes?
if (INVALID_EDGE_WEIGHT == weight)
{

View File

@ -235,6 +235,7 @@ shortestPathSearchImpl(SearchEngineData &engine_working_data,
const boost::optional<bool> continue_straight_at_waypoint)
{
InternalRouteResult raw_route_data;
raw_route_data.segment_end_coordinates = phantom_nodes_vector;
const bool allow_uturn_at_waypoint =
!(continue_straight_at_waypoint ? *continue_straight_at_waypoint
: facade.GetContinueStraightDefault());