protected void updateBestPath(EdgeIteratorState edgeState, SPTEntry entry, int traversalId, boolean reverse) { SPTEntry entryOther = bestWeightMapOther.get(traversalId); if (entryOther == null) return; // update μ double weight = entry.getWeightOfVisitedPath() + entryOther.getWeightOfVisitedPath(); if (traversalMode.isEdgeBased()) { if (entryOther.edge != entry.edge) throw new IllegalStateException("cannot happen for edge based execution of " + getName()); if (entryOther.adjNode != entry.adjNode) { // prevents the path to contain the edge at the meeting point twice and subtracts the weight (excluding turn weight => no previous edge) entry = entry.getParent(); weight -= weighting.calcWeight(edgeState, reverse, EdgeIterator.NO_EDGE); } else if (!traversalMode.hasUTurnSupport()) // we detected a u-turn at meeting point, skip if not supported return; } if (weight < bestPath.getWeight()) { bestPath.setSwitchToFrom(reverse); bestPath.setSPTEntry(entry); bestPath.setSPTEntryTo(entryOther); bestPath.setWeight(weight); } }
public void updateBestPath(EdgeIteratorState edgeState, AStarEntry entryCurrent, int currLoc) { AStarEntry entryOther = bestWeightMapOther.get(currLoc); if (entryOther == null) return; boolean reverse = bestWeightMapFrom == bestWeightMapOther; // update μ double newWeight = entryCurrent.weightOfVisitedPath + entryOther.weightOfVisitedPath; if (traversalMode.isEdgeBased()) { if (entryOther.edge != entryCurrent.edge) throw new IllegalStateException("cannot happen for edge based execution of " + getName()); // see DijkstraBidirectionRef if (entryOther.adjNode != entryCurrent.adjNode) { entryCurrent = (AStar.AStarEntry) entryCurrent.parent; newWeight -= weighting.calcWeight(edgeState, reverse, EdgeIterator.NO_EDGE); } else if (!traversalMode.hasUTurnSupport()) // we detected a u-turn at meeting point, skip if not supported return; } if (newWeight < bestPath.getWeight()) { bestPath.setSwitchToFrom(reverse); bestPath.sptEntry = entryCurrent; bestPath.edgeTo = entryOther; bestPath.setWeight(newWeight); } }
bestPath.sptEntry = entryCurrent; bestPath.edgeTo = entryOther; bestPath.setWeight(newWeight);
@Override protected void updateBestPath(EdgeIteratorState edgeState, SPTEntry entryCurrent, int traversalId) { SPTEntry entryOther = bestWeightMapOther.get(traversalId); if (entryOther == null) return; boolean reverse = bestWeightMapFrom == bestWeightMapOther; // update μ double newWeight = entryCurrent.weight + entryOther.weight; if (traversalMode.isEdgeBased()) { if (entryOther.edge != entryCurrent.edge) throw new IllegalStateException("cannot happen for edge based execution of " + getName()); if (entryOther.adjNode != entryCurrent.adjNode) { // prevents the path to contain the edge at the meeting point twice and subtract the weight (excluding turn weight => no previous edge) entryCurrent = entryCurrent.parent; newWeight -= weighting.calcWeight(edgeState, reverse, EdgeIterator.NO_EDGE); } else if (!traversalMode.hasUTurnSupport()) // we detected a u-turn at meeting point, skip if not supported return; } if (newWeight < bestPath.getWeight()) { bestPath.setSwitchToFrom(reverse); bestPath.setSPTEntry(entryCurrent); bestPath.setWeight(newWeight); bestPath.setSPTEntryTo(entryOther); } }
bestPath.setWeight(newWeight); bestPath.setSPTEntryTo(entryOther);
protected void updateBestPath(EdgeIteratorState edgeState, SPTEntry entry, int traversalId, boolean reverse) { SPTEntry entryOther = bestWeightMapOther.get(traversalId); if (entryOther == null) return; // update μ double weight = entry.getWeightOfVisitedPath() + entryOther.getWeightOfVisitedPath(); if (traversalMode.isEdgeBased()) { if (entryOther.edge != entry.edge) throw new IllegalStateException("cannot happen for edge based execution of " + getName()); if (entryOther.adjNode != entry.adjNode) { // prevents the path to contain the edge at the meeting point twice and subtracts the weight (excluding turn weight => no previous edge) entry = entry.getParent(); weight -= weighting.calcWeight(edgeState, reverse, EdgeIterator.NO_EDGE); } else if (!traversalMode.hasUTurnSupport()) // we detected a u-turn at meeting point, skip if not supported return; } if (weight < bestPath.getWeight()) { bestPath.setSwitchToFrom(reverse); bestPath.setSPTEntry(entry); bestPath.setSPTEntryTo(entryOther); bestPath.setWeight(weight); } }