NodeBasedNodeContractor(CHGraph prepareGraph, Weighting weighting, PMap pMap) { super(prepareGraph, weighting); this.prepareWeighting = new PreparationWeighting(weighting); extractParams(pMap); }
@Override public String toString() { return getName(); } }
double incomingEdgeWeight = prepareWeighting.calcWeight(incomingEdges, true, EdgeIterator.NO_EDGE); int incomingEdge = incomingEdges.getEdge(); int inOrigEdgeCount = getOrigEdgeCount(incomingEdge); double existingDirectWeight = incomingEdgeWeight + prepareWeighting.calcWeight(outgoingEdges, false, incomingEdges.getEdge()); if (Double.isNaN(existingDirectWeight)) throw new IllegalStateException("Weighting should never return NaN values"
private void initFromGraph() { FlagEncoder prepareFlagEncoder = prepareWeighting.getFlagEncoder(); final EdgeFilter allFilter = DefaultEdgeFilter.allEdges(prepareFlagEncoder); maxLevel = prepareGraph.getNodes(); vehicleAllExplorer = prepareGraph.createEdgeExplorer(allFilter); vehicleAllTmpExplorer = prepareGraph.createEdgeExplorer(allFilter); // Use an alternative to PriorityQueue as it has some advantages: // 1. Gets automatically smaller if less entries are stored => less total RAM used. // Important because Graph is increasing until the end. // 2. is slightly faster // but we need the additional oldPriorities array to keep the old value which is necessary for the update method sortedNodes = new GHTreeMapComposed(); oldPriorities = new float[prepareGraph.getNodes()]; nodeContractor = new NodeBasedNodeContractor(prepareGraph, weighting, pMap); nodeContractor.initFromGraph(); }
continue; if (sc.weight >= prepareWeighting.calcWeight(iter, false, EdgeIterator.NO_EDGE)) {
private void initFromGraph() { ghStorage.freeze(); FlagEncoder prepareFlagEncoder = prepareWeighting.getFlagEncoder(); final EdgeFilter allFilter = DefaultEdgeFilter.allEdges(prepareFlagEncoder); maxLevel = prepareGraph.getNodes(); vehicleAllExplorer = prepareGraph.createEdgeExplorer(allFilter); vehicleAllTmpExplorer = prepareGraph.createEdgeExplorer(allFilter); // Use an alternative to PriorityQueue as it has some advantages: // 1. Gets automatically smaller if less entries are stored => less total RAM used. // Important because Graph is increasing until the end. // 2. is slightly faster // but we need the additional oldPriorities array to keep the old value which is necessary for the update method sortedNodes = new GHTreeMapComposed(); oldPriorities = new float[prepareGraph.getNodes()]; nodeContractor = new NodeBasedNodeContractor(dir, ghStorage, prepareGraph, weighting, pMap); nodeContractor.initFromGraph(); }
public PrepareContractionHierarchies(CHGraph chGraph, Weighting weighting, TraversalMode traversalMode) { this.prepareGraph = chGraph; this.traversalMode = traversalMode; this.weighting = weighting; prepareWeighting = new PreparationWeighting(weighting); this.params = Params.forTraversalMode(traversalMode); }
@Override public boolean matches(HintsMap map) { return getName().equals(map.getWeighting()) && userWeighting.getFlagEncoder().toString().equals(map.getVehicle()); }
double v_u_weight = prepareWeighting.calcWeight(incomingEdges, true, EdgeIterator.NO_EDGE); int skippedEdge1 = incomingEdges.getEdge(); int incomingEdgeOrigCount = getOrigEdgeCount(skippedEdge1); double existingDirectWeight = v_u_weight + prepareWeighting.calcWeight(outgoingEdges, false, incomingEdges.getEdge()); if (Double.isNaN(existingDirectWeight)) throw new IllegalStateException("Weighting should never return NaN values"
PrepareContractionHierarchies initFromGraph() { ghStorage.freeze(); maxEdgesCount = ghStorage.getAllEdges().getMaxId(); FlagEncoder prepareFlagEncoder = prepareWeighting.getFlagEncoder(); vehicleInExplorer = prepareGraph.createEdgeExplorer(new DefaultEdgeFilter(prepareFlagEncoder, true, false)); vehicleOutExplorer = prepareGraph.createEdgeExplorer(new DefaultEdgeFilter(prepareFlagEncoder, false, true));
@Override public RoutingAlgorithm createAlgo(Graph g, AlgorithmOptions opts) { // doable but ugly Weighting w = ((PrepareContractionHierarchies) tmpFactory).getWeighting(); return new TmpAlgo(g, new PreparationWeighting(w), TraversalMode.NODE_BASED, mg). setEdgeFilter(new LevelEdgeFilter((CHGraph) routingGraph)); } };
@Override public String toString() { return getName(); } }
double v_u_weight = prepareWeighting.calcWeight(incomingEdges, true, EdgeIterator.NO_EDGE); int skippedEdge1 = incomingEdges.getEdge(); int incomingEdgeOrigCount = getOrigEdgeCount(skippedEdge1); double existingDirectWeight = v_u_weight + prepareWeighting.calcWeight(outgoingEdges, false, incomingEdges.getEdge()); if (Double.isNaN(existingDirectWeight)) throw new IllegalStateException("Weighting should never return NaN values"
NodeBasedNodeContractor(Directory dir, GraphHopperStorage ghStorage, CHGraph prepareGraph, Weighting weighting, PMap pMap) { super(dir, ghStorage, prepareGraph, weighting); this.prepareWeighting = new PreparationWeighting(weighting); extractParams(pMap); }
@Override public String toString() { return getName(); } }
double incomingEdgeWeight = prepareWeighting.calcWeight(incomingEdges, true, EdgeIterator.NO_EDGE); int incomingEdge = incomingEdges.getEdge(); int inOrigEdgeCount = getOrigEdgeCount(incomingEdge); double existingDirectWeight = incomingEdgeWeight + prepareWeighting.calcWeight(outgoingEdges, false, incomingEdges.getEdge()); if (Double.isNaN(existingDirectWeight)) throw new IllegalStateException("Weighting should never return NaN values"
public PrepareContractionHierarchies(Directory dir, GraphHopperStorage ghStorage, CHGraph chGraph, TraversalMode traversalMode) { this.dir = dir; this.ghStorage = ghStorage; this.prepareGraph = (CHGraphImpl) chGraph; this.traversalMode = traversalMode; this.weighting = ((CHGraphImpl) chGraph).getWeighting(); prepareWeighting = new PreparationWeighting(weighting); this.params = Params.forTraversalMode(traversalMode); }
@Override public String toString() { return getName(); }
if (sc.weight >= prepareWeighting.calcWeight(iter, false, EdgeIterator.NO_EDGE)) continue NEXT_SC;
public PrepareContractionHierarchies(Directory dir, GraphHopperStorage ghStorage, CHGraph chGraph, Weighting weighting, TraversalMode traversalMode) { this.ghStorage = ghStorage; this.prepareGraph = (CHGraphImpl) chGraph; this.traversalMode = traversalMode; levelFilter = new LevelEdgeFilter(prepareGraph); prepareWeighting = new PreparationWeighting(weighting); originalEdges = dir.find("original_edges_" + AbstractWeighting.weightingToFileName(weighting)); originalEdges.create(1000); }