Skip to content

Commit 96816a4

Browse files
committed
move board slack constant, clarify comments
1 parent e9abaa9 commit 96816a4

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

src/main/java/com/conveyal/r5/profile/FastRaptorWorker.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,6 @@ public class FastRaptorWorker {
5555
*/
5656
public static final int UNREACHED = Integer.MAX_VALUE;
5757

58-
/**
59-
* Minimum time between alighting from one vehicle and boarding another, in seconds.
60-
* TODO make this configurable, and use loop-transfers from transfers.txt.
61-
*/
62-
public static final int BOARD_SLACK_SECONDS = 60;
63-
6458
public static final int SECONDS_PER_MINUTE = 60;
6559

6660
/**
@@ -70,8 +64,10 @@ public class FastRaptorWorker {
7064
private static final int DEPARTURE_STEP_SEC = 60;
7165

7266
/**
73-
* Minimum wait for boarding to account for schedule variation.
74-
* FIXME clarify why this is separate from BOARD_SLACK. If it is not, merge the two constants into BOARD_SLACK_SEC.
67+
* To be considered for boarding, a vehicle must depart at least this long after the rider arrives at the stop.
68+
* Intuitively, "leave this long for transfers" to account for schedule variation or other unexpected variations.
69+
* This is separate from BOARD_SLACK_SECONDS used in McRaptor and point-to-point searches, in case someone needs
70+
* to set them independently.
7571
*/
7672
private static final int MINIMUM_BOARD_WAIT_SEC = 60;
7773

src/main/java/com/conveyal/r5/profile/PathWithTimes.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@
1919
* A path that also includes itineraries and bounds for all possible trips on the paths (even those which may not be optimal)
2020
*/
2121
public class PathWithTimes extends Path {
22+
23+
/**
24+
* Minimum time between alighting from one vehicle and boarding another, in seconds.
25+
* Appears to be used only in McRaptor and point-to-point searches.
26+
* TODO make this configurable, and use loop-transfers from transfers.txt.
27+
*/
28+
public static final int BOARD_SLACK_SECONDS = 60;
29+
2230
/** Stats for the entire path */
2331
public Stats stats;
2432

@@ -92,7 +100,7 @@ private void computeTimes (TransportNetwork network, ProfileRequest req, TIntInt
92100
// loop over departures within the time window
93101
// firstTrip is the trip on the first pattern
94102
int firstTrip = 0;
95-
while (times[0][firstTrip][0] < req.fromTime + accessTime + FastRaptorWorker.BOARD_SLACK_SECONDS) firstTrip++;
103+
while (times[0][firstTrip][0] < req.fromTime + accessTime + BOARD_SLACK_SECONDS) firstTrip++;
96104

97105
// now interleave times
98106
double walkSpeedMillimetersPerSecond = req.walkSpeed * 1000;
@@ -137,7 +145,7 @@ private void computeTimes (TransportNetwork network, ProfileRequest req, TIntInt
137145

138146
// TODO should board slack be applied at the origin stop? Is this done in RaptorWorker?
139147
// See also below in computeStatistics
140-
time = times[patIdx][trip][1] + transferTime + FastRaptorWorker.BOARD_SLACK_SECONDS;
148+
time = times[patIdx][trip][1] + transferTime + BOARD_SLACK_SECONDS;
141149
itin.arriveAtBoardStopTimes[patIdx + 1] = time;
142150
}
143151
}

src/main/java/com/conveyal/r5/profile/StatsCalculator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public static StatsCollection computeStatistics (ProfileRequest req, int accessT
2323

2424
for (int start = req.fromTime; start < req.toTime; start += 60) {
2525
// TODO should board slack be applied at the origin stop? Is this done in RaptorWorker?
26-
int timeAtOriginStop = start + accessTime + FastRaptorWorker.BOARD_SLACK_SECONDS;
26+
int timeAtOriginStop = start + accessTime + PathWithTimes.BOARD_SLACK_SECONDS;
2727
int bestTimeAtDestinationStop = Integer.MAX_VALUE;
2828

2929
PathWithTimes.Itinerary bestItinerary = null;

0 commit comments

Comments
 (0)