public NodeData getData(final Node n) { ArrayRoutingNetworkNode routingNetworkNode = (ArrayRoutingNetworkNode) n; return this.nodeData[routingNetworkNode.getArrayIndex()]; } }
@Override public PreProcessDijkstra.DeadEndData getPreProcessData(final Node n) { return ((RoutingNetworkNode) n).getDeadEndData(); } }
/** * The value used to sort the pending nodes during routing. This implementation compares the total * estimated remaining travel cost to sort the nodes in the pending nodes queue during routing. */ @Override protected double getPriority(final DijkstraNodeData data) { return ((AStarNodeData) data).getExpectedCost(); } }
private void updateTTs(Link link, double[] tt, TravelTime travelTime, double alpha) { for (int i = 0; i < intervalCount; i++) { double oldEstimatedTT = tt[i]; double experiencedTT = travelTime.getLinkTravelTime(link, i * interval, null, null); tt[i] = alpha * experiencedTT + (1 - alpha) * oldEstimatedTT; } } }
/** * The value used to sort the pending nodes during routing. * This implementation compares the total effective travel cost * to sort the nodes in the pending nodes queue during routing. */ protected double getPriority(final DijkstraNodeData data) { return data.getCost(); }
@Override public final void initialize() { // lazy initialization if (!isInitialized) { for (Node node : this.network.getNodes().values()) { int index = ((ArrayRoutingNetworkNode) node).getArrayIndex(); this.nodeData[index] = nodeDataFactory.createNodeData(); } this.isInitialized = true; } }
@Override public Node[] identifyLandmarks( int nLandmarks, Network network ) { final LandmarkerPieSlices delegate = new LandmarkerPieSlices( nLandmarks , travelZone ); delegate.run( network ); return delegate.getLandmarks(); } }
@Override public NodeData createNodeData() { return new DijkstraNodeData(); } }
@Override public void run() { expandLandmarkFrom(); expandLandmarkTo(); }
@Override public ArrayRoutingNetworkLink createRoutingNetworkLink(Link link, RoutingNetworkNode fromNode, RoutingNetworkNode toNode) { return new ArrayRoutingNetworkLink(link, fromNode, toNode, linkArrayIndexCounter++); }
/** * @param costFunction * @param travelZone The area within which the landmarks should lie. Narrowing the zone where the landmarks should * be put normally improves the routing speed of {@link org.matsim.core.router.AStarLandmarks}. * @param landmarkCount */ public PreProcessLandmarks(final TravelDisutility costFunction, final Rectangle2D.Double travelZone, final int landmarkCount) { this( costFunction , new PieSlicesLandmarker( travelZone ), landmarkCount ); }
/** * Default constructor; sets the overdo factor to 1. * @param network Where we do the routing. * @param preProcessData The pre-process data (containing the landmarks etc.). * @param timeFunction Calculates the travel time on links. */ AStarLandmarks(final Network network, final PreProcessLandmarks preProcessData, final TravelTime timeFunction) { this(network, preProcessData, preProcessData.getCostFunction(), timeFunction, 1); }
void updateMinMaxTravelTimes() { for (int i = 0; i < this.landmarkTravelTime1.length; i++) { setTravelTimes(i, this.landmarkTravelTime2[i], this.landmarkTravelTime1[i]); } }
@Override public NodeData createNodeData() { return new AStarNodeData(); } }
/** * @return The expected total travel cost from the start * node to the target node of the route when the associated node * is on that route. */ public double getExpectedCost() { return this.expectedRemainingCost + getCost(); }
public FastMultiNodeDijkstraFactory(final boolean usePreProcessData, final boolean searchAllEndNodes) { this.usePreProcessData = usePreProcessData; this.searchAllEndNodes = searchAllEndNodes; this.routingNetworkFactory = new ArrayRoutingNetworkFactory(); }
@Override public double getLinkTravelDisutility(final Link link, final double time, final Person person, final Vehicle vehicle) { double travelTime = this.timeCalculator.getLinkTravelTime(link, time, person, vehicle); return this.marginalCostOfTime * travelTime; }
/** * The value used to sort the pending nodes during routing. * This implementation compares the total effective travel cost * to sort the nodes in the pending nodes queue during routing. */ protected double getPriority(final DijkstraNodeData data) { return data.getCost(); }
@Override public double getLinkTravelDisutility(final Link link, final double time, final Person person, final Vehicle vehicle) { return travelTime.getLinkTravelTime(link, time, person, vehicle); }
/** * The value used to sort the pending nodes during routing. * This implementation compares the total effective travel cost * to sort the nodes in the pending nodes queue during routing. */ private double getPriority(final DijkstraNodeData data) { return data.getCost(); }