The Gravity Model WHERE DO TRIPS GO?
The interaction between two zones is directly proportional to their sizes (Productions and Attractions) and inversely proportional to the travel impedance $c_{ij}$ between them.
Where $A_i$ and $B_j$ are balancing factors calculated via the Furness Algorithm, ensuring the matrix strictly satisfies $\sum T_{ij} = P_i$ and $\sum T_{ij} = A_j$. $K_{ij}$ represents optional socio-economic adjustment factors used to penalize or encourage specific O-D flows.
📖 Documentation
Motivation & Goal: Transport planners need to distribute total zone generation vectors into a physical spatial matrix to understand traffic patterns. The gravity model solves this by assuming individuals seek opportunities (Attractions) while minimizing effort (Impedance).
How to Calibrate the Model
Calibration is the process of finding the exact deterrence parameters ($\alpha, \beta$) that match real-world travel behavior. This lab provides three distinct calibration engines depending on your available ground-truth data:
- Target Mean Trip Cost: Use this if you only know the average commute time. You only need a Household Travel Survey that provides the Target Mean Trip Cost (e.g., "The average commute in this city is 22 minutes"). Enter your survey's mean trip time into the Target Mean Trip Cost (min). The engine uses a Bisection Search to solve for the exact $\beta$ that produces a matching Modeled Mean Cost.
- Observed Trip Length Distribution (TLD): Use this if you have a survey histogram of travel times and their relative frequencies. Paste the array as CSV data. The engine runs a 2D Grid Search to find the $\alpha$ and $\beta$ that maximize the Coincidence Ratio (overlap) between the modeled and observed curves.
- Observed O-D Matrix (Partial or Full): Use this if you have exact ground-truth traffic data (e.g., mobile GPS counts) between specific zones. You do not need a full observed O-D Matrix to calibrate. Check the "Input Observed Data" box and enter the known trips. The engine uses a 2D Grid Search to minimize the Root Mean Square Error (RMSE) against your populated cells.
How to Validate the Model
Validation proves that the spatial distribution of the matrix maps to physical reality.
- Trip Length Distribution (TLD): Check the histogram below. The Modeled TLD curve should overlap the Observed TLD curve from your surveys. The overlap percentage is called the Coincidence Ratio (Target: > 70%).
- Screenline Checks: Draw an imaginary boundary across a physical corridor (e.g., a river, highway, or railway line) in your city. Compare the assigned matrix volumes crossing that boundary against actual physical traffic counts. If the model assigns too many trips, introduce K-factors (socio-economic penalties, $K_{ij} < 1.0$) to adjust the specific O-D pairs crossing that screenline.
General Applications & Examples
- Huff Retail Location Model: Increase the Attractions ($A_j$) of a specific destination to simulate expanding a shopping center. Watch the probability matrix warp to capture customers from surrounding residential origins. (Note: This differs from Reilly's Law, which calculates deterministic geographic breaking points rather than probabilistic flows).
- Hansen's Accessibility: Modifying the network (lowering $c_{ij}$) instantly changes the integral Accessibility Index for an origin, computing how many destinations are practically reachable discounted by friction.
- Cumulative Opportunities (Opp < 15m): A concrete equity metric displaying exactly how many jobs/attractions can be reached from an origin within a rigid 15-minute isochrone boundary.
- Residential Development: Increase the Productions ($P_i$) of a specific origin to simulate building a new housing estate.
- Infrastructure Planning: Decrease an impedance cell $c_{ij}$ to simulate building a new direct highway. Watch the Accessibility Index of that origin instantly spike.
- Policy Pricing: If a city imposes a cordon toll or increases bus fares, the deterrence function steepens. Increase $\beta$ manually to simulate travelers avoiding long trips due to cost sensitivity.
1. Model Configuration
Select the boundary constraints and the impedance deterrence function.
🎯 Calibration
🎯 Calibration based on Target Mean Trip Cost
Bisection engine to solve for the exact $\beta$ required to match travel surveys using a single average commute time.
🎯 Calibration based on Observed Trip Length Distribution
Paste surveyed TLD arrays as CSV (Max Time Limit, Frequency). The engine will run a 2D Grid Search to maximize the Coincidence Ratio.
2. Physical Demand & Skim Matrix
The central grid represents the Impedance $c_{ij}$ (minutes). The rightmost column defines Productions $P_i$. The bottom row defines Attractions $A_j$. Asymmetric matrices ($M \times N$) are supported.
Results — O-D Flow Matrix $T_{ij}$
Heatmap intensity correlates to trip volume. Edge totals display achieved sums versus physical targets.
Validation — Trip Length Distribution (TLD)
Plots the spatial distribution of assigned trips against physical travel time. Essential for proving model validity.