Implement re-enabling of PhantomNode directions after bearing filtering

This commit is contained in:
Patrick Niklaus
2016-03-28 17:06:51 +02:00
parent 5829bbe22d
commit fda4656630
16 changed files with 302 additions and 280 deletions
@@ -84,45 +84,37 @@ class AlternativeRouting final
int upper_bound_to_shortest_path_distance = INVALID_EDGE_WEIGHT;
NodeID middle_node = SPECIAL_NODEID;
const EdgeWeight min_edge_offset =
std::min(-phantom_node_pair.source_phantom.GetForwardWeightPlusOffset(),
-phantom_node_pair.source_phantom.GetReverseWeightPlusOffset());
std::min(phantom_node_pair.source_phantom.forward_segment_id.enabled ? -phantom_node_pair.source_phantom.GetForwardWeightPlusOffset() : 0,
phantom_node_pair.source_phantom.reverse_segment_id.enabled ? -phantom_node_pair.source_phantom.GetReverseWeightPlusOffset() : 0);
if (phantom_node_pair.source_phantom.forward_node_id != SPECIAL_NODEID)
if (phantom_node_pair.source_phantom.forward_segment_id.enabled)
{
// 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,
BOOST_ASSERT(phantom_node_pair.source_phantom.forward_segment_id.id != SPECIAL_SEGMENTID);
forward_heap1.Insert(phantom_node_pair.source_phantom.forward_segment_id.id,
-phantom_node_pair.source_phantom.GetForwardWeightPlusOffset(),
phantom_node_pair.source_phantom.forward_node_id);
phantom_node_pair.source_phantom.forward_segment_id.id);
}
if (phantom_node_pair.source_phantom.reverse_node_id != SPECIAL_NODEID)
if (phantom_node_pair.source_phantom.reverse_segment_id.enabled)
{
// 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,
BOOST_ASSERT(phantom_node_pair.source_phantom.reverse_segment_id.id != SPECIAL_SEGMENTID);
forward_heap1.Insert(phantom_node_pair.source_phantom.reverse_segment_id.id,
-phantom_node_pair.source_phantom.GetReverseWeightPlusOffset(),
phantom_node_pair.source_phantom.reverse_node_id);
phantom_node_pair.source_phantom.reverse_segment_id.id);
}
if (phantom_node_pair.target_phantom.forward_node_id != SPECIAL_NODEID)
if (phantom_node_pair.target_phantom.forward_segment_id.enabled)
{
// 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,
BOOST_ASSERT(phantom_node_pair.target_phantom.forward_segment_id.id != SPECIAL_SEGMENTID);
reverse_heap1.Insert(phantom_node_pair.target_phantom.forward_segment_id.id,
phantom_node_pair.target_phantom.GetForwardWeightPlusOffset(),
phantom_node_pair.target_phantom.forward_node_id);
phantom_node_pair.target_phantom.forward_segment_id.id);
}
if (phantom_node_pair.target_phantom.reverse_node_id != SPECIAL_NODEID)
if (phantom_node_pair.target_phantom.reverse_segment_id.enabled)
{
// 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,
BOOST_ASSERT(phantom_node_pair.target_phantom.reverse_segment_id.id != SPECIAL_SEGMENTID);
reverse_heap1.Insert(phantom_node_pair.target_phantom.reverse_segment_id.id,
phantom_node_pair.target_phantom.GetReverseWeightPlusOffset(),
phantom_node_pair.target_phantom.reverse_node_id);
phantom_node_pair.target_phantom.reverse_segment_id.id);
}
// search from s and t till new_min/(1+epsilon) > length_of_shortest_path
@@ -316,9 +308,9 @@ class AlternativeRouting final
BOOST_ASSERT(!packed_shortest_path.empty());
raw_route_data.unpacked_path_segments.resize(1);
raw_route_data.source_traversed_in_reverse.push_back(
(packed_shortest_path.front() != phantom_node_pair.source_phantom.forward_node_id));
(packed_shortest_path.front() != phantom_node_pair.source_phantom.forward_segment_id.id));
raw_route_data.target_traversed_in_reverse.push_back(
(packed_shortest_path.back() != phantom_node_pair.target_phantom.forward_node_id));
(packed_shortest_path.back() != phantom_node_pair.target_phantom.forward_segment_id.id));
super::UnpackPath(
// -- packed input
@@ -338,9 +330,9 @@ class AlternativeRouting final
s_v_middle, v_t_middle, packed_alternate_path);
raw_route_data.alt_source_traversed_in_reverse.push_back((
packed_alternate_path.front() != phantom_node_pair.source_phantom.forward_node_id));
packed_alternate_path.front() != phantom_node_pair.source_phantom.forward_segment_id.id));
raw_route_data.alt_target_traversed_in_reverse.push_back(
(packed_alternate_path.back() != phantom_node_pair.target_phantom.forward_node_id));
(packed_alternate_path.back() != phantom_node_pair.target_phantom.forward_segment_id.id));
// unpack the alternate path
super::UnpackPath(packed_alternate_path.begin(), packed_alternate_path.end(),
@@ -60,31 +60,31 @@ class DirectShortestPathRouting final
BOOST_ASSERT(source_phantom.IsValid());
BOOST_ASSERT(target_phantom.IsValid());
if (source_phantom.forward_node_id != SPECIAL_NODEID)
if (source_phantom.forward_segment_id.enabled)
{
forward_heap.Insert(source_phantom.forward_node_id,
forward_heap.Insert(source_phantom.forward_segment_id.id,
-source_phantom.GetForwardWeightPlusOffset(),
source_phantom.forward_node_id);
source_phantom.forward_segment_id.id);
}
if (source_phantom.reverse_node_id != SPECIAL_NODEID)
if (source_phantom.reverse_segment_id.enabled)
{
forward_heap.Insert(source_phantom.reverse_node_id,
forward_heap.Insert(source_phantom.reverse_segment_id.id,
-source_phantom.GetReverseWeightPlusOffset(),
source_phantom.reverse_node_id);
source_phantom.reverse_segment_id.id);
}
if (target_phantom.forward_node_id != SPECIAL_NODEID)
if (target_phantom.forward_segment_id.enabled)
{
reverse_heap.Insert(target_phantom.forward_node_id,
reverse_heap.Insert(target_phantom.forward_segment_id.id,
target_phantom.GetForwardWeightPlusOffset(),
target_phantom.forward_node_id);
target_phantom.forward_segment_id.id);
}
if (target_phantom.reverse_node_id != SPECIAL_NODEID)
if (target_phantom.reverse_segment_id.enabled)
{
reverse_heap.Insert(target_phantom.reverse_node_id,
reverse_heap.Insert(target_phantom.reverse_segment_id.id,
target_phantom.GetReverseWeightPlusOffset(),
target_phantom.reverse_node_id);
target_phantom.reverse_segment_id.id);
}
int distance = INVALID_EDGE_WEIGHT;
@@ -124,9 +124,9 @@ class DirectShortestPathRouting final
raw_route_data.shortest_path_length = distance;
raw_route_data.unpacked_path_segments.resize(1);
raw_route_data.source_traversed_in_reverse.push_back(
(packed_leg.front() != phantom_node_pair.source_phantom.forward_node_id));
(packed_leg.front() != phantom_node_pair.source_phantom.forward_segment_id.id));
raw_route_data.target_traversed_in_reverse.push_back(
(packed_leg.back() != phantom_node_pair.target_phantom.forward_node_id));
(packed_leg.back() != phantom_node_pair.target_phantom.forward_segment_id.id));
super::UnpackPath(packed_leg.begin(), packed_leg.end(), phantom_node_pair,
raw_route_data.unpacked_path_segments.front());
@@ -71,15 +71,17 @@ class ManyToManyRouting final
query_heap.Clear();
// insert target(s) at distance 0
if (SPECIAL_NODEID != phantom.forward_node_id)
if (phantom.forward_segment_id.enabled)
{
query_heap.Insert(phantom.forward_node_id, phantom.GetForwardWeightPlusOffset(),
phantom.forward_node_id);
query_heap.Insert(phantom.forward_segment_id.id,
phantom.GetForwardWeightPlusOffset(),
phantom.forward_segment_id.id);
}
if (SPECIAL_NODEID != phantom.reverse_node_id)
if (phantom.reverse_segment_id.enabled)
{
query_heap.Insert(phantom.reverse_node_id, phantom.GetReverseWeightPlusOffset(),
phantom.reverse_node_id);
query_heap.Insert(phantom.reverse_segment_id.id,
phantom.GetReverseWeightPlusOffset(),
phantom.reverse_segment_id.id);
}
// explore search space
@@ -97,15 +99,17 @@ class ManyToManyRouting final
query_heap.Clear();
// insert target(s) at distance 0
if (SPECIAL_NODEID != phantom.forward_node_id)
if (phantom.forward_segment_id.enabled)
{
query_heap.Insert(phantom.forward_node_id, -phantom.GetForwardWeightPlusOffset(),
phantom.forward_node_id);
query_heap.Insert(phantom.forward_segment_id.id,
-phantom.GetForwardWeightPlusOffset(),
phantom.forward_segment_id.id);
}
if (SPECIAL_NODEID != phantom.reverse_node_id)
if (phantom.reverse_segment_id.enabled)
{
query_heap.Insert(phantom.reverse_node_id, -phantom.GetReverseWeightPlusOffset(),
phantom.reverse_node_id);
query_heap.Insert(phantom.reverse_segment_id.id,
-phantom.GetReverseWeightPlusOffset(),
phantom.reverse_segment_id.id);
}
// explore search space
@@ -213,9 +213,9 @@ template <class DataFacadeT, class Derived> class BasicRoutingInterface
std::vector<PathData> &unpacked_path) const
{
const bool start_traversed_in_reverse =
(*packed_path_begin != phantom_node_pair.source_phantom.forward_node_id);
(*packed_path_begin != phantom_node_pair.source_phantom.forward_segment_id.id);
const bool target_traversed_in_reverse =
(*std::prev(packed_path_end) != phantom_node_pair.target_phantom.forward_node_id);
(*std::prev(packed_path_end) != phantom_node_pair.target_phantom.forward_segment_id.id);
BOOST_ASSERT(std::distance(packed_path_begin, packed_path_end) > 0);
std::stack<std::pair<NodeID, NodeID>> recursion_stack;
@@ -391,11 +391,12 @@ 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, weight_vector[i],
extractor::guidance::TurnInstruction::NO_TURN(),
target_traversed_in_reverse ? phantom_node_pair.target_phantom.backward_travel_mode
: phantom_node_pair.target_phantom.forward_travel_mode});
unpacked_path.emplace_back(
PathData{id_vector[i], phantom_node_pair.target_phantom.name_id, weight_vector[i],
extractor::guidance::TurnInstruction::NO_TURN(),
target_traversed_in_reverse
? phantom_node_pair.target_phantom.backward_travel_mode
: phantom_node_pair.target_phantom.forward_travel_mode});
}
if (is_local_path && unpacked_path.size() > 0)
@@ -520,8 +521,8 @@ template <class DataFacadeT, class Derived> class BasicRoutingInterface
// A forced loop might be necessary, if source and target are on the same segment.
// If this is the case and the offsets of the respective direction are larger for the source
// than the target
// then a force loop is required (e.g. source_phantom.forward_node_id ==
// target_phantom.forward_node_id
// then a force loop is required (e.g. source_phantom.forward_segment_id ==
// target_phantom.forward_segment_id
// && source_phantom.GetForwardWeightPlusOffset() > target_phantom.GetForwardWeightPlusOffset())
// requires
// a force loop, if the heaps have been initialized with positive offsets.
@@ -588,8 +589,8 @@ template <class DataFacadeT, class Derived> class BasicRoutingInterface
// A forced loop might be necessary, if source and target are on the same segment.
// If this is the case and the offsets of the respective direction are larger for the source
// than the target
// then a force loop is required (e.g. source_phantom.forward_node_id ==
// target_phantom.forward_node_id
// then a force loop is required (e.g. source_phantom.forward_segment_id ==
// target_phantom.forward_segment_id
// && source_phantom.GetForwardWeightPlusOffset() > target_phantom.GetForwardWeightPlusOffset())
// requires
// a force loop, if the heaps have been initialized with positive offsets.
@@ -760,7 +761,9 @@ template <class DataFacadeT, class Derived> class BasicRoutingInterface
bool NeedsLoopForward(const PhantomNode &source_phantom,
const PhantomNode &target_phantom) const
{
return source_phantom.forward_node_id == target_phantom.forward_node_id &&
return source_phantom.forward_segment_id.enabled &&
target_phantom.forward_segment_id.enabled &&
source_phantom.forward_segment_id.id == target_phantom.forward_segment_id.id &&
source_phantom.GetForwardWeightPlusOffset() >
target_phantom.GetForwardWeightPlusOffset();
}
@@ -768,7 +771,9 @@ template <class DataFacadeT, class Derived> class BasicRoutingInterface
bool NeedsLoopBackwards(const PhantomNode &source_phantom,
const PhantomNode &target_phantom) const
{
return source_phantom.reverse_node_id == target_phantom.reverse_node_id &&
return source_phantom.reverse_segment_id.enabled &&
target_phantom.reverse_segment_id.enabled &&
source_phantom.reverse_segment_id.id == target_phantom.reverse_segment_id.id &&
source_phantom.GetReverseWeightPlusOffset() >
target_phantom.GetReverseWeightPlusOffset();
}
@@ -812,30 +817,30 @@ template <class DataFacadeT, class Derived> class BasicRoutingInterface
BOOST_ASSERT(forward_heap.Empty());
BOOST_ASSERT(reverse_heap.Empty());
if (source_phantom.forward_node_id != SPECIAL_NODEID)
if (source_phantom.forward_segment_id.enabled)
{
forward_heap.Insert(source_phantom.forward_node_id,
forward_heap.Insert(source_phantom.forward_segment_id.id,
-source_phantom.GetForwardWeightPlusOffset(),
source_phantom.forward_node_id);
source_phantom.forward_segment_id.id);
}
if (source_phantom.reverse_node_id != SPECIAL_NODEID)
if (source_phantom.reverse_segment_id.enabled)
{
forward_heap.Insert(source_phantom.reverse_node_id,
forward_heap.Insert(source_phantom.reverse_segment_id.id,
-source_phantom.GetReverseWeightPlusOffset(),
source_phantom.reverse_node_id);
source_phantom.reverse_segment_id.id);
}
if (target_phantom.forward_node_id != SPECIAL_NODEID)
if (target_phantom.forward_segment_id.enabled)
{
reverse_heap.Insert(target_phantom.forward_node_id,
reverse_heap.Insert(target_phantom.forward_segment_id.id,
target_phantom.GetForwardWeightPlusOffset(),
target_phantom.forward_node_id);
target_phantom.forward_segment_id.id);
}
if (target_phantom.reverse_node_id != SPECIAL_NODEID)
if (target_phantom.reverse_segment_id.enabled)
{
reverse_heap.Insert(target_phantom.reverse_node_id,
reverse_heap.Insert(target_phantom.reverse_segment_id.id,
target_phantom.GetReverseWeightPlusOffset(),
target_phantom.reverse_node_id);
target_phantom.reverse_segment_id.id);
}
const bool constexpr DO_NOT_FORCE_LOOPS =
@@ -866,30 +871,30 @@ template <class DataFacadeT, class Derived> class BasicRoutingInterface
BOOST_ASSERT(forward_heap.Empty());
BOOST_ASSERT(reverse_heap.Empty());
if (source_phantom.forward_node_id != SPECIAL_NODEID)
if (source_phantom.forward_segment_id.enabled)
{
forward_heap.Insert(source_phantom.forward_node_id,
forward_heap.Insert(source_phantom.forward_segment_id.id,
-source_phantom.GetForwardWeightPlusOffset(),
source_phantom.forward_node_id);
source_phantom.forward_segment_id.id);
}
if (source_phantom.reverse_node_id != SPECIAL_NODEID)
if (source_phantom.reverse_segment_id.enabled)
{
forward_heap.Insert(source_phantom.reverse_node_id,
forward_heap.Insert(source_phantom.reverse_segment_id.id,
-source_phantom.GetReverseWeightPlusOffset(),
source_phantom.reverse_node_id);
source_phantom.reverse_segment_id.id);
}
if (target_phantom.forward_node_id != SPECIAL_NODEID)
if (target_phantom.forward_segment_id.enabled)
{
reverse_heap.Insert(target_phantom.forward_node_id,
reverse_heap.Insert(target_phantom.forward_segment_id.id,
target_phantom.GetForwardWeightPlusOffset(),
target_phantom.forward_node_id);
target_phantom.forward_segment_id.id);
}
if (target_phantom.reverse_node_id != SPECIAL_NODEID)
if (target_phantom.reverse_segment_id.enabled)
{
reverse_heap.Insert(target_phantom.reverse_node_id,
reverse_heap.Insert(target_phantom.reverse_segment_id.id,
target_phantom.GetReverseWeightPlusOffset(),
target_phantom.reverse_node_id);
target_phantom.reverse_segment_id.id);
}
const bool constexpr DO_NOT_FORCE_LOOPS =
@@ -56,29 +56,29 @@ class ShortestPathRouting final
reverse_heap.Clear();
if (search_from_forward_node)
{
forward_heap.Insert(source_phantom.forward_node_id,
forward_heap.Insert(source_phantom.forward_segment_id.id,
total_distance_to_forward -
source_phantom.GetForwardWeightPlusOffset(),
source_phantom.forward_node_id);
source_phantom.forward_segment_id.id);
}
if (search_from_reverse_node)
{
forward_heap.Insert(source_phantom.reverse_node_id,
forward_heap.Insert(source_phantom.reverse_segment_id.id,
total_distance_to_reverse -
source_phantom.GetReverseWeightPlusOffset(),
source_phantom.reverse_node_id);
source_phantom.reverse_segment_id.id);
}
if (search_to_forward_node)
{
reverse_heap.Insert(target_phantom.forward_node_id,
reverse_heap.Insert(target_phantom.forward_segment_id.id,
target_phantom.GetForwardWeightPlusOffset(),
target_phantom.forward_node_id);
target_phantom.forward_segment_id.id);
}
if (search_to_reverse_node)
{
reverse_heap.Insert(target_phantom.reverse_node_id,
reverse_heap.Insert(target_phantom.reverse_segment_id.id,
target_phantom.GetReverseWeightPlusOffset(),
target_phantom.reverse_node_id);
target_phantom.reverse_segment_id.id);
}
BOOST_ASSERT(forward_heap.Size() > 0);
@@ -88,8 +88,10 @@ class ShortestPathRouting final
auto is_oneway_source = !(search_from_forward_node && search_from_reverse_node);
auto is_oneway_target = !(search_to_forward_node && search_to_reverse_node);
// we only enable loops here if we can't search from forward to backward node
auto needs_loop_forwad = is_oneway_source && super::NeedsLoopForward(source_phantom, target_phantom);
auto needs_loop_backwards = is_oneway_target && super::NeedsLoopBackwards(source_phantom, target_phantom);
auto needs_loop_forwad =
is_oneway_source && super::NeedsLoopForward(source_phantom, target_phantom);
auto needs_loop_backwards =
is_oneway_target && super::NeedsLoopBackwards(source_phantom, target_phantom);
if (super::facade->GetCoreSize() > 0)
{
forward_core_heap.Clear();
@@ -97,7 +99,8 @@ class ShortestPathRouting final
BOOST_ASSERT(forward_core_heap.Size() == 0);
BOOST_ASSERT(reverse_core_heap.Size() == 0);
super::SearchWithCore(forward_heap, reverse_heap, forward_core_heap, reverse_core_heap,
new_total_distance, leg_packed_path, needs_loop_forwad, needs_loop_backwards);
new_total_distance, leg_packed_path, needs_loop_forwad,
needs_loop_backwards);
}
else
{
@@ -130,23 +133,23 @@ class ShortestPathRouting final
{
forward_heap.Clear();
reverse_heap.Clear();
reverse_heap.Insert(target_phantom.forward_node_id,
reverse_heap.Insert(target_phantom.forward_segment_id.id,
target_phantom.GetForwardWeightPlusOffset(),
target_phantom.forward_node_id);
target_phantom.forward_segment_id.id);
if (search_from_forward_node)
{
forward_heap.Insert(source_phantom.forward_node_id,
forward_heap.Insert(source_phantom.forward_segment_id.id,
total_distance_to_forward -
source_phantom.GetForwardWeightPlusOffset(),
source_phantom.forward_node_id);
source_phantom.forward_segment_id.id);
}
if (search_from_reverse_node)
{
forward_heap.Insert(source_phantom.reverse_node_id,
forward_heap.Insert(source_phantom.reverse_segment_id.id,
total_distance_to_reverse -
source_phantom.GetReverseWeightPlusOffset(),
source_phantom.reverse_node_id);
source_phantom.reverse_segment_id.id);
}
BOOST_ASSERT(forward_heap.Size() > 0);
BOOST_ASSERT(reverse_heap.Size() > 0);
@@ -176,22 +179,22 @@ class ShortestPathRouting final
{
forward_heap.Clear();
reverse_heap.Clear();
reverse_heap.Insert(target_phantom.reverse_node_id,
reverse_heap.Insert(target_phantom.reverse_segment_id.id,
target_phantom.GetReverseWeightPlusOffset(),
target_phantom.reverse_node_id);
target_phantom.reverse_segment_id.id);
if (search_from_forward_node)
{
forward_heap.Insert(source_phantom.forward_node_id,
forward_heap.Insert(source_phantom.forward_segment_id.id,
total_distance_to_forward -
source_phantom.GetForwardWeightPlusOffset(),
source_phantom.forward_node_id);
source_phantom.forward_segment_id.id);
}
if (search_from_reverse_node)
{
forward_heap.Insert(source_phantom.reverse_node_id,
forward_heap.Insert(source_phantom.reverse_segment_id.id,
total_distance_to_reverse -
source_phantom.GetReverseWeightPlusOffset(),
source_phantom.reverse_node_id);
source_phantom.reverse_segment_id.id);
}
BOOST_ASSERT(forward_heap.Size() > 0);
BOOST_ASSERT(reverse_heap.Size() > 0);
@@ -234,10 +237,11 @@ class ShortestPathRouting final
raw_route_data.unpacked_path_segments[current_leg]);
raw_route_data.source_traversed_in_reverse.push_back(
(*leg_begin != phantom_nodes_vector[current_leg].source_phantom.forward_node_id));
(*leg_begin !=
phantom_nodes_vector[current_leg].source_phantom.forward_segment_id.id));
raw_route_data.target_traversed_in_reverse.push_back(
(*std::prev(leg_end) !=
phantom_nodes_vector[current_leg].target_phantom.forward_node_id));
phantom_nodes_vector[current_leg].target_phantom.forward_segment_id.id));
}
}
@@ -245,6 +249,8 @@ class ShortestPathRouting final
const boost::optional<bool> uturns,
InternalRouteResult &raw_route_data) const
{
const bool allow_u_turn_at_via = uturns ? *uturns : super::facade->GetUTurnsDefault();
engine_working_data.InitializeOrClearFirstThreadLocalStorage(
super::facade->GetNumberOfNodes());
engine_working_data.InitializeOrClearSecondThreadLocalStorage(
@@ -258,9 +264,9 @@ class ShortestPathRouting final
int total_distance_to_forward = 0;
int total_distance_to_reverse = 0;
bool search_from_forward_node =
phantom_nodes_vector.front().source_phantom.forward_node_id != SPECIAL_NODEID;
phantom_nodes_vector.front().source_phantom.forward_segment_id.enabled;
bool search_from_reverse_node =
phantom_nodes_vector.front().source_phantom.reverse_node_id != SPECIAL_NODEID;
phantom_nodes_vector.front().source_phantom.reverse_segment_id.enabled;
std::vector<NodeID> prev_packed_leg_to_forward;
std::vector<NodeID> prev_packed_leg_to_reverse;
@@ -270,8 +276,6 @@ class ShortestPathRouting final
std::vector<NodeID> total_packed_path_to_reverse;
std::vector<std::size_t> packed_leg_to_reverse_begin;
const bool allow_u_turn_at_via = uturns ? *uturns : super::facade->GetUTurnsDefault();
std::size_t current_leg = 0;
// this implements a dynamic program that finds the shortest route through
// a list of vias
@@ -286,13 +290,11 @@ class ShortestPathRouting final
const auto &source_phantom = phantom_node_pair.source_phantom;
const auto &target_phantom = phantom_node_pair.target_phantom;
bool search_to_forward_node = target_phantom.forward_node_id != SPECIAL_NODEID;
bool search_to_reverse_node = target_phantom.reverse_node_id != SPECIAL_NODEID;
bool search_to_forward_node = target_phantom.forward_segment_id.enabled;
bool search_to_reverse_node = target_phantom.reverse_segment_id.enabled;
BOOST_ASSERT(!search_from_forward_node ||
source_phantom.forward_node_id != SPECIAL_NODEID);
BOOST_ASSERT(!search_from_reverse_node ||
source_phantom.reverse_node_id != SPECIAL_NODEID);
BOOST_ASSERT(!search_from_forward_node || source_phantom.forward_segment_id.enabled);
BOOST_ASSERT(!search_from_reverse_node || source_phantom.reverse_segment_id.enabled);
BOOST_ASSERT(search_from_forward_node || search_from_reverse_node);
@@ -308,14 +310,14 @@ class ShortestPathRouting final
new_total_distance_to_forward, packed_leg_to_forward);
// if only the reverse node is valid (e.g. when using the match plugin) we
// actually need to move
if (target_phantom.forward_node_id == SPECIAL_NODEID)
if (target_phantom.forward_segment_id.enabled)
{
BOOST_ASSERT(target_phantom.reverse_node_id != SPECIAL_NODEID);
BOOST_ASSERT(target_phantom.reverse_segment_id.enabled);
new_total_distance_to_reverse = new_total_distance_to_forward;
packed_leg_to_reverse = std::move(packed_leg_to_forward);
new_total_distance_to_forward = INVALID_EDGE_WEIGHT;
}
else if (target_phantom.reverse_node_id != SPECIAL_NODEID)
else if (target_phantom.reverse_segment_id.enabled)
{
new_total_distance_to_reverse = new_total_distance_to_forward;
packed_leg_to_reverse = packed_leg_to_forward;
@@ -346,16 +348,16 @@ class ShortestPathRouting final
{
bool forward_to_forward =
(new_total_distance_to_forward != INVALID_EDGE_WEIGHT) &&
packed_leg_to_forward.front() == source_phantom.forward_node_id;
packed_leg_to_forward.front() == source_phantom.forward_segment_id.id;
bool reverse_to_forward =
(new_total_distance_to_forward != INVALID_EDGE_WEIGHT) &&
packed_leg_to_forward.front() == source_phantom.reverse_node_id;
packed_leg_to_forward.front() == source_phantom.reverse_segment_id.id;
bool forward_to_reverse =
(new_total_distance_to_reverse != INVALID_EDGE_WEIGHT) &&
packed_leg_to_reverse.front() == source_phantom.forward_node_id;
packed_leg_to_reverse.front() == source_phantom.forward_segment_id.id;
bool reverse_to_reverse =
(new_total_distance_to_reverse != INVALID_EDGE_WEIGHT) &&
packed_leg_to_reverse.front() == source_phantom.reverse_node_id;
packed_leg_to_reverse.front() == source_phantom.reverse_segment_id.id;
BOOST_ASSERT(!forward_to_forward || !reverse_to_forward);
BOOST_ASSERT(!forward_to_reverse || !reverse_to_reverse);
@@ -390,7 +392,7 @@ class ShortestPathRouting final
if (new_total_distance_to_forward != INVALID_EDGE_WEIGHT)
{
BOOST_ASSERT(target_phantom.forward_node_id != SPECIAL_NODEID);
BOOST_ASSERT(target_phantom.forward_segment_id.enabled);
packed_leg_to_forward_begin.push_back(total_packed_path_to_forward.size());
total_packed_path_to_forward.insert(total_packed_path_to_forward.end(),
@@ -407,7 +409,7 @@ class ShortestPathRouting final
if (new_total_distance_to_reverse != INVALID_EDGE_WEIGHT)
{
BOOST_ASSERT(target_phantom.reverse_node_id != SPECIAL_NODEID);
BOOST_ASSERT(target_phantom.reverse_segment_id.enabled);
packed_leg_to_reverse_begin.push_back(total_packed_path_to_reverse.size());
total_packed_path_to_reverse.insert(total_packed_path_to_reverse.end(),