@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(); }
/** * 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(); } }
final double travelCost = this.costFunction.getLinkTravelDisutility(l, currTime, this.person, this.vehicle); final AStarNodeData data = getData(n); if (!data.isVisited(getIterationId())) { double remainingTravelCost = estimateRemainingTravelCost(n, toNode); visitNode(n, data, pendingNodes, currTime + travelTime, currCost + travelCost, remainingTravelCost, l); final double nCost = data.getCost(); final double totalCost = currCost + travelCost; if (totalCost < nCost) { if (data.getPrevLink().getId().compareTo(l.getId()) > 0) { revisitNode(n, data, pendingNodes, currTime + travelTime, totalCost, l); return true;
AStarNodeData data = getData(node); PreProcessLandmarks.LandmarksData ppRole = getPreProcessData(node); double estRemTravCost = data.getExpectedRemainingCost(); double newEstRemTravCost = estimateRemainingTravelCost(ppRole, toRole, newLandmarkIndex); if (newEstRemTravCost > estRemTravCost) { Node node = nodesToBeUpdated.get(i); AStarNodeData data = getData(node); data.setExpectedRemainingCost(newEstRemTravCosts.get(i)); pendingNodes.add(node, getPriority(data));
/** * Inserts the given Node n into the pendingNodes queue and updates its time and cost information. * * @param n The Node that is revisited. * @param data The data for node. * @param pendingNodes The nodes visited and not processed yet. * @param time The time of the visit of n. * @param cost The accumulated cost at the time of the visit of n. * @param expectedRemainingCost The expected remaining travel cost when * traveling from n to the target node of the route. * @param outLink The link from which we came visiting n. */ private void visitNode(final Node n, final AStarNodeData data, final RouterPriorityQueue<Node> pendingNodes, final double time, final double cost, final double expectedRemainingCost, final Link outLink) { data.setExpectedRemainingCost(expectedRemainingCost); super.visitNode(n, data, pendingNodes, time, cost, outLink); }
/** * 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)); }
@Override protected AStarNodeData createNodeData() { return new AStarNodeData(); }