Use rectified linear unit to prevent negative duration values
This commit is contained in:
committed by
Patrick Niklaus
parent
a9d3e61884
commit
334a7b50cd
@@ -223,9 +223,11 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
|
||||
// | |---------| source_weight
|
||||
// | |---| target_weight
|
||||
const EdgeWeight weight = target_weight - source_weight;
|
||||
const EdgeWeight duration = target_duration - source_duration;
|
||||
BOOST_ASSERT(weight >= 0);
|
||||
BOOST_ASSERT(duration >= 0);
|
||||
|
||||
// use rectified linear unit function to avoid negative duration values
|
||||
// due to flooring errors in phantom snapping
|
||||
const EdgeWeight duration = std::max(0, target_duration - source_duration);
|
||||
|
||||
steps.push_back(RouteStep{source_node.name_id,
|
||||
facade.GetNameForID(source_node.name_id).to_string(),
|
||||
|
||||
Reference in New Issue
Block a user