{'fraction_non_alphanumeric': 0.046782614709034956, 'fraction_numerical': 0.011548701635489782, 'mean_word_length': 4.210232390560259, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Comparing comparisons between vehicular traffic states in microscopic and macroscopic first-order models

In this paper we deal with the analysis of the solutions of traffic flow models at multiple scales, both in the case of a single road and of road networks. We are especially interested in measuring the distance between traffic states (as they result from the mathematical modeling) and investigating whether these distances are somehow preserved passing from the microscopic to the macroscopic scale. By means of both theoretical and numerical investigations, we show that, on a single road, the notion of Wasserstein distance fully catches the human perception of distance independently of the scale, while in the case of networks it partially loses its nice properties.


INTRODUCTION
In this paper we deal with the analysis of the solutions of traffic flow models at multiple scales. More precisely, we are interested in measuring the distance between traffic states (as they result from the mathematical modeling) and investigating whether these distances are somehow preserved passing from the microscopic to the macroscopic scale. We will consider both the case of a single road and of road networks.
Connections between microscopic (agent-based) and macroscopic (fluid-dynamics) traffic flow models are already well established. Aw et al. 1 , Greenberg 2 , and Di Francesco et al. 3 investigated the many-particle limit in the framework of second-order traffic models, deriving the macroscopic ARZ 4,5 model from a particular second-order microscopic FtL 6,7 model. Instead Colombo and Rossi, 8 Rossi,9 Di Francesco and Rosini, 10 and Di Francesco et al. 11 investigated the many-particle limit in the framework of first-order traffic models, deriving the LWR 12,13 model as the limit of a specific first-order FtL model. Let us also mention the papers by Forcadel et al., 14 Forcadel and Salazar 15 which investigate the many-particle limit exploiting the link between conservation laws and Hamilton-Jacobi equations.
Moving to road networks, analogous connections are rarer. This is probably due to the fact that macroscopic traffic models on networks are in general ill-posed, since the conservation of the mass is not sufficient alone to characterize a unique solution at junctions. This ambiguity makes more difficult to find the right limit of the microscopic model, which, in turn, can be defined in different ways near the junctions. In this context let us mention the paper by Cristiani and Sahu 16 which investigates the manyparticle limit of a first-order FtL model suitably extended to a road network. The corresponding macroscopic model appears to be the extension of the LWR model on networks introduced by Hilliges and Weidlich 17 and then extensively studied by Briani and Cristiani 18 and Bretti et al. 19 This paper focuses in particular on the comparison of solutions to the equations associated to first-order traffic models. It is useful to note here that many problems require the comparison of traffic states, or, in other words, the computation of the "distance" between two vehicle arrangements (at microscopic scale) or vehicle density distributions (at macroscopic scale). For example, • Theoretical study of scalar conservation laws.
• Sensitivity analysis (quantifying how the uncertainty in the outputs of a model can be apportioned to different sources of uncertainty in the inputs).
• Convergence of the numerical schemes (verifying that the numerical solution is close to the exact solution).
• Calibration (finding the values of the parameters for the predicted outputs to be as close as possible to the observed ones).
• Validation (checking if the outputs are close to the observed ones).
The question arises as to which notion of distance is the more appropriate in our context. Regarding conservation laws, which are the foundations of macroscopic models like LWR and ARZ, it is nowadays quite established that -distances are inadequate for comparing solutions, i.e. vehicular density functions, since they lead to results which can mismatch the human perception of physical distance. 20, Sect. 7.1, 21 For example, the -distance between two density functions ♭ and ♯ with equal total mass ∫ ℝ ♭ = ∫ ℝ ♯ = 1 and disjoint supports is equal to 2, regardless how "far" the masses are. A notion of distance which instead better matches the intuition is that of Wasserstein distance (also known as ′ -norm, earth mover's distance,̄ -metric, Mallows distance), which is able to quantify the effort needed to transport a certain amount of mass for a certain distance. Unfortunately, a mere application of the Wasserstein distance in a microscopic framework would only be meaningful under the assumptions that vehicles are indistinguishable and interchangeable, which of course do not hold true (ask drivers).
In this paper we study some distances between microscopic and macroscopic traffic states, which are actually usable in the context of traffic flow. Then we investigate under which assumptions they coincide and we study their behavior as the number of vehicles goes to infinity, in order to catch their scale-preserving properties.
The paper is organized as follows. In Section 2 we present the main ingredients of our investigations, i.e. the microscopic FtL model, the macroscopic LWR model, and the limit relation between the two models (on a single road and on road networks). We also recall the definition of Wasserstein distance. For all of these notions, references for numerical approximation are given. In Section 3 we introduce the definition of some distance functions particularly suitable for comparing traffic states at micro-and macro-scale. In Section 4 we investigate from the theoretical and numerical point of view the relations between the previously introduced distance functions in the case of a single road. In Section 5 we replicate the analysis of Section 4 on a road network. Finally, in Section 6 we sketch some conclusions.

Many-particle limit on a single road
Let us assume that vehicles move on a single infinite road with a single lane, and that they cannot overtake each other.

FtL model
Adopting a microscopic point of view, we assume that we are able to track the position of every single vehicle on the road. Moreover, we assume that the dynamics of each vehicle depend only on the vehicle itself and the vehicle in front of it, so that, in a cascade, the whole traffic flow is determined by the dynamics of the very first vehicle, termed the leader.
We denote by ∈ ℕ the number of vehicles and by > 0 their length (equal for all vehicles). We also denote by ( ) the position of (the barycenter of) the -th vehicle and we assume that at the initial time = 0 vehicles are labeled in order, i.e. 1 (0) < 2 (0) < … < (0). This guarantees that the ( + 1)-th car is just in front of the -th one. Moreover, it is assumed that at = 0 cars do not overlap, i.e. +1 (0) − (0) ≥ , = 1, … , − 1. We are now ready to introduce the model, described by the following system of ODEs where max > 0 is the maximal admissible velocity and , which represents the velocity of the vehicles, is such that Note that the -th vehicle is the leader and it moves at maximal velocity. In the following we will denote by = ( 1 , … , ) the solution to (1), duly complemented with initial conditions.

Numerical approximation
System (1) will be numerically integrated by means of the explicit Euler scheme.

LWR model
Adopting a macroscopic point of view, we assume that we are able to track only averaged quantities like the velocity and the density (number of vehicles per length unit). Hereafter, we will assume without loss of generality that the density is normalized, i.e. = 0 corresponds to the minimal density (empty road) and = 1 corresponds to the maximal density (fully congested road). The well known LWR 12,13 model describes the evolution of the density of vehicles by means of the following conservation law Here the unknown function ( , ) represents the density at time > 0 and point ∈ ℝ, while gives the velocity as a function of the density, and must be specified to complete the model. We assume that ∈ 1 ([0, 1]; [0, max ]) is any function such that A typical simple choice often used for theoretical investigations, and that we will employ in the rest of the paper, is

Numerical approximation
The conservation law (3) will be numerically solved by means of the classical Godunov scheme for the LWR model, as described, e.g., in the paper by Bretti et al. 22

Relation between scales
In order to study the many-particle limit of the FtL model described above, the number of vehicles must be no longer considered as a model parameter, rather it has to be seen as a scale parameter which goes to +∞. From the physical point of view, the quantity which is actually preserved is the total length (or mass)  > 0 of vehicles. We translate this fact by setting This relation is crucial for the micro-to-macro limit since it translates the fact that the total length does not change when the number of vehicles tends to infinity, because vehicles "shrink" accordingly. In order to recall precisely the results about the correspondence between the two models, we need to introduce first the natural spaces for the macroscopic density and for the vectors of vehicles' positions = ( 1 , … , ), at any fixed time. We define where spt( ) denotes the support of any function , and We also introduce the operators ∶ → and ∶ → , defined respectively as and where is the indicator function of any subset ⊂ ℝ. The discretization operator acts on a macroscopic density ( , ⋅), providing a vector of positions ( ) = [ ( , ⋅)] whose components partition the support of the density into segments on which has fixed integral , see Fig. 1 (left). On the contrary, the operator antidiscretizes a microscopic vector of positions , giving a piecewise constant density ( , ⋅) = [ ( )], see Fig. 1 (right).

FIGURE 1 Operators (left) and (right).
We are now ready to state the main result about the convergence of the microscopic model (1) to the macroscopic model (3). The proof can be found in Di Francesco and Rosini 10 (see also Colombo and Rossi 8 ). Remark 1. Relationship (9) between the velocities makes the link between the microscopic and the macroscopic model. Assumption ′ < 0 in (4) assures that the function is increasing, as expected.

Remark 2.
Under the same assumptions of Theorem 1, it is guaranteed 10, Lemma 1 that provided the same non-overlapping condition holds at time = 0.

Many-particle limit on networks
Let us consider the case of a road network. We define a road network  as a directed graph consisting of a finite set of vertexes (junctions) and a set of oriented edges (roads) connecting the vertexes. Edges have a positive length and they are provided with a coordinate system. We assume that for each junction J , there exist disjoint subsets INC(J), OUT(J), representing, respectively, the incoming roads to J and the outgoing roads from J. Among junctions, we distinguish two particular subsets consisting of origins , which are the junctions J such that INC(J) = ∅, and destinations , which are the junctions J such that OUT(J) = ∅. To our purposes, it is convenient to understand the network as an union of paths. More precisely, let us consider all the possible paths on  one can obtain joining all the origin nodes in  with all the destination nodes in , see Fig. 2 . Each path is considered as a single uninterrupted road, with no junctions (except for its origin and destination). Note that paths can share some arcs of the network. Finally, let us denote by the total number of paths.

FtL model
Let us divide the vehicles in populations, on the basis of the path they are following. Let us denote by , = 1, … , , the number of vehicles following path (we have ∑ =1 = ), and label univocally all vehicles by the multi-index ( , ), = 1, … , , = 1, … , . Let us also denote by , ( ) the position of the vehicle of population at time , defined as the distance from the origin of the path (not from the origin of the current road). Since paths can overlap, a vehicle ( , ) belonging to a population ≠ with position , ( ) can be found along path at time . Let us denote by ( , , ) the distance between the vehicle ( , ) at time and the origin of path , along path . In other words acts as a change of coordinates between any path ≠ intersecting path and the path . The function is trivially extended to vehicles already belonging to population simply setting ( , , ) = , ( ).
In such a path-based framework the vehicle + 1 is no longer necessarily in front of vehicle . This force us to introduce a new notation to refer to the vehicle in front. First, we define NEXT( , , ) as the multi-index of the nearest vehicle (any population) ahead of the vehicle ( , ) along the path at time (setting it to ∅ if there is no such a vehicle). Then we define, for any nonleader vehicle of any population, It is important to note that , is in general discontinuous because at any time other vehicles can join or leave the -th vehicle's path, thus reducing or increasing abruptly the distance , (or even changing the leader/follower status of the -th vehicle). An immediate consequence of this fact is that the non-overlapping condition (10) is no longer guaranteed, even if it holds at the initial time = 0. Nevertheless, the number of overlapping vehicles is bounded by max J |INC(J)| which is finite (and usually very low), therefore this issue has no impact in the many-particle limit (see Cristiani and Sahu 16 for details).
In order to handle this issue we extend the function defined in (2) by means of a new function * defined as i.e. we assume that (smashed) vehicles closer than from the vehicle in front stops completely until the vehicle in front leaves a space > , then they re-start moving normally.
We are now ready to introduce the model, described by the following system of coupled systems of ODEs with discontinuous right-hand side (see Cristiani and Sahu 16 for details) for any = 1, … , . In the following we will denote by the vector ( 1, , … , , ) for all = 1, … , , and by the vector ( 1 , … , ).

Numerical approximation
System (12) will be numerically integrated by means of the explicit Euler scheme, duly extended to manage the junctions as in Cristiani and Sahu. 16

LWR model
Many methods were proposed in the literature to extend the LWR model on networks. This task is not completely trivial since the conservation of the mass is not sufficient alone to characterize a unique solution at junctions. As a consequence, macroscopic traffic models on networks are in general ill-posed unless additional conditions are imposed. A complete introduction to the field can be found in the book by Garavello and Piccoli. 23 Beside the classical method 24 based on the maximization of the flux at junctions, let us also mention the source-destination model, 25 the buffer models, 26,27,28 and the path-based model. 18,19 The last one is based on the path-based interpretation of the network introduced above and consists of a system of conservation laws with discontinuous flux where is the density of vehicles following path and is the total density (all vehicles). For coherence with equation (11), we employ here the extended velocity * defined as

Numerical approximation
The system of conservation laws (13) will be numerically solved by means of a Godunov-based scheme introduced by Bretti et al., 19 Briani and Cristiani, 18 and successively used in other related papers. 16,21

Relation between scales
Recalling the definitions given in Sect. 2.1.3, we can state the main result about the convergence of the microscopic model (12) to the macroscopic model (13). The proof can be found in Cristiani and Sahu. 16 Note that the correspondence in the limit is only proved path by path, i.e. fixing and assuming the other solutions to be given. This is different from considering the convergence of the fully coupled system of ODEs to the system of PDEs, which is, to our knowledge, still an open problem.

Wasserstein distance
Let us denote by ( , ) a complete and separable metric space with distance , and by ( ) a Borel -algebra of ( , ). Let us also denote by  + ( ) the set of non-negative finite Radon measures on ( , ( )). Let ♭ and ♯ be two Radon measures in  + ( ) such that ♭ ( ) = ♯ ( ).
Remark 3. The measures ♭ and ♯ can be either absolutely continuous or singular with respect to the Lebesgue measure.
It is well known that the notion of Wasserstein distance can be put in relation with the Monge-Kantorovich optimal mass transfer problem: 29 a pile of, say, soil, has to be moved to an excavation with same total volume. Moving a unit quantity of mass has a cost which equals the distance between the source and the destination point. We consequently are looking for a way to rearrange the first mass onto the second which requires minimum cost. In and, for ≥ 1, Equation (17) translates the fundamental property of monotone rearrangement of the mass, 30,Rem. 2.19 i.e. the optimal strategy consists in transferring the mass starting from the left, see Fig. 3 .

Numerical approximation
Numerical approximation of the Wasserstein distance is easy in the particular case = ℝ 1 and ( , ) = | − |, since quadrature formulas can be easily employed in (16) or (17).
The case of more general spaces, including networks embedded in ℝ 2 , is more difficult. Typically the problem is solved by reformulating it in a fully discrete setting as a Linear Programming problem. The interested reader can find in the books by Santambrogio 31, Sec. 6.4.1 and Sinha 32, Chap. 19 the complete procedure, recently used also in the context of traffic flow. 21 More sophisticated characterizations based on a fluid-dynamic approach, 33 -Laplacian, 34 or a variational approach 34 are also available.

COMPARING TRAFFIC STATES IN MACROSCOPIC AND MICROSCOPIC MODELS
In this paper we are mainly concerned with the measure of the "distance" between two traffic states, i.e. we want to quantify to what extent two traffic states are close to each other. For example, if we run a traffic model in a real application, we would like to measure how close the solution of the model is to the measured traffic state.
In the rest of the paper we will put ourself in the context of sensitivity analysis, broadly following Briani et al. 21 Let us assume to have run both the microscopic and macroscopic model twice, with different initial conditions or model parameters. Doing so, at final time = we end up with two different traffic scenarios to be compared. In the microscopic case we will have two vectors ♭ ( ) and ♯ ( ), while in the macroscopic case we will have two density distributions ♭ ( , ⋅) and ♯ ( , ⋅).
Before specializing the discussion on a specific scale, let us introduce a suitable notion of distance on the road network. We will denote by   ( , ), , ∈  , the distance between two points and on the network  , defined as the length of the shortest path (in the Euclidean sense) on  joining and . Note that the distance   can be numerically computed by means of, e.g., the Dijkstra algorithm. 35

Comparing vehicle positions
In the microscopic framework each vehicle is uniquely labeled, and its position is known exactly. This means that we can compare two traffic scenarios (vehicle arrangements) comparing the position of each vehicle in each scenario.
That said, it is natural to define the distance between any two microscopic traffic states ♭ , ♯ ∈ ℝ as (on a single road), These definitions translate the fact that the two traffic states are regarded as "close" if each vehicle is approximately in the same position in the two scenarios. The distance is then proportional to the effort one should make in order to move each vehicle from the position occupied in the run ♭ to the position occupied in the run ♯. Note that the movement can only happen along the network, but it must not necessarily respect road rules like road directions, priorities, traffic lights, etc.; cf. Briani et al. 21 It is useful to note that the Wasserstein distance can also be used to compute the distance between vectors ♭ and ♯ , obtaining Doing this, we implicitly allow the possibility of exchange vehicles from one scenario to another since the optimal transport plan * ∈ Γ not necessarily moves vehicle (resp., ( , )) into vehicle (resp., ( , )) as we assume instead in (18)- (19). This is is easily confirmed by the following characterization 30, Introduction valid in the discrete case, where  is the set of permutation in {1, 2, … , }. We will show in Sect. 4 that the two distances defined in (18) and (20) actually coincide in the framework of traffic flow models considered in this paper, but this is not the case, in general, for the distances (19) and (21).

Comparing traffic densities
In the macroscopic framework we are not able to distinguish single vehicles, then we have to compare vehicle densities as a whole. To do that, we can follow in a broad sense the same ideas described in the microscopic framework, quantifying the effort one has to make in order to rearrange all the mass from the first scenario (mass density distribution ♭ ) to the second one (mass density distribution ♯ ). Since there are infinite ways to rearrange the mass moving an elementary particle of mass ( ) at a time, one should look at the "cheapest" one, in terms of a cost function to be suitably defined. Contrary to the microscopic setting, in the macroscopic setting the Wasserstein distance is exactly what we are looking for, thanks to the well known relation with the optimal mass transfer problem, see Section 2.3. Therefore, we simply define where the measure [ ], for ∈ 1 , is the unique measure such that where either = ℝ, ( , ) = | − | (single road) or =  , ( , ) =   ( , ) (road network).

Analytical results
We have the following result.
Proof. For the sake of readability, from now on we will omit the dependence on time .
Let us first recall here the crucial fact that the FtL model does not allow overtaking, thus, for any < , we have ♭ < ♭ +1 and ♯ < ♯ +1 ∀ = 1, … , − 1, see Remark 2. Let us also note that, sincē ♭ ,̄ ♯ ∈ , we have ∫ ℝ̄ because ♭ and ♯ are defined by two vectors ♭ , ♯ of the same size through the operators and .
be the measures defined as in (23). By definition, they are absolutely continuous with respect to the Lebesgue measure. Moreover, by (28) we have ∫ ℝ ♭ = ∫ ℝ ♭ = . Therefore it applies the property of monotone rearrangement (see Section 2.3) which states that the measure ♭ is optimally transported onto ♯ by the map * ∶ ℝ → ℝ such that Moreover, we have It is useful to note here that (6), (8) and (10) imply ♭ > 0 in the interval [ ♭ 1 , ♭ ) and ♯ > 0 in the interval [ ♯ 1 , ♯ ). Therefore the function * is uniquely determined in the interval ( ♭ 1 , ♭ ), in the sense that for any ∈ ( ♭ 1 , ♭ ) there exists a unique value of * ( ) such that (29) holds. Outside the interval this is no longer true. For example, if = ♭ 1 we have ∫ Doing this, we also have which is a natural fact considering that outside spt( ♯ ) there is no mass to move to.

FIGURE 4
Optimal mass transport map * from ♭ into ♯ .
(ii) We divide the proof in three steps.
By construction, we have that ♭ , ♯ are bounded by 1 for any , , . Moreover, Therefore the dominated convergence theorem allows us to write and then by (27) and (28) we easily get (33).
(ii.B) Applying again the property of monotone rearrangement to [ ♭ ] and [ ♯ ] we get that there exists a map * ∶ ℝ → ℝ such that As in (30), this is the optimal transport map which allows to compute the distance between the two density functions, i.e.
Note that the functions ♭ , ♯ , being solutions to (3) with initial data satisfying (26) Indeed, at the leftmost boundary of the support the solution is that of a Riemann problem with left state = 0 and right state ∈ [ min , 1], which produces a shock with positive or null velocity. As a consequence, the leftmost boundary of the support remains fixed or moves to the right. At the rightmost boundary of the support the solution is that of a Riemann problem with left state ∈ [ min , 1] and right state = 0, which produces a rarefaction fan. Again, the rightmost limit of the support is simply moved to the right (with velocity ( ( ))| =0 = (0) = max ) and the solution remains strictly positive inside the rarefaction fan. Sufficiently far from the extremes of the support, i.e. where the two Riemann problems described above do not influence the solution, the result follows by the basic monotonicity property of the solution to conservation laws, 36, Theor. 6.2.3 which states that the solution remains bounded at any time by the same values which bound the initial datum.
Now we want to prove that lim →+∞ * = * for a.e. ∈ spt( ♭ ). Let us first prove that { * } is a Cauchy sequence, then the limit exists. After that, we will prove that the limit is indeed a function which satisfies (36).
(ii.C) Let us now define the auxiliary positive function ∶ ℝ → ℝ by where the second equality follows from the part (i) of the proof. Then it remains to prove that Let us first show that there exists ∶ ℝ → ℝ such that To this end, choose anȳ ∈ ℝ and > 1. We have four cases: Noting that cases 1 and 4 are trivial, case 3 disappears for → +∞, and, in case 2, * → * and ♭ →̄ for → +∞, we can apply same results as in Theorem 1 (which makes it rigorous the fundamental limit relation ♭ +1 − ♭ → ♭ (̄ )) and we easily get (43).
Let us now prove that ≤ for some ∈ 1 (ℝ) for all . This comes from the fact that ♭ +1 − ♭ ≤ 1 (see Remark 2) and the fact that (since the mass transfer only happens where there is some mass to transfer from/into) and, in turn, ♭ , ♯ have compact support (see (34)). Finally, the dominated convergence theorem allows us to write

Numerical results
In this section we aim at confirming the theoretical results presented above from the numerical point of view. In particular, we run micro-and macro-simulations (24)- (25) with either different initial conditions or velocity functions, and then we plot the 1 2 [10,25] ( ), ∈ [0, 100].
We set max = 1, = 20, and we employ Dirichlet zero boundary conditions. Micro-simulations are run starting from the initial conditions corresponding to the density functions defined above. In Fig. 5 we plot the functions Ξ 1 and Ξ 2 . As it can be seen, the convergence to 0 is monotone and fast in both cases.
We set ♭ max = 1, ♯ max = 2, = 14, and we employ Dirichlet zero boundary conditions. Micro-simulations are run starting from the initial condition corresponding to the density function defined above. In Fig. 6 we plot the functions Ξ 1 and Ξ 2 . Again, the convergence to 0 is monotone and fast in both cases.

Analytical results
The case of a road network is subtler and more difficult to categorize. The crucial difference is that, on some networks, vehicles loose their initial order (see Section 2.2.1), and, in parallel, the Wasserstein distance does not enjoy the property of monotone rearrangement. Therefore, analytical results described in the previous section are not expected to hold, at least for a general road network. Example 1. (soft counterexample). Let us consider the case of a merge, i.e. a simple network with one junction, two incoming roads and one outgoing road. Assume that vehicles are initially located on the two incoming roads only, as shown in Fig. 7 , and that, at final time, all vehicles reach the outgoing road, merging one after the other, as shown in Fig. 9 (top). Swapping the two initial conditions on the incoming roads, see Fig. 8 , we get the solution shown in Fig. 9 (bottom). It is clear that, in this case, we have  > 0 since vehicles do not occupy the same positions in the two scenarios. At the same time, we have = 0 since, on the whole, vehicles do occupy the same positions.

Test 4 (hard counterexample)
We consider again the network of Example 1 where each road has length 30. The two shifted initial conditions are 1,♭ ( ) = [20,25]  We also set max = 1, = 55, and we employ Dirichlet zero boundary conditions. Micro-simulations are run starting from the initial conditions corresponding to the density functions defined above. In Fig. 12 we plot the function Ξ 1 at final time = . As expected, the convergence is not achieved in this case.

CONCLUSIONS
In this paper we have investigated the problem of comparing traffic states in a multiscale framework. The notion of Wasserstein distance appears totally adequate in the case of single road simulations since it matches human intuition and it is totally independent of the scale of observation. In the case of a road network, instead, the microscopic Wasserstein distance is not the right notion of distance unless we stop distinguishing single vehicles, which is exactly what happens in the many-particle limit.