Efficiency and irreversibility of movements in a city

We know that maximal efficiency in physical systems is attained by reversible processes. It is then interesting to see how irreversibility affects efficiency in other systems, e.g., in a city. In this study, we focus on a cyclic process of movements (home to workplace and back to home) in a city to investigate the above question. To this end, we present a minimal model of the movements, along with plausible definitions for the efficiency and irreversibility of the process; more precisely, we take the inverse of the total travel time per number of trips for efficiency and the relative entropy of the forward and backward flow distributions for the process irreversibility. We perform numerical simulations of the model for reasonable choices of the population distribution, the mobility law, and the movement strategy. The results show that the efficiency of movements is indeed negatively correlated with the above measure of irreversibility. The structure of the network and the impact of the flows on the travel times are the main factors here that affect the time intervals of arriving to destinations and returning to origins, which are usually larger than the time interval of the departures. This in turn gives rise to diverging of the backward flows from the forward ones and results to entropy (disorder or uncertainty) production in the system. The findings of this study might be helpful in characterizing more accurately the city efficiency and in better understanding of the main working principles of these complex systems.

comparing the total travel time of the individuals with the total number of necessary travels along the edges of the network, which is expected to represent the total cost of the movements 24 . The connectivity structure of the city and its population and work-places distribution, the flux of movements and travel strategies, are among the main factors that affect the above efficiency. Here, however, we are interested in possible relations with the irreversibility of the process. Let us assume that all the origin to destination (OD) movements start in a small time interval ΔT o . The people would arrive at the work places in a time interval ΔT d which is expected to be larger than ΔT o . Here, ΔT d is the time interval in which all arrivals happen. Two main reasons are at work here: the network structure and the flow dynamics. There are for example many shortest OD paths in the network which span a finite range of travel times even in the absence of intensive flows on the edges. In addition, the flows affect the travel times and even for two paths of the same length, the actual travel times could be very different because of differences in the flows. The same reasoning says that the time interval of returning back to home ΔT r should be larger than the destination time interval. This mechanism is responsible for entropy production by increasing the uncertainty in the system and raising the cost (time or energy) we need to bring the system back to its initial state.
Now suppose that → f and  f represent the (average) flow distributions (on edges) for the forward (OD) and backward (DO) processes, respectively. The backward process is defined by reversing all the origin to destination trips. Then a measure of irreversibility can be defined by the distance or divergence of the two distributions  → D f f ( ) || . As mentioned above, the destination to origin trips are distributed in a destination time interval ΔT d that is usually larger than the origin time interval ΔT o . As a result, the DO travel times and flows are not necessarily the same as the OD ones. These asymmetries results to differences in the forward and backward flows and contribute to the irreversibility of the process. The above arguments suggest that a measure of irreversibility can be defined by the relative entropy of the forward and backward flow distributions or the relative entropy of the time intervals at the endpoints of the process. In the following, we present and study a minimal model of cyclic movements to make the above concepts and relations more quantitative.

Models and Settings
In this section, we present the main definitions and methods which are used to model the network flow dynamics. Consider a city of N sites with local populations {m a : a = 1, …, N} and total population M = ∑ a m a . The connectivity graph of the city is given by G(V, E) where V is the set of sites and E is the set of edges. We use the simple growth model introduced in ref. 17 to produce reasonable population distributions for the model cities: start with an active seed of population m seed in the centre of a two-dimensional grid with undirected edges of unite length; A site is active if it has a nonzero population. At each time step, one node a is selected with probability proportional to m a + c 0 where c 0 > 0. The population at site a increases by one if there is an active site b close to site a, that is |x b − x a | ≤ r 0 or |y b − y a | ≤ r 0 for some small r 0 . Here (x a , y a ) are the coordinates of site a. The above process is repeated for 10 6 iterations, where each iteration consists of N time steps. This model has been used to describe the scaling relations that are dependent on the profile of population in city 17 . Moreover, the qualitative behaviours of the model are not sensitive to the precise values of the parameters m seed , c 0 and r 0 . Given the population distribution m a , we need a mobility law to construct the flux of movements m a→b from origins a to destinations b. Note that we do not need to have a direct connection from a to b. There are many works that try to reproduce the observed movements in cities by a simple mobility law [25][26][27][28][29] . For instance, the generalized gravity law states that m a→b is proportional to m m r / a b ab α for two sites at distance r ab . In this study, we use the following mobility law 27 : where M(r ab ) is the population in the circle of radius r ab centred at site b. The ratio m b /M(r ab ) can be interpreted as the attractiveness of site b for an individual at site a. This model and the related generalizations are able to reproduce well the empirical data. Finally, the flows F ab of movements on edges (ab) ∈ E are determined by a flux distribution problem that satisfies the system constraints and preferences. For instance, the flows can be obtained by minimizing the total travel time subject to the movements m a→b 30,31 . Here, instead, we use a more local and selfish strategy, where the movements from origin a to destination b go through the shortest-time path connecting the two nodes. The path is defined as the one that takes the minimum time based on the expected travel times for each edge of the network. The expected times can be obtained in a learning process using the history of the actual travel times.
Later in this section, we shall define a measure of efficiency focusing on the total travel time and the total number of trips. There are measures of transport or commuting efficiency defined in the literature addressing different aspects of the movements 20,32-36 . The route factor and its generalizations compare the topological distances in the network with the geometrical distances 33,35 . The excess commuting index on the other hand concerns with distribution of home and work places and compares the actual commuting distances with a theoretical optimal one 32,34 . Finally, the accessibility of a city can be quantified by the velocity and sociability scores defined in 36 . Each of these measures focuses on some structural or dynamical properties of the network and the commuting process. In this study, we are specifically interested in the efficiency of the process of movements concerning the travel times and the number of necessary trips (cost of travels).
The movement process. We are interested in a cycle of movements from origins to destinations and back to the origins. This is the basic motif of movement patterns in a city [37][38][39][40] . Let us assume that we are given the population distribution m a and the fluxes m a→b . Then, a cycle of the movement process is defined as follows: • The starting times of the OD trips are distributed (with a given probability measure) in a time interval ΔT o .
• The transport services run at time intervals Δt = 1to carry the passengers in n o = ⌈ΔT o /Δt⌉ time steps.
• We obtain the flows F ab (t) at each time step t using a flow dynamics. Here F ab (t) is the number of people moving on edge (ab) in time step t. A simple strategy is to choose the shortest paths according to the expected times t ab  , which are estimated from the previous cycles. For the initial cycle , where the t ab (0) are the travel times for free lines.
• Given the flows, then the actual travel times are obtained from ab ab ab ab ab ab is to model the influence of flows on the travel times 41,42 . The nonnegative parameters g and μ control the above effect. Here F ab (0) is a measure of the line capacity. Note that in general t ba (0) ≠ t ab (0) and F ba (0) ≠ F ab (0), for example, because of structural asymmetries.
• The passengers return to their origin after spending time T w at their destinations. Thus, the return times are distributed in the time interval ΔT r according to the arrival times. Figure 1(panels a and b) gives an illustration of the above process with the associated time intervals for the trips from one origin to a destination. The relevant quantities here are the total travel time and the total number of active transport services (the cost or number of trips): Here ∑ (ab) denotes a sum over all directed edges of the connectivity graph G. The indicator function . www.nature.com/scientificreports www.nature.com/scientificreports/ Note that both the number of trips and the travel times are minimized if: (i) the OD and DO trips occur in one time step (ΔT o , ΔT d ≃ Δt) and (ii) the expected travel times t ab  are close to the actual travel times (g → 0). To define a measure of irreversibility, we first define the average forward and backward distributions Here w od (t) and w do (t) are the fraction of OD and DO movements at time step t, respectively. More precisely, w od (t) = (∑ a ∑ b m a→b (t))∕M, and recall that starting time of the movements m a→b are distributed in Similarly we define the fractions w do (t) for the DO trips. The normalization factors are F(t) = ∑ (ab) F ab (t). Note that the backward flow f ab on directed edge (ab) is defined by the flows F ba on the edge (ba) for the DO trips. Then, the Kullback-Leibler (KL) divergence or the relative entropy of the two probability distributions is given by The KL divergence is nonnegative and it is zero only when the two distributions are the same.
Another measure of entropy production in the process can be defined by considering the expansion of the time intervals ΔT d and ΔT r with respect to the ΔT o . To quantify this we define the relative entropy of the time intervals ΔS T = ΔS OD + ΔS DO , where

Results
We take a two-dimensional grid of N = L × L sites for G(V, E) with connectivity z = 4 and links of length one. The population distribution (m a ) is constructed by simulation of the growth model described in Sec. II with parameters m seed = 1, c 0 = 1, r 0 = 1. For a real city, the network structure G and population distribution are provided by the available data from 43,44 (see Supplemental Fig. 1 for an example). The OD mobilities are obtained by Eq. 1. Given the expected travel times t ab  , the flows F ab are determined by the shortest path (in time) strategy. We shall assume that the starting time of the OD trips in the time interval ΔT o obeys a centred Gaussian distribution of standard deviation ΔT o /3. The actual travel times are computed by Eq. 2 with F ab (0) = F ba (0) = M/(2|E|). We also assume that t ab (0) = t ba (0) = 1 for all directed edges in G. Therefore, there is no structural asymmetry in the model. We consider a learning process in which the expected travel times are updated by using the information about the actual travel times in the previous cycle. More precisely, for cycle n we take ab ab ab , with λ = 1/2 as a damping parameter and . This means that the expected travel times for the next round are the average of the actual and expected times in the previous round. In other words, we are trying to find a good estimation of the travel times by slowly correcting the expected values according to the new observations. We repeat the cycle for n c = 20 times and report the results at the end of this process.
We first check the behaviour of the proposed observables (D KL , ΔS T , η) with the parameters of the model (g, μ, ΔT o ). Two observables measure the irreversibility of the process: the KL divergence (D KL ) and the relative entropy (ΔS T ). The KL divergence is divided by E ln (2 ) to be able to compare it for different city sizes. The third observable measures the efficiency of the process (η). The parameters of the model that we consider are the time window of starting the OD trips (ΔT o ) and the two variables, μ and g, which control the capacity of the lines (the influence of flows on the travel times). In Fig. 2 the results obtained by the simulated population distributions are shown. The D KL and ΔS T increase with the parameter g for the given values of μ = 1, 2 (Fig. 2, panel a). Instead, the same two quantities decrease when ΔT o increases (Fig. 2, panel b). In our interpretation, this means that the entropy production or irreversibility of the process increases when the line capacity decreases, and it decreases by enlarging the time window of the OD trips (ΔT o ). Instead, the efficiency of the movement process (η) decreases when the capacity of the lines decreases (Fig. 2, panel c) and it increases when ΔT o is widened (Fig. 2, panel d). The same dependence of the quantities D KL , ΔS T , η on the parameters g, μ is observed when the population distributions of 20 real cities is used (Fig. 3). Figure 4 displays the dependence of η on the D KL (panel a) and ΔS T (panel b) when both the parameters g ∈ (0, 2) and μ ∈ (0, 3) are varied for a fixed ΔT o = 32. The observed behaviours, which are obtained from real population distributions, can well be described by an exponential relation η β ∝ − D exp( ) KL , with exponent β = 19.3 ± 1.8. Similar behaviour is also observed with the simulated population distributions (Supplemental Figs. 2-4). For comparison, in Fig. 4 (panel c and panel d) we also show the results obtained with no learning, that is without any knowledge of the actual travel times in the previous cycles. Note that the learning process dose not necessarily increase the system efficiency η, because the aim of learning here is just to find the shortest (time) path. Moreover, as the figure shows, the learning process considerably changes the behaviour of the efficiency with the KL divergence. The relation with the relative entropy ΔS T , by contrast, does not qualitatively change by the learning process. The latter solely measures the changes in the size of the time intervals ΔT d and ΔT r which usually grow by increasing g or ΔT o . On the other hand, the KL divergence is affected by both the size of the time intervals and the distribution of the arrival times in these intervals. The destination time interval ΔT d plays a central role in this study; the network structure and the impact of the forward flows on the travel times (Eq. 2) usually give rise to a large ΔT d (larger than ΔT o ). An extreme example is the case that all the OD trips start at the same time. And the size of ΔT d directly affects the divergence of the backward flows from the forward ones. Here, both the forward and backward travel times T OD , T DO are expected to increase with ΔT d (see Supplemental Fig. 5).
Finally, we studied the cumulative distribution of the simulated OD times T OD , the normalized flows f ab , and the destination time intervals (across the sites), for the core parts of the cities (Supplemental Fig. 6). Interestingly, here we observe a tendency to exhibit scale free behaviours by introducing the impact of the flows on the travel times. Note that distribution of the arrival times in ΔT d is by definition similar to that of T OD . Moreover, distribution of the actual travel times t ab is related to that of flows f ab after Eq.  www.nature.com/scientificreports www.nature.com/scientificreports/

Conclusion
We observed that reasonable definitions of efficiency and irreversibility are negatively correlated in a plausible model of movements in a city. It means that by reducing the process irreversibility one can indirectly enhance the movement efficiency. For the numerical simulation of the process, we used models that try to reproduce the main features of actual population distributions and mobility fluxes. We also used real population distributions of some real cities to compute the associated efficiency and irreversibility from the above model of movements. An empirical estimation of these quantities however needs more detailed information about the forward and backward flows, the travel times and the number of necessary trips.
One should see how much the results of this study are robust to change in definitions of the efficiency and irreversibility. Specifically, other measures of entropy production can be studied within the framework of stochastic thermodynamics 23 . Also, it would be interesting to see how these quantities are related to the system criticality and predictability [45][46][47] . The measures we introduced here are suited for the process of movements in the city. One could have such measures of efficiency and entropy production for other processes happening in a city, and so for the whole city. As already mentioned, the main task here is to find out if the negative correlation between the efficiency and irreversibility is a working principle of the cities.

Data availability
The datasets generated during and/or analysed during the current study are available from the corresponding author on reasonable request.