  Urban traffic congestion remains a persistent issue for cities worldwide.
Recent macroscopic models have adopted a mathematically well-defined relation
between network flow and density to characterize traffic states over an urban
region. Despite advances in these models, capturing the complex dynamics of
urban traffic congestion requires considering the heterogeneous characteristics
of trips. Classic macroscopic models, e.g., bottleneck and bathtub models and
their extensions, have attempted to account for these characteristics, such as
trip-length distribution and desired arrival times. However, they often make
assumptions that fall short of reflecting real-world conditions. To address
this, generalized bathtub models were recently proposed, introducing a new
state variable to capture any distribution of remaining trip lengths. This
study builds upon this work to formulate and solve the social optimum, a
solution minimizing the sum of all users' generalized (i.e., social and
monetary) costs for a departure time choice model. The proposed framework can
accommodate any distribution for desired arrival time and trip length, making
it more adaptable to the diverse array of trip characteristics in an urban
setting. In addition, the existence of the solution is proven, and the proposed
solution method calculates the social optimum analytically. The numerical
results show that the method is computationally efficient. The proposed
methodology is validated on the real test case of Lyon North City, benchmarking
with deterministic and stochastic user equilibria.
