|
70 | 70 |
|
71 | 71 | import static com.graphhopper.util.Helper.*;
|
72 | 72 | import static com.graphhopper.util.Parameters.Algorithms.ALT_ROUTE;
|
73 |
| -import static com.graphhopper.util.Parameters.Algorithms.DIJKSTRA_BI; |
74 | 73 | import static com.graphhopper.util.Parameters.Routing.BLOCK_AREA;
|
75 | 74 |
|
76 | 75 | /**
|
@@ -243,7 +242,6 @@ protected DataReader importData() throws IOException {
|
243 | 242 | if (hopper.getCHPreparationHandler().isEnabled()) {
|
244 | 243 | boolean isCH = true;
|
245 | 244 | boolean isLM = false;
|
246 |
| -// compareCHWithAndWithoutSOD(hopper, count/5); |
247 | 245 | gcAndWait();
|
248 | 246 | if (!hopper.getCHPreparationHandler().getNodeBasedCHConfigs().isEmpty()) {
|
249 | 247 | CHConfig chConfig = hopper.getCHPreparationHandler().getNodeBasedCHConfigs().get(0);
|
@@ -637,94 +635,6 @@ public int doCalc(boolean warmup, int run) {
|
637 | 635 | print("spatialrulelookup", lookupPerfTest);
|
638 | 636 | }
|
639 | 637 |
|
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 |
| - |
728 | 638 | private void printTimeOfRouteQuery(final GraphHopper hopper, final QuerySettings querySettings) {
|
729 | 639 | final Graph g = hopper.getGraphHopperStorage();
|
730 | 640 | final AtomicLong maxDistance = new AtomicLong(0);
|
|
0 commit comments