Skip to content

Commit

Permalink
alternative route: bug fix for when using turn costs
Browse files Browse the repository at this point in the history
  • Loading branch information
karussell committed Apr 18, 2024
1 parent 251684e commit df92c15
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ public boolean apply(final int traversalId, final SPTEntry fromSPTEntry) {
return true;

// (1) skip too long paths
final double weight = fromSPTEntry.getWeightOfVisitedPath() + toSPTEntry.getWeightOfVisitedPath();
final double weight = fromSPTEntry.getWeightOfVisitedPath() + toSPTEntry.getWeightOfVisitedPath()
+ weighting.calcTurnWeight(fromSPTEntry.edge, fromSPTEntry.adjNode, toSPTEntry.edge);
if (weight > maxWeight)
return true;

Expand Down Expand Up @@ -341,7 +342,7 @@ public boolean apply(final int traversalId, final SPTEntry fromSPTEntry) {

Collections.sort(alternatives, ALT_COMPARATOR);
if (alternatives.get(0) != bestAlt)
throw new IllegalStateException("best path should be always first entry");
throw new IllegalStateException("best path should be always first entry " + bestAlt.path.getWeight() + " vs " + alternatives.get(0).path.getWeight());

if (alternatives.size() > maxPaths)
alternatives.subList(maxPaths, alternatives.size()).clear();
Expand Down

0 comments on commit df92c15

Please sign in to comment.