Restore the Rhythm

No buses...
Then two at once.

You follow the timetable to know when the bus should arrive. What you actually experience is the difference between that scheduled arrival and the moment the bus finally appears.

When service has no dependable rhythm, regular riders adapt through local knowledge. Visitors, occasional passengers and people returning after time away cannot.

Watch the spacing collapse

Six departures do not guarantee six evenly spaced buses.

Once buses enter the road, different travel times and stopping times reshape the intervals between them. A bus can lose time while the one behind finds a clearer road.

Scheduled
Bus10 minBus10 minBus
Observed
Bus10 minBus10 minBus

The operational problem is not only lateness. It is whether the service still has a usable rhythm.

Why headway is the right language

A headway is the time between consecutive buses. Headway deviation compares that observed gap with the planned gap. A negative signed deviation means buses are drawing closer than planned; a positive deviation means the service gap is widening.

An irregular service asks passengers to gamble with their time.

A route can exist on a map and still feel absent. Fleet presence is not the same as even service coverage.

The visitor

“The route exists. But can I rely on the next bus?”

A service that is difficult to interpret is difficult to recommend and revisit.

The occasional passenger

“I can tolerate ten minutes. I cannot plan around an unknown gap.”

Irregular spacing makes a low-frequency service feel less available.

The operator

“The buses are on the road. Why does the service still feel absent?”

The missing view is the service pattern between vehicles.

Reliability is part of whether a city feels navigable.

Geospatial analytics shows what a timetable cannot.

Drivers see the road immediately around them. Geospatial analytics connects each vehicle to the wider route, the bus ahead, the bus behind and the service pattern passengers experience.

GPS becomes operational evidence when positions are sequenced by vehicle, direction, stop and road segment.

I want to know how geospatial analytics creates usable route segments

Coordinate clustering

GPS observations are filtered by trip completeness and direction, then clustered into local route segments. Within-cluster dispersion, silhouette score, Calinski-Harabasz score and Davies-Bouldin score help compare candidate segmentations.

Geometry from eigenvalues

For each two-dimensional cluster, the ratio of the smaller covariance eigenvalue to the larger one indicates departure from a nearly straight path. Bearing distributions add directional evidence for straight roads, curves and junctions.

Segment-level travel time

Distance and velocity produce a travel-time estimate for each small segment. These local contributions are accumulated between stops, letting the analysis identify where spacing changes rather than assigning the whole effect to the route.

Data-quality controls

Outlier GPS points, sparse trajectories, trips covering too little of the route and observations with uncertain stop matching must be filtered or flagged. Segmentation quality is a prerequisite for reliable headway decomposition.

The same final deviation can have different causes.

Preserve the sign of each contribution. Travel and dwell effects can reinforce or cancel one another, so diagnosis must precede intervention.

Signed cumulative deviation−2 min

The following bus is two minutes closer than planned.

2 minutes of opposing effects cancel out.
I want to see how the spacing is calculated

δHm = δL1 + Σ δTr + Σ δDk

Initial lateness, route-segment travel differences and stop dwell differences are accumulated as signed quantities. Take the absolute value only when reporting the final deviation magnitude. Taking separate absolute values first would erase cancellation and can overstate the result.

Initial departure difference

The dispatch point supplies the starting condition. Separating it from later route effects prevents origin delay from being confused with road or stop behaviour.

Travel-time contribution

Each route segment contributes the difference between the front and following bus travel times. Position, distance, velocity and direction locate that contribution geographically.

Dwell-time contribution

Arrival and departure evidence estimates how long each bus serves a stop. Differences accumulate and may either widen the gap or allow the following bus to catch up.

Cancellation

A positive road contribution can offset a negative dwell contribution. The signs must remain intact until the cumulative deviation has been calculated.

Investigate the full mathematical reasoning in Maths.pdf →

A route average says rhythm was lost. Geography says where.

A daily average can hide repeated spacing collapse near one junction, stop or slow segment. Read the route in smaller spatial units.

Direction → City centre08:00 to 09:00
Segments 05 to 06Repeated travel-time contribution near the junction
Median deviationSegment contributionDirectionTime of dayRepeated pattern
Let’s investigate why location matters

Route segmentation assigns travel-time differences to smaller geographic units. Position, bearing, speed and stop dwell can then be interpreted in road context rather than collapsed into a single route-wide value.

I want to know how the BiLSTM predicts what happens next

The advocated forecasting model is a bidirectional long short-term memory network with multi-head attention. It learns sequential travel and dwell patterns across the route, while the geospatial features tell the model where each change occurred.

1Clean GPS sequence
2Geospatial segment features
3KNN and inverse-distance imputation
4Stacked BiLSTM
5Multi-head attention
6Headway forecast by stop and segment

Inputs

Ordered position, route segment, stop sequence, speed, bearing, travel time, dwell time, current headway, scheduled headway, direction and time features. Weather or event variables can be added when reliable data exists.

Why BiLSTM

It models non-linear sequential dependence without requiring a separate linear model for every stop. Forward and backward context can be used inside a fixed observed sequence during model training and reconstruction.

Why attention

Multiple attention heads learn which earlier stops, road segments and timing conditions are most informative for the current prediction. Attention weights support investigation, but they are not proof of causality.

Missing data

K-nearest-neighbour imputation with inverse-distance weighting offers a fast local estimate for sparse GPS sequences. MICE is a heavier alternative when compute and richer covariates are available.

Training

Use walk-forward validation, route and direction specific splits, dropout, early stopping and versioned preprocessing. Positional normalisation can help the network model progression through the route while respecting ordered arrivals.

Evaluation

Compare MAE and RMSE with a historical median, timetable and persistence baseline. Evaluate by route, direction, demand period and forecast horizon, then monitor drift after deployment.

Important limitation: a BiLSTM recommendation is only as reliable as its GPS coverage, stop matching and operating data. It supports dispatch judgement. It does not establish operational certainty.

More buses do not automatically create better spacing.

Dispatch is a control decision, not merely a bus count.

Gap continues to grow

The buses bunch. The rear interval remains unserved.

Without intervention, a local loss of spacing becomes a passenger-facing gap.

Diagnose first. Dispatch second.

The goal is even service, within real constraints.

Reduce headway deviation without ignoring passenger waiting, fleet limits and the cost of intervention.

Regularity

Keep observed gaps close to the target gap.

Passenger impact

Reduce prolonged unserved intervals, not only average lateness.

Feasibility

Respect vehicle availability, turnaround and dispatch limits.

Efficiency

Compare additional cost with the expected service benefit.

I want to understand the dispatch objective

minπ wHJH(π) + wWJW(π) + wBJB(π) + wCJC(π)

This is a proposed decision-support framing, not a validated optimiser from the project. The terms represent headway deviation, passenger waiting, severe bunching and intervention cost. A deployable policy requires measured demand, fleet availability, turnaround rules and calibrated weights.

Candidate policy

A policy specifies whether to hold, release or add a bus, and when that action occurs. Candidate policies are evaluated over a forecast horizon rather than chosen from the current gap alone.

Constraints

Fleet availability, driver availability, minimum and maximum headway, terminal capacity, turnaround time and service obligations define the feasible set.

Uncertainty

Sensitivity analysis should vary model errors, demand, travel time and intervention cost. A robust recommendation remains useful across a credible range of inputs.

Decision rule

The selected intervention should improve severe gaps without creating new bunching elsewhere. Operators receive the expected benefit, required resources and conditions that could invalidate the result.

Before changing the road, test the decision.

This instructional simulator uses transparent example values. It does not claim to reproduce measured operations or issue an automatic command.

Scenario inputs

Instructional scenario result

Select inputs, then test a dispatch.

Longest gap18 min
Mean deviation8 min
Bunching events1
Extra buses0

Why

The current gap is wider than the target and one pair is already close together.

What could invalidate it

No driver availability, terminal congestion, temporary road recovery or inaccurate passenger-demand estimates.

The recommendation is a scenario result, not an automatic command.

The road can change faster than the model.

A usable recommendation remains conditional on information that may be late, incomplete or unavailable.

ObserveWhere spacing is failing
ExplainWhich segment or stop contributed
ProjectWhat happens without action
RecommendA feasible intervention
AuthoriseOperational judgement

Statistics narrows the decision. Operations authorises it.

Show me the assumptions behind the recommendation
  • GPS and stop matching may be incomplete or approximate.
  • Passenger demand is not directly measured in this instructional page.
  • Vehicle, driver and terminal availability must be verified.
  • Disruptions, weather and route recovery can alter the projection.
  • Any real deployment requires validation against operator data.

Give every passenger a service they can understand.

Geospatial analytics makes the service visible as a system. It shows where buses are, how the spacing changes and where an intervention may restore a usable rhythm.

Measure the gap. Understand the cause. Test the dispatch.