Fix bug in refactor
This commit is contained in:
parent
30ff0fa977
commit
0ac1f99f9c
@ -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
|
||||
{
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -183,13 +183,13 @@ void search(const datafacade::ContiguousInternalMemoryDataFacade<algorithm::Core
|
||||
else
|
||||
{
|
||||
routingStep<FORWARD_DIRECTION>(facade,
|
||||
forward_heap,
|
||||
reverse_heap,
|
||||
middle,
|
||||
weight,
|
||||
min_edge_offset,
|
||||
force_loop_forward,
|
||||
force_loop_reverse);
|
||||
forward_heap,
|
||||
reverse_heap,
|
||||
middle,
|
||||
weight,
|
||||
min_edge_offset,
|
||||
force_loop_forward,
|
||||
force_loop_reverse);
|
||||
}
|
||||
}
|
||||
if (!reverse_heap.Empty())
|
||||
@ -203,13 +203,13 @@ void search(const datafacade::ContiguousInternalMemoryDataFacade<algorithm::Core
|
||||
else
|
||||
{
|
||||
routingStep<REVERSE_DIRECTION>(facade,
|
||||
reverse_heap,
|
||||
forward_heap,
|
||||
middle,
|
||||
weight,
|
||||
min_edge_offset,
|
||||
force_loop_reverse,
|
||||
force_loop_forward);
|
||||
reverse_heap,
|
||||
forward_heap,
|
||||
middle,
|
||||
weight,
|
||||
min_edge_offset,
|
||||
force_loop_reverse,
|
||||
force_loop_forward);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -253,22 +253,22 @@ void search(const datafacade::ContiguousInternalMemoryDataFacade<algorithm::Core
|
||||
weight > (forward_core_heap.MinKey() + reverse_core_heap.MinKey()))
|
||||
{
|
||||
routingStep<FORWARD_DIRECTION, DISABLE_STALLING>(facade,
|
||||
forward_core_heap,
|
||||
reverse_core_heap,
|
||||
middle,
|
||||
weight,
|
||||
min_core_edge_offset,
|
||||
force_loop_forward,
|
||||
force_loop_reverse);
|
||||
forward_core_heap,
|
||||
reverse_core_heap,
|
||||
middle,
|
||||
weight,
|
||||
min_core_edge_offset,
|
||||
force_loop_forward,
|
||||
force_loop_reverse);
|
||||
|
||||
routingStep<REVERSE_DIRECTION, DISABLE_STALLING>(facade,
|
||||
reverse_core_heap,
|
||||
forward_core_heap,
|
||||
middle,
|
||||
weight,
|
||||
min_core_edge_offset,
|
||||
force_loop_reverse,
|
||||
force_loop_forward);
|
||||
reverse_core_heap,
|
||||
forward_core_heap,
|
||||
middle,
|
||||
weight,
|
||||
min_core_edge_offset,
|
||||
force_loop_reverse,
|
||||
force_loop_forward);
|
||||
}
|
||||
|
||||
// No path found for both target nodes?
|
||||
|
@ -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());
|
||||
|
Loading…
Reference in New Issue
Block a user