From c763ea2fb7926e1b608b3233b0c71639b9b5d172 Mon Sep 17 00:00:00 2001 From: Patrick Qian Date: Tue, 12 Nov 2024 17:11:28 +0100 Subject: [PATCH 1/3] fix new_cost smaller than 0 --- src/thor/timedistancebssmatrix.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/thor/timedistancebssmatrix.cc b/src/thor/timedistancebssmatrix.cc index aac7a1d4bf..88b6dd9069 100644 --- a/src/thor/timedistancebssmatrix.cc +++ b/src/thor/timedistancebssmatrix.cc @@ -463,7 +463,7 @@ bool TimeDistanceBSSMatrix::UpdateDestinations( // Subtract the partial remaining cost and distance along the edge. float remainder = dest_edge->second; Cost newcost = pred.cost() - (pedestrian_costing_->EdgeCost(edge, tile) * remainder); - if (newcost.cost < dest.best_cost.cost) { + if (newcost.cost > 0 && newcost.cost < dest.best_cost.cost) { dest.best_cost = newcost; dest.distance = pred.path_distance() - (edge->length() * remainder); } From 33de5a8f88829f18185793242af6f0a440273e41 Mon Sep 17 00:00:00 2001 From: Patrick Qian Date: Wed, 13 Nov 2024 11:13:51 +0100 Subject: [PATCH 2/3] fix in timedistancematrix.cc --- src/thor/timedistancematrix.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/thor/timedistancematrix.cc b/src/thor/timedistancematrix.cc index 3188103243..45a3d98cfd 100644 --- a/src/thor/timedistancematrix.cc +++ b/src/thor/timedistancematrix.cc @@ -518,7 +518,7 @@ bool TimeDistanceMatrix::UpdateDestinations( float remainder = dest_edge->second; Cost newcost = pred.cost() - (costing_->EdgeCost(edge, tile, time_info, flow_sources) * remainder); - if (newcost.cost < dest.best_cost.cost) { + if (newcost.cost > 0 &&newcost.cost < dest.best_cost.cost) { dest.best_cost = newcost; dest.distance = pred.path_distance() - (edge->length() * remainder); } From b5269b9795ef7e4174fdd8a7674d4a763356f3cc Mon Sep 17 00:00:00 2001 From: vgeoffroy Date: Thu, 6 Nov 2025 15:46:16 +0100 Subject: [PATCH 3/3] Fix Format --- src/thor/timedistancematrix.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/thor/timedistancematrix.cc b/src/thor/timedistancematrix.cc index 45a3d98cfd..43873706c1 100644 --- a/src/thor/timedistancematrix.cc +++ b/src/thor/timedistancematrix.cc @@ -518,7 +518,7 @@ bool TimeDistanceMatrix::UpdateDestinations( float remainder = dest_edge->second; Cost newcost = pred.cost() - (costing_->EdgeCost(edge, tile, time_info, flow_sources) * remainder); - if (newcost.cost > 0 &&newcost.cost < dest.best_cost.cost) { + if (newcost.cost > 0 && newcost.cost < dest.best_cost.cost) { dest.best_cost = newcost; dest.distance = pred.path_distance() - (edge->length() * remainder); }