Skip to content

Commit b2185be

Browse files
committed
Remove some unused measurement code
1 parent 63369b7 commit b2185be

File tree

2 files changed

+2
-98
lines changed

2 files changed

+2
-98
lines changed

core/src/main/java/com/graphhopper/routing/ViaRouting.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import com.graphhopper.storage.index.LocationIndex;
2828
import com.graphhopper.storage.index.QueryResult;
2929
import com.graphhopper.util.EdgeIterator;
30-
import com.graphhopper.util.EdgeIteratorState;
3130
import com.graphhopper.util.Helper;
3231
import com.graphhopper.util.shapes.GHPoint;
3332

@@ -87,13 +86,8 @@ else if (!snapPreventions.isEmpty())
8786

8887
static EdgeFilter createEdgeFilter(final Weighting weighting) {
8988
final BooleanEncodedValue accessEnc = weighting.getFlagEncoder().getAccessEnc();
90-
return new EdgeFilter() {
91-
@Override
92-
public boolean accept(EdgeIteratorState edgeState) {
93-
return edgeState.get(accessEnc) && !Double.isInfinite(weighting.calcEdgeWeight(edgeState, false))
94-
|| edgeState.getReverse(accessEnc) && !Double.isInfinite(weighting.calcEdgeWeight(edgeState, true));
95-
}
96-
};
89+
return edgeState -> edgeState.get(accessEnc) && !Double.isInfinite(weighting.calcEdgeWeight(edgeState, false))
90+
|| edgeState.getReverse(accessEnc) && !Double.isInfinite(weighting.calcEdgeWeight(edgeState, true));
9791
}
9892

9993
public static Result calcPaths(List<GHPoint> points, QueryGraph queryGraph, List<QueryResult> queryResults, BooleanEncodedValue accessEnc, PathCalculator pathCalculator, List<String> curbsides, boolean forceCurbsides, List<Double> headings, boolean passThrough) {

tools/src/main/java/com/graphhopper/tools/Measurement.java

Lines changed: 0 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@
7070

7171
import static com.graphhopper.util.Helper.*;
7272
import static com.graphhopper.util.Parameters.Algorithms.ALT_ROUTE;
73-
import static com.graphhopper.util.Parameters.Algorithms.DIJKSTRA_BI;
7473
import static com.graphhopper.util.Parameters.Routing.BLOCK_AREA;
7574

7675
/**
@@ -243,7 +242,6 @@ protected DataReader importData() throws IOException {
243242
if (hopper.getCHPreparationHandler().isEnabled()) {
244243
boolean isCH = true;
245244
boolean isLM = false;
246-
// compareCHWithAndWithoutSOD(hopper, count/5);
247245
gcAndWait();
248246
if (!hopper.getCHPreparationHandler().getNodeBasedCHConfigs().isEmpty()) {
249247
CHConfig chConfig = hopper.getCHPreparationHandler().getNodeBasedCHConfigs().get(0);
@@ -637,94 +635,6 @@ public int doCalc(boolean warmup, int run) {
637635
print("spatialrulelookup", lookupPerfTest);
638636
}
639637

640-
private void compareRouting(final GraphHopper hopper, int count) {
641-
logger.info("Comparing " + count + " routes. Differences will be printed to stderr.");
642-
String algo = Algorithms.ASTAR_BI;
643-
final Random rand = new Random(seed);
644-
final Graph g = hopper.getGraphHopperStorage();
645-
final NodeAccess na = g.getNodeAccess();
646-
647-
for (int i = 0; i < count; i++) {
648-
int from = rand.nextInt(maxNode);
649-
int to = rand.nextInt(maxNode);
650-
651-
double fromLat = na.getLatitude(from);
652-
double fromLon = na.getLongitude(from);
653-
double toLat = na.getLatitude(to);
654-
double toLon = na.getLongitude(to);
655-
GHRequest req = new GHRequest(fromLat, fromLon, toLat, toLon).
656-
setProfile("profile_no_tc").
657-
setAlgorithm(algo);
658-
659-
GHResponse lmRsp = hopper.route(req);
660-
req.putHint(Landmark.DISABLE, true);
661-
GHResponse originalRsp = hopper.route(req);
662-
663-
String locStr = " iteration " + i + ". " + fromLat + "," + fromLon + " -> " + toLat + "," + toLon;
664-
if (lmRsp.hasErrors()) {
665-
if (originalRsp.hasErrors())
666-
continue;
667-
logger.error("Error for LM but not for original response " + locStr);
668-
}
669-
670-
String infoStr = " weight:" + lmRsp.getBest().getRouteWeight() + ", original: " + originalRsp.getBest().getRouteWeight()
671-
+ " distance:" + lmRsp.getBest().getDistance() + ", original: " + originalRsp.getBest().getDistance()
672-
+ " time:" + round2(lmRsp.getBest().getTime() / 1000) + ", original: " + round2(originalRsp.getBest().getTime() / 1000)
673-
+ " points:" + lmRsp.getBest().getPoints().size() + ", original: " + originalRsp.getBest().getPoints().size();
674-
675-
if (Math.abs(1 - lmRsp.getBest().getRouteWeight() / originalRsp.getBest().getRouteWeight()) > 0.000001)
676-
logger.error("Too big weight difference for LM. " + locStr + infoStr);
677-
}
678-
}
679-
680-
private void compareCHWithAndWithoutSOD(final GraphHopper hopper, int count) {
681-
logger.info("Comparing " + count + " routes for CH with and without stall on demand." +
682-
" Differences will be printed to stderr.");
683-
final Random rand = new Random(seed);
684-
final Graph g = hopper.getGraphHopperStorage();
685-
final NodeAccess na = g.getNodeAccess();
686-
687-
for (int i = 0; i < count; i++) {
688-
int from = rand.nextInt(maxNode);
689-
int to = rand.nextInt(maxNode);
690-
691-
double fromLat = na.getLatitude(from);
692-
double fromLon = na.getLongitude(from);
693-
double toLat = na.getLatitude(to);
694-
double toLon = na.getLongitude(to);
695-
GHRequest sodReq = new GHRequest(fromLat, fromLon, toLat, toLon).
696-
setProfile("profile_no_tc").
697-
setAlgorithm(DIJKSTRA_BI);
698-
699-
GHRequest noSodReq = new GHRequest(fromLat, fromLon, toLat, toLon).
700-
setProfile("profile_no_tc").
701-
setAlgorithm(DIJKSTRA_BI);
702-
noSodReq.putHint("stall_on_demand", false);
703-
704-
GHResponse sodRsp = hopper.route(sodReq);
705-
GHResponse noSodRsp = hopper.route(noSodReq);
706-
707-
String locStr = " iteration " + i + ". " + fromLat + "," + fromLon + " -> " + toLat + "," + toLon;
708-
if (sodRsp.hasErrors()) {
709-
if (noSodRsp.hasErrors()) {
710-
logger.info("Error with and without SOD");
711-
continue;
712-
} else {
713-
logger.error("Error with SOD but not without SOD" + locStr);
714-
continue;
715-
}
716-
}
717-
String infoStr =
718-
" weight:" + noSodRsp.getBest().getRouteWeight() + ", original: " + sodRsp.getBest().getRouteWeight()
719-
+ " distance:" + noSodRsp.getBest().getDistance() + ", original: " + sodRsp.getBest().getDistance()
720-
+ " time:" + round2(noSodRsp.getBest().getTime() / 1000) + ", original: " + round2(sodRsp.getBest().getTime() / 1000)
721-
+ " points:" + noSodRsp.getBest().getPoints().size() + ", original: " + sodRsp.getBest().getPoints().size();
722-
723-
if (Math.abs(1 - noSodRsp.getBest().getRouteWeight() / sodRsp.getBest().getRouteWeight()) > 0.000001)
724-
logger.error("Too big weight difference for SOD. " + locStr + infoStr);
725-
}
726-
}
727-
728638
private void printTimeOfRouteQuery(final GraphHopper hopper, final QuerySettings querySettings) {
729639
final Graph g = hopper.getGraphHopperStorage();
730640
final AtomicLong maxDistance = new AtomicLong(0);

0 commit comments

Comments
 (0)