  Agent-based models have been extensively used to simulate the behavior of
travelers in transportation systems because they allow for realistic and
versatile modeling of interactions. However, traditional agent-based models
suffer from high computational costs and rely on tracking physical locations,
raising privacy concerns. This paper proposes an efficient formulation for the
agent-based bathtub model (AB2M) in the relative space, where each agent's
trajectory is represented by a time series of the remaining distance to its
destination. The AB2M can be understood as a microscopic model that tracks
individual trips' initiation, progression, and completion and is an exact
numerical solution of the bathtub model for generic (time-dependent) trip
distance distributions. The model can be solved for a deterministic set of
trips with a given demand pattern (defined by the start time of each trip and
its distance), or it can be used to run Monte Carlo simulations to capture the
average behavior and variation stochastic demand patterns, described by
probabilistic distributions of trip distances and departure times. To enhance
the computational efficiency, we introduce a priority queue formulation,
eliminating the need to update trip positions at each time step and allowing us
to run large-scale scenarios with millions of individual trips in seconds. We
systematically explore the scaling properties and discuss the introduction of
biases and numerical errors. The systematic exploration of scaling properties
of the modeling of individual agents in the relative space with the AB2M
further enhances its applicability to large-scale transportation systems and
opens up opportunities for studying travel time reliability, scheduling, and
mode choices.
