AStar aStar = new AStar(g, opts.getWeighting(), opts.getTraversalMode()); aStar.setApproximation(getApproximation(ASTAR, opts, g.getNodeAccess())); ra = aStar;
int currVertex = currEdge.adjNode; visitedCount++; if (isMaxVisitedNodesExceeded()) return createEmptyPath(); if (finished()) break; if (!accept(iter, currEdge.edge)) continue; prioQueueOpenSet.add(ase); updateBestPath(iter, ase, traversalId); return createEmptyPath(); return extractPath();
@Override public Path calcPath(int from, int to) { checkAlreadyRun(); to1 = to; weightApprox.setTo(to); double weightToGoal = weightApprox.approximate(from); currEdge = new AStarEntry(EdgeIterator.NO_EDGE, from, 0 + weightToGoal, 0); if (!traversalMode.isEdgeBased()) { fromMap.put(from, currEdge); } return runAlgo(); }
public AStar(Graph graph, Weighting weighting, TraversalMode tMode) { super(graph, weighting, tMode); int size = Math.min(Math.max(200, graph.getNodes() / 10), 2000); initCollections(size); BeelineWeightApproximator defaultApprox = new BeelineWeightApproximator(nodeAccess, weighting); defaultApprox.setDistanceCalc(Helper.DIST_PLANE); setApproximation(defaultApprox); }
prepare.doWork(); AStar expectedAlgo = new AStar(graph, weighting, tm); Path expectedPath = expectedAlgo.calcPath(41, 183); RoutingAlgorithm oneDirAlgoWithLandmarks = prepare.getDecoratedAlgorithm(graph, new AStar(graph, weighting, tm), opts); Path path = oneDirAlgoWithLandmarks.calcPath(41, 183); assertEquals(expectedAlgo.getVisitedNodes(), oneDirAlgoWithLandmarks.getVisitedNodes() + 142); assertEquals(expectedPath.getWeight(), path.getWeight(), .1); assertEquals(expectedPath.calcNodes(), path.calcNodes()); assertEquals(expectedAlgo.getVisitedNodes(), biDirAlgoWithLandmarks.getVisitedNodes() + 164); qGraph.lookup(fromQR, toQR); RoutingAlgorithm qGraphOneDirAlgo = prepare.getDecoratedAlgorithm(qGraph, new AStar(qGraph, weighting, tm), opts); path = qGraphOneDirAlgo.calcPath(fromQR.getClosestNode(), toQR.getClosestNode()); expectedAlgo = new AStar(qGraph, weighting, tm); expectedPath = expectedAlgo.calcPath(fromQR.getClosestNode(), toQR.getClosestNode()); assertEquals(expectedPath.getWeight(), path.getWeight(), .1); assertEquals(expectedPath.calcNodes(), path.calcNodes()); assertEquals(expectedAlgo.getVisitedNodes(), qGraphOneDirAlgo.getVisitedNodes() + 133);
@Override public RoutingAlgorithm createAlgo(Graph g, AlgorithmOptions opts) { return new AStar(g, opts.getWeighting(), traversalMode); } };
@Override public void updateBestPath(EdgeIteratorState es, SPTEntry bestEE, int currLoc) { if (g2 != null) { mg.plotEdge(g2, na.getLat(bestEE.parent.adjNode), na.getLon(bestEE.parent.adjNode), na.getLat(currLoc), na.getLon(currLoc), .8f); } super.updateBestPath(es, bestEE, currLoc); } }
public AStar(Graph graph, Weighting weighting, TraversalMode tMode) { super(graph, weighting, tMode); int size = Math.min(Math.max(200, graph.getNodes() / 10), 2000); initCollections(size); BeelineWeightApproximator defaultApprox = new BeelineWeightApproximator(nodeAccess, weighting); defaultApprox.setDistanceCalc(Helper.DIST_PLANE); setApproximation(defaultApprox); }
int currVertex = currEdge.adjNode; visitedCount++; if (isMaxVisitedNodesExceeded()) return createEmptyPath(); if (finished()) break; if (!accept(iter, currEdge.edge)) continue; prioQueueOpenSet.add(ase); updateBestPath(iter, ase, traversalId); return createEmptyPath(); return extractPath();
AStar aStar = new AStar(g, opts.getWeighting(), opts.getTraversalMode()); aStar.setApproximation(getApproximation(ASTAR, opts, g.getNodeAccess())); ra = aStar;
public AStar(Graph graph, Weighting weighting, TraversalMode tMode) { super(graph, weighting, tMode); int size = Math.min(Math.max(200, graph.getNodes() / 10), 2000); initCollections(size); BeelineWeightApproximator defaultApprox = new BeelineWeightApproximator(nodeAccess, weighting); defaultApprox.setDistanceCalc(Helper.DIST_PLANE); setApproximation(defaultApprox); }
@Override public Path calcPath(int from, int to) { checkAlreadyRun(); to1 = to; weightApprox.setTo(to); double weightToGoal = weightApprox.approximate(from); currEdge = new AStarEntry(EdgeIterator.NO_EDGE, from, 0 + weightToGoal, 0); if (!traversalMode.isEdgeBased()) { fromMap.put(from, currEdge); } return runAlgo(); }
int currVertex = currEdge.adjNode; visitedCount++; if (isMaxVisitedNodesExceeded()) return createEmptyPath(); if (finished()) break; if (!accept(iter, currEdge.edge)) continue; prioQueueOpenSet.add(ase); updateBestPath(iter, ase, traversalId); return createEmptyPath(); return extractPath();
AStar aStar = new AStar(g, opts.getWeighting(), opts.getTraversalMode()); aStar.setApproximation(getApproximation(ASTAR, opts, g.getNodeAccess())); ra = aStar;
public AStar( Graph graph, FlagEncoder encoder, Weighting weighting, TraversalMode tMode ) { super(graph, encoder, weighting, tMode); int size = Math.min(Math.max(200, graph.getNodes() / 10), 2000); initCollections(size); BeelineWeightApproximator defaultApprox = new BeelineWeightApproximator(nodeAccess, weighting); defaultApprox.setDistanceCalc(new DistancePlaneProjection()); setApproximation(defaultApprox); }
@Override public Path calcPath(int from, int to) { checkAlreadyRun(); to1 = to; weightApprox.setTo(to); double weightToGoal = weightApprox.approximate(from); currEdge = new AStarEntry(EdgeIterator.NO_EDGE, from, 0 + weightToGoal, 0); if (!traversalMode.isEdgeBased()) { fromMap.put(from, currEdge); } return runAlgo(); }
if (isMaxVisitedNodesExceeded()) return createEmptyPath(); if (finished()) break; while (iter.next()) if (!accept(iter, currEdge.edge)) continue; prioQueueOpenSet.add(ase); updateBestPath(iter, ase, traversalId); return createEmptyPath(); return extractPath();
AStar aStar = new AStar(g, opts.getFlagEncoder(), opts.getWeighting(), opts.getTraversalMode()); aStar.setApproximation(getApproximation(ASTAR, opts, g.getNodeAccess())); ra = aStar;
@Override public Path calcPath( int from, int to ) { checkAlreadyRun(); to1 = to; weightApprox.setGoalNode(to); double weightToGoal = weightApprox.approximate(from); currEdge = new AStarEntry(EdgeIterator.NO_EDGE, from, 0 + weightToGoal, 0); if (!traversalMode.isEdgeBased()) { fromMap.put(from, currEdge); } return runAlgo(); }