{'fraction_non_alphanumeric': 0.06055412739217367, 'fraction_numerical': 0.012159791080099564, 'mean_word_length': 3.379556826304503, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 11, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Generalized Wasserstein distance and its application to transport equations with source

In this article, we generalize the Wasserstein distance to measures with different masses. We study the properties of such distance. In particular, we show that it metrizes weak convergence for tight sequences. We use this generalized Wasserstein distance to study a transport equation with source, in which both the vector field and the source depend on the measure itself. We prove existence and uniqueness of the solution to the Cauchy problem when the vector field and the source are Lipschitzian with respect to the generalized Wasserstein distance.

The main limit of the approach based on the standard Wasserstein distance is that it cannot encompass the case of a source h. Indeed, in this case the mass of the measure µ t varies in time, hence in general W p (µ t , µ s ) is not defined for t = s. Sources (and sinks) are nevertheless very interesting for models of pedestrian, for instance in the case of people entering or exiting a door. It is interesting to recall that the L 1 distance (that one could try to use, since it is defined even between two measures with different masses) is not suitable in this context, since Lipschitzianity of v with respect to µ measured in L 1 does not guarantee uniqueness (see [11]).
In this article, to deal with a source in (1), we focus on the space of Borel measures with finite mass on R d (denoted with M), that we endow with the generalized Wasserstein distance W a,b p . We also denote with M ac 0 the subspace of M of measures that are absolutely continuous with respect to the Lebesgue measure and with bounded support. In this framework, we prove existence and uniqueness of the solution of (1) with µ 0 ∈ M ac 0 under the following hypotheses: is uniformly Lipschitz and uniformly bounded, i.e. there exist L, M not depending on µ, such that for all µ ∈ M, x, y ∈ R d , • v is a Lipschitz function, i.e. there exists N such that

Remark 2
The application to pedestrian dynamics also explains the choice of the basic assumptions (H), namely that we deal with measures with bounded support.
The structure of the paper is the following. In Section 1, we define the generalized Wasserstein distance W a,b p and we prove some important properties related to that. In particular, this distance metrizes the weak topology for tight sequences. Moreover, M is complete with respect to such distance. We also compare W a,b p with other distances, like the Levy-Prokhorov distance. We then restrict ourselves to the study of W a,b p in M ac 0 and provide Gronwall-like estimates under flow action. In Section 2, we describe the complete picture for (1) under (H). We first provide a candidate solution for (1) via a semi-discrete Lagrangian scheme and using the sample-and-hold method. We then show that it is indeed a solution, and finally that it is unique.

Generalized Wasserstein distance
In this section, we define the generalized Wasserstein distance W a,b p (µ, ν) that we study in this article, and prove some useful properties. We first recall basic definitions and notations about measure theory and Wasserstein distance. For a complete introduction, see [6,16].

Notation and standard Wasserstein distance
In this section, we fix the notation that we use throughout the paper, and recall definitions and properties related to measure theory and the Wasserstein distance, like push-forward of measures γ#µ and transference plans.
Let µ be a positive Borel measure with locally finite mass. If µ 1 is absolutely continuous with respect to µ, we write µ 1 ≪ µ. If µ 1 ≪ µ and µ 1 (A) ≤ µ(A) for all Borel sets, we write µ 1 ≤ µ. Given a measure with finite mass, we denote with |µ| := µ(R d ) its norm. More in general, if µ = µ + − µ − is a signed Borel measure, we have |µ| Given two measures µ, ν, one can always write in a unique way µ = µ ac + µ s such that µ ac ≪ ν and µ s ⊥ ν, i.e. there exists B such that µ s (B) = 0 and ν(R n \ B) = 0. This is the Lebesgue's decomposition Theorem. Then, it exists a unique f ∈ L 1 (dν) such that dµ ac (x) = f (x) dν(x). Such function is called the Radon-Nikodym derivative of µ with respect to ν. We denote it with D ν µ. For more details, see e.g. [6].
Given a Borel map γ : R d → R d , one can consider the following action on a measure µ ∈ M: An evident property is that the mass of µ, i.e. µ(R d ) is identical to the mass of γ#µ.
Given two measures µ, ν with the same mass, it is thus possible to ask if there exists a γ such that ν = γ#µ. We say that γ sends µ to ν. Moreover, one can add a cost to such γ, given by . This means that each infinitesimal mass δµ is sent to δν and that its infinitesimal cost is related to the p-th power of the distance between them. The, one can consider the map γ minimizing such cost, if it exists. This is known as the Monge problem, stated by Monge in 1791.
In general, this procedure works only for special µ, ν and p. Indeed, there exist simple examples of µ, ν for which a γ that sends µ to ν does not exist. For example µ = 2δ 1 , ν = δ 0 + δ 2 on the real line have the same mass, but there exists no γ with ν = γ#µ, since γ cannot separate masses. Moreover, one can have a sequence γ n of maps such that I [γ n ] is a minimizing sequence, but the limit is not a map γ * . A simple condition that ensures the existence of a minimizing γ is that µ and ν are absolutely continuous with respect to the Lebesgue measure.
For such reason, one can generalize the problem to the following setting. Given a probability measure π on R d × R d , one can interpret it as a method to transfer a measure µ on R d to another measure on R d as follows: each infinitesimal mass on a location x is sent to a location y with a probability given by π(x, y). Formally, µ is sent to ν if the following properties hold: Such π is called a transference plan from µ to ν. We denote the set of such transference plans as Π(µ, ν). Since one usually deals with probability measures µ, ν, the terms |µ|, |ν| are usually neglected in the literature. A condition equivalent to (2) is that, for all f, g ∈ C ∞ c (R d ) it holds |µ| R d ×R d (f (x) + g(y)) dπ(x, y) = R d f (x) dµ(x) + R d g(y) dν(y). Then, one can define a cost for π as follows J [π] := R d ×R d |x − y| p dπ(x, y) and look for a minimizer of J in Π(µ, ν). Such problem is called the Monge-Kantorovich problem.
It is important to observe that such problem is a generalization of the Monge problem. Indeed, given a γ sending µ to ν, one can define a transference plan π = (Id × γ)#µ, i.e. dπ(x, y) = µ(R n ) −1 dµ(x)δ y=γ(x) . It also holds J [Id × γ] = I [γ]. The main advantages of such approach are the following: first, the existence of at least one π satisfying (2) is easy to check, since one can choose π(A × B) = |µ| −1 µ(A)ν(B), i.e. the mass from µ is proportionally split to ν. Moreover, a minimizer of J in Π(µ, ν) always exists.
A natural space in which J is finite is the space of Borel measures with finite p-moment, that is In the following, we also denote with P the space of probability measures, i.e. the measures in M with unit mass. We also deal with P p := M p ∩ P, i.e. the space of probability measures with finite p-moment. One can thus define on M p the following operator between measures of the same mass, called the Wasserstein distance: It is indeed a distance on the subspace of measures in M p with a given mass, see [16]. It is easy to prove that W p (kµ, kν) = k 1/p W p (µ, ν) for k ≥ 0, by observing that Π(kµ, kν) = Π(µ, ν) and that J [π] does not depend on the mass. We will recall some other properties all along the paper, when useful.

Definition of generalized Wasserstein distance
We are now ready to define the generalized Wasserstein distance W a,b p (µ, ν). We first give a rough description of the idea. Imagine to have three different admissible actions on µ, ν: either add/remove mass to µ, or add/remove mass to ν or transport mass from µ to ν. The three techniques have their cost: add/remove mass has a unitary cost a (in both cases); transport of mass has the classic Monge-Kantorovich cost J, multiplied by a fixed constant b. The distance is the minimal cost of a mix of such techniques. We will show in the following that, depending on µ, ν, all mixes are possible: either remove all the mass of µ and ν (if they are very far), or transport the whole µ to ν (if they have the same mass and are close enough), or a mix of the two (for example when µ and ν are very close but with different masses). Instead, we will prove that add mass is never optimal.
Remark 3 The fact that the unitary cost of adding/removing mass is identical for the two terms µ, ν is to ensure symmetry of W a,b p .
We now formally define the generalized Wasserstein distance.
Definition 4 Let M be the space of Borel measures with finite mass on R d . Then, given a, b ∈ (0, ∞) and p ≥ 1, the generalized Wasserstein distance is Proposition 5 The operator W a,b p is a distance. Moreover, one can restrict the computation in (3) tõ µ ≤ µ,ν ≤ ν and the infimum is always attained.
To prove this Proposition, we need to recall some known concepts and results related to tightness and weak convergence. For more details, see [15,16].
We first recall results about tightness. We always deal with measures on R d .
Lemma 7 The following holds: 1. A measure with finite mass is tight.

2.
A set of measures M such that all measures are bounded above by a tight measureμ is tight.
3. The union of a finite number of tight sets is tight. In particular, a finite set of measures with finite mass is tight.
Proof. The first result is proved by taking a sequence of invading compacts , as small as needed, since it is the remainder of a converging sequence.
For the second property, for each ε take K ε that gives tightness ofμ. Since µ ∈ M implies µ ≤μ, hence For the third result, take the sets M 1 , . . . , M n , each of them being tight. For each ε > 0, there exists a corresponding compact We now recall results about weak convergence and give some technical lemmas we use in the following.
Theorem 8 (Prokhorov's theorem) Let X be a Polish space. A set P in the space of probabilities P(X) is precompact for the weak topology if and only if it is tight.
We recall that R d is a Polish space (see a definition in [16]), thus Prokhorov's theorem can be applied in our setting.
Theorem 9 (Weak compactness [6]) Let µ n be a sequence of Radon measures in R d with uniformly bounded mass 1 , i.e. there exists M such that |µ k | ≤ M for all k. Then there exists a subsequence µ nj and a Radon measure µ * such that µ nj ⇀ µ * .
From now on, we denote with the asterisk µ * , c * ,... the limit (or the weak limit) of a sequence µ n , c n ,...
Proof. The weak convergence of π n means that, By uniqueness of the limit, we have the proof for the marginal µ * . Using f (x, y) = h(y), we have the same for ν * .
We are now ready to prove Proposition 5.
Another simple example permits us to show that optimal strategies can be either based on removing mass only (L 1 strategy), or on transporting mass only (W p strategy), or by a mix of them. We give an example in Figure 1. Take the measures µ, ν on the real line with densities dµ where λ is the Lebesgue measure. It is clear that the optimal strategy amounts to chooseμ,ν with densities χ [−y,0] , χ [x,x+y] respectively, for a certain parameter y ∈ [0, 1]. The L 1 strategy is given by choosing y = 0, while the W p strategy is given by y = 1. We now prove that all values of y can be optimal, depending on x and the parameters a, b, p. We have |µ −μ| = |ν −ν| = 1 − y and W p (μ,ν) = |y| 1/p (x + y). We choose for simplicity a = b = p = 1. Thus W a,b p (µ, ν) = min y∈[0,1] 2 − 2y + xy + y 2 . A simple computation shows that the minimum is attained by y = 2−x 2 if x ∈ [0, 2], and y = 0 for x ≥ 2. This clearly shows that if the measures are very close (x = 0), then the best strategy is the W p (since y = 1), while for measures that are far (x big) the best strategy is the L 1 . As stated above, varying x ∈ (0, 2) one has mixed strategies.  We now state some simple properties of W a,b p .

Topology of the generalized Wasserstein distance
In this section, we prove that W a,b p metrizes weak convergence for tight sequences. We also prove that R d is complete with respect to W a,b p . We first prove a simple lemma for W a,b p , stating that optimal choicesμ,ν are very close to each other in R d . The basic idea is that, if we want to transfer far mass betweenμ andν, then it is cheaper to remove such masses from both measures.
Proposition 12 Let µ, ν ∈ M andμ,ν be the choices realizing W a,b p (µ, ν). Ifμ has support contained in a compact K, thenν has bounded support, contained in the enlarged compact Here we denote with B(x, r) the closed ball centered in x with radius r. Similarly, letμ,ν be the choices realizing W a,b p (µ, ν), and π the transference plan realizing W p (μ,ν). Let µ ′ ≤μ have support contained in a compact K. Then the corresponding marginal ν ′ with respect to π has compact support contained in K d .
Proof. We prove the second statement, since the first can be recovered by choosing µ ′ =μ.
Theorem 13 Let {µ n } be a sequence of measures in R d , and µ n , µ ∈ M. Then W a,b p (µ n , µ) → 0 is equivalent to µ n ⇀ µ and {µ n } is tight.
Proof. Fix the following notation: for each n, letμ n ,ν n be optimal choices in (3) for W a,b p (µ n , µ) with µ n ≤ µ n ,ν n ≤ µ, and π n the transference plan realizing W p (μ n ,ν n ).
We first prove ⇐. Fix ε > 0. Let N be such that W a,b p (µ n , µ) < ε for all n > N . Since {µ n } is tight, then the set M := {µ n } ∪ {µ} is tight too. Given δ > 0, consider the corresponding K δ giving tightness of M . By definition, all m ∈ M satisfy m(R d \ K δ ) < δ. Due to weak convergence of µ n to µ, we also have µ n (K δ ) → µ(K δ ). Choose N ′ such that |µ n (K δ )| − |µ(K δ )| < ε for all n > N ′ . It means that there exists ν n (positive or negative, supported in K δ ) such that (µ n + ν n )(K δ ) = µ(K δ ). Defineμ n := (µ n + ν n ) |K δ and µ := µ |K δ . It is clear that ν n ⇀ 0, henceμ n ⇀μ. Since K δ has bounded diameter and W p metrizes weak convergence in bounded spaces (see [16, 7.12], recalled below in Theorem 14), then W p (μ n ,μ) → 0. Take N > N ′ such that W p (μ n ,μ) < δ and |ν n | < δ for all n > N . We now estimate Choose δ = ε/(3a + b) and have the result. We now prove ⇒. As a first, main step, we prove that W a,b p (µ n , µ) → 0 implies that {µ n } is tight. Fix now ε > 0. There exists a corresponding N such that W a,b p (µ n , µ) < ε for all n > N , and a compact K ε such that µ(R d \ K ε ) < ε, since µ is tight. Define ν ′ n :=ν n restricted to K ε , and µ ′ n the corresponding measure given by the transference plan π n realizing W p (μ n ,ν n ). Using Proposition 12, we have that the support of µ ′ n is contained in K d ε with d = 2 a b . Observe that such set does not depend on n. By construction, we have We now estimate This is the tightness of {µ n } n>N . Observe now that the finite set of measures {µ 1 , . . . , µ N } with finite masses is tight. Since a finite union of tight sets is tight, we have that {µ n } is tight. We now observe that |µ n | ≤ |µ| + 1 a W p (µ n , µ) by Proposition 11, that is a converging sequence of real numbers, thus µ n have uniformly bounded mass. We now apply Theorem 9, that gives weak convergence of µ n to a certain µ * . We prove that µ = µ * . Using the implication ⇐, we have W a,b p (µ n , µ * ) → 0. Thus W a,b p (µ, µ * ) ≤ lim n W a,b p (µ, µ n ) + W a,b p (µ n , µ * ) = 0, hence µ = µ * . It is interesting to compare such result with a similar result for the standard Wasserstein distance, that we recall here.
Theorem 14 [16, 7.12] Let µ k be a sequence of probability measures in P p , and µ ∈ P. Then the following statements are equivalent: • W p (µ k , µ) → 0; • µ k ⇀ µ and the following condition holds • µ k ⇀ µ and the p-moment converges, i.e.
Condition (10) is called "tightness" condition, a notation that could create some confusion with respect to Definition 6. Anyway, we remark that condition (10) is stronger than Definition 6, thus our Theorem 13 applies on a wider class than Theorem 14. First of all, Theorem 14 applies for measures that have all the same mass, otherwise W p (µ k , µ) is not defined. Moreover, even taking a sequence of probability measures µ k , one can have convergence in W a,b p and no convergence in W p . This occurs exactly in the case in which {µ k } is tight according to Definition 6 and not according to condition (10). For example, take the following sequence of probability measures: µ k := (1 − k −p )δ 0 + k −p δ k . It is clear that such sequence converges weakly to µ * = δ 0 , and that W p (µ k , µ * ) = W p (k −p δ 0 , k −p δ k ) = k −1 k p δ 0 = k p−1 → 0. Indeed, condition (11) is not satisfied, since the p-moment of µ * is 0, while the p-moment of µ k is 1. Similarly, condition (10) is not satisfied, since for each R the measures µ k with k > R satisfy |x|>R dµ k = k −p |x|>R k p δ k = 1 → 0.
Thus, {µ k } is tight according to Definition 6, as it is easy to prove by observing that µ k (R \ [−n, n]) < n −p .
We now prove completeness of M.
Proof. Take a sequence µ n that is Cauchy with respect to W a,b p . We first show that {µ n } is tight. Fix δ > 0 and let N be such that W a,b p (µ n , µ n+k ) < δ for all n ≥ N, k ≥ 0. Fix the notationμ k ,ν k to denote the choices in (3) realizing the minimizer W a,b p (µ N , µ N +k ), and π k the transference plan realizing W p (μ k ,ν k ). Let K δ be such that µ N (R d \ K δ ) < δ, that exists since µ N has finite mass. Sinceμ k ≤ µ N , thenμ k (R d \ K δ ) < δ. Define now µ ′ k the restriction ofμ k to K δ and ν ′ k the corresponding marginal with respect to π k . Using Proposition 12, we have that < ε for n ≥ N . Thus, we have tightness for n ≥ N . Since {µ 1 , . . . , µ N } is a finite family of measures with finite mass, then it is tight, hence the whole {µ n } is tight.
Observe that {µ n } has also uniformly bounded mass, thus there exists a subsequence µ n k ⇀ µ * for a certain µ * , due to Theorem 9. Using Theorem 13, we have that W a,b p (µ n k , µ * ) → 0, and by triangular inequality we have W a,b p (µ n , µ * ) → 0.

Comparison with other distances
In this section, we compare W a,b p with two distances proposed in the literature, namely the Levy-Prokhorov distance (see e.g. [16]) and the distance W b2 defined in [8]

by A. Figalli and N. Gigli.
We first recall the definition of the Levy-Prokhorov distance d LP between two probability measures µ, ν: where A α is the enlarged set A α := ∪ x∈A B(x, α). It is clear that the two terms ν(A α ) and α represent a W p perturbation and a L 1 perturbation, respectively. For such reason, there are some common ideas between d LP and W a,b p .
The main difference here is that d LP was defined for probability measures only, while we deal with measures with different (finite) masses. Nevertheless, even restricting to the space of probability measures, the two distances have different values. We study a remarkable case, that is the distance between µ = δ 0 and ν = 1 2 δ −d1 + 1 2 δ d2 on the real line. We study the values of d LP and W a,b p as functions of d 1 , d 2 . For both distances, the goal is to choose the optimal coupling, on one side between 1 2 δ 0 and 1 2 δ −d1 , and on the other side between 1 2 δ 0 and 1 2 δ d2 . We now compare d LP with W a,b p of parameters a = 1 2 , b = 1. Without loss of generality, we assume d 1 ≤ d 2 . The set of different cases is the following: • The two masses 1 2 δ −d1 , 1 2 δ d2 are both "far" from δ 0 . The best choice for both couplings is to focus on L 1 distance. For the d LP , it means that d 1 ≥ 1. In this case d LP (µ, ν) = 1. For W a,b p , it means that In this case W a,b p (µ, ν) = C (0, 0) = 1.
• One of the masses is "close" and the other is "far". This means that d 1 ≤ 1 ≤ d 2 . In this case, we use the W p distance for the coupling 1 2 δ 0 , 1 2 δ −d1 and the L 1 distance for the coupling 1 • Both masses are "close, but one is not very close". This is true for 1 2 ≤ d 2 ≤ 1. In this case, the optimal strategies are different for the two distances: for d LP , we use the W p distance for the coupling 1 2 δ 0 , 1 2 δ −d1 and the L 1 distance for the coupling p we use the W p distance for both couplings. This gives W a,b • Both masses are "very close". This is the case of d 2 ≤ 1 2 . For both distance the best choice is to use It is easy to prove that the two distances d LP , W a,b p are equivalent as norms on the space (d 1 , d 2 ). Moreover, they have the same level lines around d 1 = 0, d 2 = 0 when choosing p = ∞.
We now recall the distance W b2 defined in [8]. Such distance is defined on a subset Ω with non-empty boundary ∂Ω. The idea is that such boundary is an infinite reserve of mass, in the following sense. Given two measures µ, ν, even with different masses, one can either send a part of mass of µ to ν or to the boundary ∂Ω. Similarly, the mass of ν that does not receive mass from µ goes to the boundary ∂Ω. In both cases, the cost is computed via the Wasserstein distance, either from µ to ν or from µ to ∂Ω.
This cost is based on an approach that is rather different than ours. First of all, it deals with a space Ω that has boundary, otherwise one could not deal with measures with different masses. Moreover, the cost of sending mass to the boundary (that is similar to delete mass in our approach) is computed as a Wasserstein distance and not with L 1 , like in our case.

Estimates of generalized Wasserstein distance under flow actions
In this section, we study properties of W a,b p when restricted to M ac 0 . In particular, we are interested in estimates about the variation of W a,b p (µ, ν) under action of flows on µ, ν. These Gronwall-like properties will be useful for the study of solutions of (1).
We first recall a connection between flows actions on measures and transport equation. Take a Lipschitz vector field v, that generates a flow Φ v t for t ≥ 0. The flow is a diffeomorphism for the space R d , thus one can define µ t := Φ v t #µ 0 for a given measure µ 0 . One has the following theorem.
Theorem 16 Take a Lipschitz vector field v, and the flow Φ v t it generates. Given µ 0 ∈ M ac 0 , and µ t := Φ v t #µ 0 , then µ = µ [0,T ] is the unique solution of the linear transport equation where M ac 0 is endowed with the weak topology. Proof. The proof is a direct consequence of [16,Thm 5.34]. See details in [11].
To study (1) in the setting of the generalized Wasserstein distance, it is interesting to check the evolution of W a,b p under flow action. We first recall here some properties about standard Wasserstein distance, that we proved in [11]. Here, we emphasize the fact that the Wasserstein distance is computed between two measures µ, ν with same mass, in general different than 1.

Construction of an approximated solution
In this section, we apply the sample-and-hold method to construct a sequence of functions in C ([0, T ], M ac 0 ) such that the limit exists and it is a solution of (1). With no loss of generality, we assume that the T = 1.
The idea is based on a Lagrangian scheme with the time-discretization provided above. In particular, we define a solution for each time n∆t, then consider that v and h are computed at this time and fixed on the next interval [n∆t, (n + 1)∆t). More precisely, for a fixed k, we define

Existence and uniqueness of the solution
In this section we prove that the measureμ t := lim k µ k t given as a limit of the sequence of the Lagrangian scheme is indeed a weak solution of (1). We will then prove that it is unique.
First observe thatμ t exists, since it is the limit of a Cauchy sequence in (M, W a,b p ), that is complete. It is evident that, since µ k 0 = µ 0 for all k, thenμ 0 = µ 0 . We have now to prove that, for each f ∈ C ∞ c ((0, 1) × R d ), it holds The idea is to use again µ k . First of all, we recall the solution of the continuity equation with timeindependent v or h and with the other part (h or v respectively) being identically zero. For h ≡ 0, the solution of (1) with time-independent v is µ t = Φ v t #µ 0 . For v ≡ 0, the solution of (1) with time-independent h is µ t = µ 0 + t h. This gives Due to the boundedness of h, v, ∇f , it exists C 3 such that R d dh µ k n∆t v µ k n∆t · ∇f (t, .) ≤ C 3 , that gives Going back to prove (15), we prove equivalently that Since lim k W a,b