RidePy: A fast and modular framework for simulating ridepooling systems

RidePy enables fast computer simulations of on-demand mobility modes such as ridehailing or ridepooling. It strongly focuses on modeling the mobility service itself, rather than its customers or the environment. Through a combination of Python, Cython and C++, it offers ease of use at high performance. Its modular design makes customization easy, while the included modules allow for a quick start.


SUMMARY
RidePy enables fast computer simulations of on-demand mobility modes such as ridehailing or ridepooling.It strongly focuses on modeling the mobility service itself, rather than its customers or the environment.Through a combination of Python [1], Cython [2] and C++ [3], it offers ease of use at high performance.Its modular design makes customization easy, while the included modules allow for a quick start.

STATEMENT OF NEED
An accelerating climate change and congested cities both call for an urgent change in the way we move [4].To reduce carbon dioxide emissions as well as the number of vehicles on the road, digitally managed on-demand mobility services such as ridehailing and ridepooling are explored in research [5,6] and on the road.Unfortunately, physically experimenting with such services for research purposes is extremely cost-and time-intensive.However, the operational properties of such systems are largely predefined in terms of the scheduling backend that manages them.This makes it possible to replace physical experiments with computer simulations, substituting virtual vehicles for actual ones and modeling the incoming mobility demand by sampling either historic requests or synthetic distributions.Another advantage of simulations is that the degree to which they represent reality may be freely adjusted.This makes it possible to both answer concrete operational questions [7][8][9][10][11][12][13] and investigate idealized system behavior, gaining deeper insights into the general properties of on-demand mobility systems [14][15][16][17][18][19].
In this context, a simulation framework should appropriately allow for vastly different system sizes and degrees of realism.The system size incorporates the number of simulated vehicles as well as the extent of the space they operate on: A small system may consist of a single vehicle serving a network of just two nodes, while an example of a large system could be a fleet of several thousand vehicles operating on the street network of a large city.The degree of realism may be varied, for example, by sampling requests from either a uniform distribution or recorded mobility demand, or by operating on a continuous Euclidean plane versus a realistic city street network.Another option is to adjust the constraints imposed, such as the time windows assigned to stops or the vehicles' seat capacities.
Finally, an on-demand mobility simulation framework should be fast, easy to use and adaptable to various applications.
A number of open-source simulation software projects are already being used to investigate on-demand mobility services.Some of them focus on microscopic modeling in realistic settings, through which concrete predictions for service operation are enabled, guiding urban planning.Prominent examples are MATSim [20], which performs agentbased simulations of individual inhabitants, and Eclipse SUMO [21], a microscopic traffic simulator.Both rely on additional packages to model on-demand mobility, such as AMODEUS [22] for MATSim and Jade [23] for SUMO.
FleetPy [24], a recently released on-demand mobility simulation, is primarily aimed at realistic modeling of the interactions between operators and users, specifically incorporating multiple operators.While its technical approach is similar to ours, integrating Python with fast Cython and C++ extensions, the project is predominantly focused on applied simulations, although its framework architecture promises to allow for adjustment of the model detail level.
Perhaps the most idealized approach is taken by the Julia [25] package RidePooling.jl[26] which was developed in support of a recent scientific contribution [17].
A very different yet interesting route is taken by MaaSSim [27], which models on-demand mobility in the realm of two-sided mobility platforms such as Uber [28] and Lyft [29].
RidePy extends this landscape by providing a universal and fast ridepooling simulation framework that is highly customizable while still being easy to use.It is focused on modeling the behavior of a vehicle fleet while covering a broad scope in terms of system size and degree of realism.

PHILOSOPHY AND USAGE
RidePy simulates flexible services based on requests, dispatchers and vehicles.The vehicles continuously move along routes defined by scheduled stops.At each stop, passengers are picked up or dropped off, leading to a change in seat occupancy aboard the vehicle.A RequestGenerator supplies requests for mobility that are submitted to the simulated service, consisting of origin and destination locations and optional constraints.A dispatcher processes these incoming requests.If a request cannot be fulfilled given the constraints (e.g., time windows, seat capacity), it is rejected upon submission.Otherwise, pick-up and drop-off stops are scheduled with a vehicle, respectively.
All individual components of the simulation framework may be customized or replaced.This includes RequestGenerators, dispatchers, and the TransportSpace which the system operates on.Examples for TransportSpaces include the continuous Euclidean plane and arbitrary weighted graphs (e.g., street networks).Several components of RidePy are implemented in both pure Python and Cython/C++.While their pure Python versions are easier to understand, debug and modify, the Cython/C++ versions make large-scale simulations tractable.
Running a RidePy simulation yields a sequence of Events.The included analytics code consumes these events and returns two extensive Pandas [30] DataFrames: stops and requests.stops contains all stops that have been visited by each vehicle, along with additional information such as the vehicles' passenger occupancy.requests similarly contains all requests that have entered the system, enriched with secondary information such as the time riders spent on the vehicle.
Additional included tooling allows for the setup, parallel execution, and analysis of simulations at different parameters (parameter scans).This includes the serialization of all simulation data in JSON format [31].
To ensure valid behavior, RidePy incorporates an extensive automated test suite [32].