Skip to content

Commit

Permalink
Technically more correct termination condition
Browse files Browse the repository at this point in the history
  • Loading branch information
michaz committed Mar 20, 2020
1 parent d9a55f8 commit c45c5a4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions core/src/main/java/com/graphhopper/routing/AlternativeRouteCH.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ public AlternativeRouteCH(RoutingCHGraph graph, PMap hints) {
localOptimalityFactor = hints.getDouble("alternative_route.local_optimality_factor", 0.25);
}

@Override
public boolean finished() {
// we need to finish BOTH searches for CH!
if (finishedFrom && finishedTo)
return true;

// changed also the final finish condition for CH
return currFrom.weight >= bestWeight * maxWeightFactor && currTo.weight >= bestWeight * maxWeightFactor;
}

List<AlternativeInfo> calcAlternatives(final int s, final int t) {
// First, do a regular bidirectional route search
checkAlreadyRun();
Expand Down

0 comments on commit c45c5a4

Please sign in to comment.