@Test public void testShortestPathLimit() { createExampleGraph(); DijkstraOneToMany algo = new DijkstraOneToMany(graph, weighting, traversalMode); setMaxLevelOnAllNodes(); algo.setEdgeFilter(createIgnoreNodeFilter(0)); algo.setWeightLimit(2); int endNode = algo.findEndNode(4, 1); // did not reach endNode assertNotEquals(1, endNode); }
prepareAlgo.setWeightLimit(existingDirectWeight); prepareAlgo.setMaxVisitedNodes(maxVisitedNodes); prepareAlgo.setEdgeFilter(ignoreNodeFilter.setAvoidNode(sch.getNode()));
@Test public void testWeightLimit_issue380() { GraphHopperStorage graph = createGHStorage(false); initGraphWeightLimit(graph); DijkstraOneToMany algo = (DijkstraOneToMany) createAlgo(graph); algo.setWeightLimit(3); Path p = algo.calcPath(0, 4); assertTrue(p.isFound()); assertEquals(3.0, p.getWeight(), 1e-6); algo = (DijkstraOneToMany) createAlgo(graph); p = algo.calcPath(0, 3); assertTrue(p.isFound()); assertEquals(3.0, p.getWeight(), 1e-6); }
@Test public void testShortestPathSkipNode2() { createExampleGraph(); final double normalDist = new Dijkstra(graph, weighting, traversalMode).calcPath(4, 2).getDistance(); assertEquals(3, normalDist, 1e-5); DijkstraOneToMany algo = new DijkstraOneToMany(graph, weighting, traversalMode); setMaxLevelOnAllNodes(); algo.setEdgeFilter(createIgnoreNodeFilter(3)); algo.setWeightLimit(10); int nodeEntry = algo.findEndNode(4, 2); assertEquals(4, algo.getWeight(nodeEntry), 1e-5); nodeEntry = algo.findEndNode(4, 1); assertEquals(4, algo.getWeight(nodeEntry), 1e-5); }
@Test public void testShortestPathSkipNode() { createExampleGraph(); final double normalDist = new Dijkstra(graph, weighting, traversalMode).calcPath(4, 2).getDistance(); DijkstraOneToMany algo = new DijkstraOneToMany(graph, weighting, traversalMode); CHGraph lg = graph.getGraph(CHGraph.class); setMaxLevelOnAllNodes(); algo.setEdgeFilter(createIgnoreNodeFilter(3)); algo.setWeightLimit(100); int nodeEntry = algo.findEndNode(4, 2); assertTrue(algo.getWeight(nodeEntry) > normalDist); algo.clear(); algo.setMaxVisitedNodes(1); nodeEntry = algo.findEndNode(4, 2); assertEquals(-1, nodeEntry); }
prepareAlgo.setWeightLimit(existingDirectWeight); prepareAlgo.setMaxVisitedNodes((int) meanDegree * 100); prepareAlgo.setEdgeFilter(ignoreNodeFilter.setAvoidNode(sch.getNode()));
prepareAlgo.setWeightLimit(existingDirectWeight); prepareAlgo.setMaxVisitedNodes((int) meanDegree * 100); prepareAlgo.setEdgeFilter(ignoreNodeFilter.setAvoidNode(sch.getNode()));
prepareAlgo.setWeightLimit(existingDirectWeight); prepareAlgo.setMaxVisitedNodes(maxVisitedNodes); prepareAlgo.setEdgeFilter(ignoreNodeFilter.setAvoidNode(sch.getNode()));