Remove force-loop checks for routes with u-turns (#6858)

Each leg of a via-route supporting u-turns does not need to consider
force-loops. Negative weight checks are sufficient to prevent
incorrect results when waypoints are on the same edge.
This commit is contained in:
Michael Bell 2024-05-05 21:56:01 +01:00 committed by GitHub
parent d691af4860
commit b503e96a98
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 12 deletions

View File

@ -41,6 +41,7 @@
- FIXED: Fix adding traffic signal penalties during compression [#6419](https://github.com/Project-OSRM/osrm-backend/pull/6419) - FIXED: Fix adding traffic signal penalties during compression [#6419](https://github.com/Project-OSRM/osrm-backend/pull/6419)
- FIXED: Correctly handle compressed traffic signals. [#6724](https://github.com/Project-OSRM/osrm-backend/pull/6724) - FIXED: Correctly handle compressed traffic signals. [#6724](https://github.com/Project-OSRM/osrm-backend/pull/6724)
- FIXED: Fix bug when searching for maneuver overrides [#6739](https://github.com/Project-OSRM/osrm-backend/pull/6739) - FIXED: Fix bug when searching for maneuver overrides [#6739](https://github.com/Project-OSRM/osrm-backend/pull/6739)
- FIXED: Remove force-loop checks for routes with u-turns [#6858](https://github.com/Project-OSRM/osrm-backend/pull/6858)
- Debug tiles: - Debug tiles:
- FIXED: Ensure speed layer features have unique ids. [#6726](https://github.com/Project-OSRM/osrm-backend/pull/6726) - FIXED: Ensure speed layer features have unique ids. [#6726](https://github.com/Project-OSRM/osrm-backend/pull/6726)

View File

@ -19,8 +19,7 @@ void searchWithUTurn(SearchEngineData<Algorithm> &engine_working_data,
typename SearchEngineData<Algorithm>::QueryHeap &forward_heap, typename SearchEngineData<Algorithm>::QueryHeap &forward_heap,
typename SearchEngineData<Algorithm>::QueryHeap &reverse_heap, typename SearchEngineData<Algorithm>::QueryHeap &reverse_heap,
const PhantomEndpointCandidates &candidates, const PhantomEndpointCandidates &candidates,
const EdgeWeight &total_weight, EdgeWeight &leg_weight,
EdgeWeight &new_total_weight,
std::vector<NodeID> &leg_packed_path) std::vector<NodeID> &leg_packed_path)
{ {
forward_heap.Clear(); forward_heap.Clear();
@ -31,14 +30,14 @@ void searchWithUTurn(SearchEngineData<Algorithm> &engine_working_data,
if (source.IsValidForwardSource()) if (source.IsValidForwardSource())
{ {
forward_heap.Insert(source.forward_segment_id.id, forward_heap.Insert(source.forward_segment_id.id,
total_weight - source.GetForwardWeightPlusOffset(), EdgeWeight{0} - source.GetForwardWeightPlusOffset(),
source.forward_segment_id.id); source.forward_segment_id.id);
} }
if (source.IsValidReverseSource()) if (source.IsValidReverseSource())
{ {
forward_heap.Insert(source.reverse_segment_id.id, forward_heap.Insert(source.reverse_segment_id.id,
total_weight - source.GetReverseWeightPlusOffset(), EdgeWeight{0} - source.GetReverseWeightPlusOffset(),
source.reverse_segment_id.id); source.reverse_segment_id.id);
} }
} }
@ -62,10 +61,10 @@ void searchWithUTurn(SearchEngineData<Algorithm> &engine_working_data,
facade, facade,
forward_heap, forward_heap,
reverse_heap, reverse_heap,
new_total_weight, leg_weight,
leg_packed_path, leg_packed_path,
getForwardLoopNodes(candidates), {},
getBackwardLoopNodes(candidates), {},
candidates); candidates);
} }
@ -302,7 +301,7 @@ shortestPathWithWaypointUTurns(SearchEngineData<Algorithm> &engine_working_data,
PhantomEndpointCandidates search_candidates{waypoint_candidates[i], PhantomEndpointCandidates search_candidates{waypoint_candidates[i],
waypoint_candidates[i + 1]}; waypoint_candidates[i + 1]};
std::vector<NodeID> packed_leg; std::vector<NodeID> packed_leg;
EdgeWeight new_total_weight = INVALID_EDGE_WEIGHT; EdgeWeight leg_weight = INVALID_EDGE_WEIGHT;
// We have a valid path up to this leg // We have a valid path up to this leg
BOOST_ASSERT(total_weight != INVALID_EDGE_WEIGHT); BOOST_ASSERT(total_weight != INVALID_EDGE_WEIGHT);
@ -311,16 +310,15 @@ shortestPathWithWaypointUTurns(SearchEngineData<Algorithm> &engine_working_data,
forward_heap, forward_heap,
reverse_heap, reverse_heap,
search_candidates, search_candidates,
total_weight, leg_weight,
new_total_weight,
packed_leg); packed_leg);
if (new_total_weight == INVALID_EDGE_WEIGHT) if (leg_weight == INVALID_EDGE_WEIGHT)
return {}; return {};
packed_leg_begin.push_back(total_packed_path.size()); packed_leg_begin.push_back(total_packed_path.size());
total_packed_path.insert(total_packed_path.end(), packed_leg.begin(), packed_leg.end()); total_packed_path.insert(total_packed_path.end(), packed_leg.begin(), packed_leg.end());
total_weight = new_total_weight; total_weight += leg_weight;
}; };
// Add sentinel // Add sentinel