Skip to content

Commit

Permalink
Ignore NTT when reverse optimizing, use upstream NTT check
Browse files Browse the repository at this point in the history
  • Loading branch information
TeemuP committed Dec 19, 2018
1 parent d115ad1 commit 3d8ea1e
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions src/main/java/org/opentripplanner/routing/edgetype/StreetEdge.java
Original file line number Diff line number Diff line change
Expand Up @@ -401,18 +401,24 @@ private StateEditor doTraverse(State s0, RoutingRequest options, TraverseMode tr
s1.setBackWalkingBike(walkingBike);

/* Handle no through traffic areas. */
if (this.isNoThruTraffic()) {
// Record transition into no-through-traffic area.
if (backEdge instanceof StreetEdge && !((StreetEdge)backEdge).isNoThruTraffic()) {
s1.setEnteredNoThroughTrafficArea();
}
// If we transitioned into a no-through-traffic area at some point, check if we are exiting it.
if (s1.hasEnteredNoThroughTrafficArea()) {
boolean allEdgesThruTraffic = s1.getVertex().getOutgoing().stream()
.filter(se -> se instanceof StreetEdge)
.allMatch(se -> !((StreetEdge) se).isNoThruTraffic());

if (allEdgesThruTraffic) return null;
if (!s0.getReverseOptimizing()) {
if (this.isNoThruTraffic()) {
// Record transition into no-through-traffic area.
if (backEdge instanceof StreetEdge && !((StreetEdge) backEdge).isNoThruTraffic()) {
s1.setEnteredNoThroughTrafficArea();
}
// If we transitioned into a no-through-traffic area at some point, check if we are exiting it.
if (s1.hasEnteredNoThroughTrafficArea()) {
// Only Edges are marked as no-thru, but really we need to avoid creating dominant, pruned states
// on thru _Vertices_. This could certainly be improved somehow.
for (StreetEdge se : Iterables.filter(s1.getVertex().getOutgoing(), StreetEdge.class)) {
if (!se.isNoThruTraffic()) {

// This vertex has at least one through-traffic edge. We can't dominate it with a no-thru state.
return null;
}
}
}
}
}

Expand Down Expand Up @@ -613,7 +619,7 @@ private void writeObject(ObjectOutputStream out) throws IOException {
public String toString() {
return "StreetEdge(" + getId() + ", " + name + ", " + fromv + " -> " + tov
+ " length=" + this.getDistance() + " carSpeed=" + this.getCarSpeed()
+ " permission=" + this.getPermission() + " ref=" + this.getRef() + ")";
+ " permission=" + this.getPermission() + " ref=" + this.getRef() + " NTT=" + this.isNoThruTraffic() + ")";
}

@Override
Expand Down

0 comments on commit 3d8ea1e

Please sign in to comment.