public class ScheduleStatistics
extends java.lang.Object
Once all of the arrival and departure times have been processed into a map statistics is used to determine which is the best arrival/departure for the stop_times output. The goal is to use a time such that only the a desired fraction of arrivals/departures will be early. For example, if you want only 20% of the vehicle to be early with respect to the schedule time, which is reasonable because for passengers it is better for vehicles to be late rather then early so they don't miss the vehicle, then the value should be 0.2. This desiredFractionEarly value is specified when the ScheduleDataProcessor object is constructed.
The way the software tries to achieve the desiredFractionEarly is by assuming there is a Gaussian distribution of the times. By using the standard deviation of a Gaussian distribution the software estimates the value to use to such that desiredFractionEarly will be attained. Of course the distribution is not truly Gaussian. Therefore several iterations are used to adjust the value in order to get the desired results.
Note: convenient website for determining standard deviation is at http://www.mathsisfun.com/data/standard-deviation-calculator.html
Modifier and Type | Class and Description |
---|---|
static class |
ScheduleStatistics.Stats
For containing the results of processing AVL based arrival/departure
times as part of determining more accurate schedule times.
|
Constructor and Description |
---|
ScheduleStatistics() |
Modifier and Type | Method and Description |
---|---|
static void |
determineStatsForRoute(java.util.Map<ScheduleDataProcessor.TripStopKey,GtfsStopTime> originalGtfsStopTimes,
java.util.Map<ScheduleDataProcessor.TripStopKey,java.util.List<java.lang.Integer>> timesFromDbByTripStopForRouteSubMap,
java.util.Map<ScheduleDataProcessor.TripStopKey,ScheduleStatistics.Stats> statsResultsByTripStopMap,
java.lang.String routeId,
int allowableDifferenceFromMeanSecs,
int allowableDifferenceFromOriginalTimeSecs,
double desiredFractionEarly,
ArrivalDeparture.ArrivalsOrDepartures arrivalsOrDepartures)
For the route specified first determines the basic stats including the
mean and standard deviation.
|
static void |
processScheduleAdherence(java.util.Map<ScheduleDataProcessor.TripStopKey,GtfsStopTime> gtfsStopTimes,
java.util.Map<ScheduleDataProcessor.TripStopKey,ScheduleStatistics.Stats> arrivalStatsResultsByTripStopMap,
java.util.Map<ScheduleDataProcessor.TripStopKey,ScheduleStatistics.Stats> departureStatsResultsByTripStopMap,
int allowableEarlySecs,
int allowableLateSecs)
Determines and logs schedule adherence results both using the original
schedule and using the new improved schedule.
|
public static void determineStatsForRoute(java.util.Map<ScheduleDataProcessor.TripStopKey,GtfsStopTime> originalGtfsStopTimes, java.util.Map<ScheduleDataProcessor.TripStopKey,java.util.List<java.lang.Integer>> timesFromDbByTripStopForRouteSubMap, java.util.Map<ScheduleDataProcessor.TripStopKey,ScheduleStatistics.Stats> statsResultsByTripStopMap, java.lang.String routeId, int allowableDifferenceFromMeanSecs, int allowableDifferenceFromOriginalTimeSecs, double desiredFractionEarly, ArrivalDeparture.ArrivalsOrDepartures arrivalsOrDepartures)
originalGtfsStopTimes
- original data from stop_times.txt file so that can filter out
outliers. Can be null for testing. Map is keyed on trip/stops
and contains GtfsStopTimes.timesFromDbByTripStopForRouteSubMap
- the arrival/departure times for the routestatsResultsByTripStopMap
- for returning the resultsrouteId
- for loggingallowableDifferenceFromMeanSecs
- Specifies how consistent arrival/departure times from Db must
be in order to be used.allowableDifferenceFromOriginalTimeSecs
- Specifies how consistent arrival/departure times from Db must
be in order to be used.desiredFractionEarly
- Specifies the desired number of the arrival times that should
be earlyarrivalsOrDepartures
- specifies whether should handle as arrivals or departurespublic static void processScheduleAdherence(java.util.Map<ScheduleDataProcessor.TripStopKey,GtfsStopTime> gtfsStopTimes, java.util.Map<ScheduleDataProcessor.TripStopKey,ScheduleStatistics.Stats> arrivalStatsResultsByTripStopMap, java.util.Map<ScheduleDataProcessor.TripStopKey,ScheduleStatistics.Stats> departureStatsResultsByTripStopMap, int allowableEarlySecs, int allowableLateSecs)
gtfsStopTimes
- The original GtfsStopTimes read from stop_times.txt.arrivalStatsResultsByTripStopMap
- All the arrival time results. Keyed on trip/stop.departureStatsResultsByTripStopMap
- All the departure time results. Keyed on trip/stop.allowableEarlySecs
- For schedule determining adherenceallowableLateSecs
- For schedule determining adherence