/** * Initializes the first node of a route. * * @param fromNode * The Node to be initialized. * @param toNode * The Node at which the route should end. * @param pendingNodes * The pending nodes so far. * @param toNode * The Node at which the route should end. * @param startTime * The time we start routing. */ @Override protected void initFromNode(final Node fromNode, final Node toNode, final double startTime, final RouterPriorityQueue<Node> pendingNodes) { AStarNodeData data = getData(fromNode); visitNode(fromNode, data, pendingNodes, startTime, 0, null); data.setExpectedRemainingCost(estimateRemainingTravelCost(fromNode, toNode)); }
/** * Estimates the remaining travel cost from fromNode to toNode using the landmarks on the network. * * @param fromNode The first node. * @param toNode The second node. * @return The travel cost when traveling between the two given nodes. */ @Override protected double estimateRemainingTravelCost(final Node fromNode, final Node toNode) { PreProcessLandmarks.LandmarksData fromRole = getPreProcessData(fromNode); PreProcessLandmarks.LandmarksData toRole = getPreProcessData(toNode); double tmpTravCost; double travCost = 0; for (int i = 0, n = this.activeLandmarkIndexes.length; i < n; i++) { tmpTravCost = estimateRemainingTravelCost(fromRole, toRole, this.activeLandmarkIndexes[i]); if (tmpTravCost > travCost) { travCost = tmpTravCost; } } tmpTravCost = super.estimateRemainingTravelCost(fromNode, toNode); if (travCost > tmpTravCost) { return travCost; } /* else */ return tmpTravCost; }
final AStarNodeData data = getData(n); if (!data.isVisited(getIterationId())) { double remainingTravelCost = estimateRemainingTravelCost(n, toNode); visitNode(n, data, pendingNodes, currTime + travelTime, currCost + travelCost, remainingTravelCost, l); return true;