Modeling random traffic accidents by conservation laws

We introduce a stochastic traffic flow model to describe random traffic accidents on a single road. The model is a piecewise deterministic process incorporating traffic accidents and is based on a scalar conservation law with space-dependent flux function. Using a Lax-Friedrichs discretization, we show that the total variation is bounded in finite time and provide a theoretical framework to embed the stochastic process. Additionally, a solution algorithm is introduced to also investigate the model numerically.


Introduction
Macroscopic traffic flow models based on hyperbolic conservation laws have been intensively investigated during the last decades, see [13,14] for an overview. The various research directions include theoretical and numerical investigations such for instance well-posedness [4], coupled models [6], network extensions [14,19], optimal control [16], or more recently, data-driven approaches [10] while stochastic traffic models have been less considered [20,30].
Typically, macroscopic traffic flow equations are either characterized by first-order models for the evolution of the traffic density or second-order models, where an additional equation for the velocity is considered. So far, the modeling of traffic accidents (or incidents) has been considered in a deterministic setting [18,27,28], queueing theory approaches [3,22] or kinetic models [12]. There are only a few contributions, where the presence of accidents is described by a stochastic process [22]. Therefore, the aim of this paper is to combine the stochastic modeling of accidents with the Lighthill-Whitham-Richards (LWR) model [25] of first-order type and to provide a framework that allows for theoretical and numerical studies. The idea is to include random effects directly in the flux function such that failures depend on the current traffic density.
We assume that accidents happen at random times and have an impact on the road capacity around the accident. Based on the LWR model, we incorporate these accidents by a spacedependent flux function determining the deterministic structure between the random accidents. Obviously, the profile of the traffic density has an impact on the probability of an accident. For instance, fluctuations in the density lead to different velocities of the cars and an accident is more likely as it is the case for stationary traffic situations. The traffic density does not only influence the probability of an accident. It also indicates where an accident could happen as for example at the end of a traffic jam. In order to capture these ideas, we face two building blocks, i.e. the deterministic dynamics between accidents and the stochastic nature, which interrupts the deterministic flow at random times. This directly leads to the well-known piecewise deterministic processes (PDPs), see [7,21]. In [15], the latter idea has been used to incorporate random machine failures of machines based on hyperbolic dynamics, where the product density influences machine failures and vice versa. Compared to [15], we face different challenges here: First, we deal with a nonlinear dynamics with a space-dependent flux function, which does not admit total variation bounds in general and we prove under which conditions we can guarantee these bounds. Second, the position of an accident depends on the current density, which makes the modeling more involved. Additionally, the classical thinning algorithm, see [24], to sample the times of an accident might lead to large computational costs.
There are different works about hyperbolic equation based dynamics connected to randomness as for example random velocity fields [1,26] and propagation of uncertainty [11]. However, in these works, there is no influence of the conserved quantity on the stochastic nature, i.e. no bi-directional relation between the deterministic and stochastic ideas.
The paper is organized as follows: in Section 2, we present the modeling of accidents within the LWR model and show that the total variation of the new model is bounded. Furthermore, the stochastic process is characterized such that accident probabilities can be embedded. In Section 3, a stochastic solution algorithm based on a Lax-Friedrichs discretization is introduced to analyze the occurrence of traffic accidents from a numerical point of view.

Modeling of accidents
We introduce how accidents as capacity drops can be incorporated into the LWR model. As we will see, this leads to a conservation law with space-dependent flux function. The latter equation is then extended to the possibility of a single (or multiple) random accidents.

General setting
To describe the capacities of the road, we assume a function c road : R → R >0 and use c road (x)f (ρ) as spacedependent flux. An appropriate choice for c road might be piecewise constant, describing the dependency of speed limits or the number of lanes.
We interpret an accident on a road as capacity reduction within an interval I(p, s) ⊂ (p − s, p + s) of length s, where p ∈ R denotes the position and s ∈ R the size of the accident. The amount of capacity reduction is denoted by c ∈ [0, c max ] with 0 ≤ c max < 1 such that the road capacity at p is given by (1 − c)c road (p). We denote by x → c a (x, p, s, c) the capacity function of the accident. Then, it is natural to define the space-dependent flux function Altogether, we end up with the following Cauchy problem which admits a unique entropy solution, see [5] if TV(c a (·, p, s, c)c road (·)) < ∞, TV(ρ 0 ) < ∞ and if c a (·, p, s, c)c road (·) is differentiable with except of finitely many points. Additionally, we need that This does not imply TV(ρ) < ∞, which we will need in the modeling of stochastic accidents later. However, the following lemma provides conditions on the data such that the solution to the scalar conservation law (1) remains in BV(R).
Proof. We prove the lemma by using the Lax-Friedrichs scheme given by The convergence of the Lax-Friedrichs scheme has been studied in [23], whereas in [31,32] the Godunov scheme has been examined. For our purpose, the Lax-Friedrichs scheme is a suitable choice avoiding the study of various cases as needed for the Godunov scheme. We start with the L ∞ estimate followed by the BV-estimate and conclude that the numerical scheme converges to the unique solution of the Cauchy problem.
• BV estimates. Using the same arguments as in the L ∞ estimates, we can estimate the spatial BV bound as follows: Using the CFL condition and Hence, we have Furthermore, we deduce the following bound on the time difference of the total variation In order to use a compactness argument for the numerical scheme to converge, we need the total variation in space and time. For piecewise constant function ρ it holds We can directly estimate the first expression by T ∆t j=0 ∆t TV(ρ j ) ≤ T C 1 .
To analyze the second expression we start with where we use the CFL condition and f ≥ 0. This leads to Let (∆t n ) n∈N be a sequence, which converges to zero and ∆x n = ∆tn λ be the corresponding spatial discretization, satisfying the CFL condition. The constructed sequence of piecewise constant functions (ρ n ) n∈N has a subsequence (ρ n l ) l∈N , which converges to some ρ ∈ BV(R × [0, T ]) in L 1 loc (R) by Helly's theorem. A Kruzkov type inequality, see [23], and a Lax-Wendroff type argument show that (ρ n ) n∈N converges to a weak entropy solution, which is unique by [5]. Consequently, the limiting solution is the solution to the IVP satisfying claimed properties of the lemma. Hence, we are now able to mathematically introduce traffic accidents as partial road capacity drops via the function a.

Random traffic accidents
The parameters to incorporate a traffic accident in equation (1) are the position p, the size s and the capacity drop c. From the modeling perspective the position is the first parameter to consider since there exists a dependency on the current traffic situation: if there are no cars, or cars are fully stopped by a traffic jam, we expect no accident, whereas if cars drive with high speed and the density is high at the same time, we expect a higher probability of an accident. Also, we observe accidents at the end of traffic jams. To summarize, the following modeling ideas should be included: 1. a higher distance between cars at lower speed implies a lower accident probability and vice versa, 2. a higher accident probability at increasing density (as for example tailbacks).
Regarding 1. The flow exactly describes the combination of density, i.e. car distances, and velocities such that at places where ρ = ρ * the probability of an accident can be assumed to be the most highest. This idea corresponds to a probability capturing random accidents caused by human failures solely (i.e. excluding tailbacks). If v is uniformly bounded on [0, 1], the normalizing constant is finite and we can define the family of probability measures where the latter denotes the Borel σ-algebra on R. Here, we assume ρ 0 1 > 0 then it follows C F = 0 by assumptions on F p,s,c . The probability measure µ F p,s,c,ρ exactly describes the probability distribution of the position of an accident caused by the flows.
Regarding 2.: In 1. only the information of the flow is used to specify the probability of the position of an accident. Here, we incorporate the fact that at ends of tailbacks the probability of an accident is much higher, i.e. if the derivative of ρ is positive. Generally, for ρ ∈ L 1 (R) we can not assign a proper derivative Dρ but if ρ ∈ BV(R) we can argue as follows: on the one hand, a classical derivative of ρ ∈ BV(R) does not exist but on the other hand, the derivative of ρ corresponds to a signed Radon measure Dρ by a consequence of Riesz representation theorem. Furthermore, it holds for ρ ∈ L 1 (R) that where |Dρ| is the total variation of the measure Dρ and is given by In the latter equation we used the Hahn decomposition, i.e. there exists a measurable setB ∈ B(R) such that ρ For further details, we refer the reader to [2,9,17,29]. A natural probability measure for ρ ∈ BV(R) to describe positions of potential accidents caused by increasing densities is then given by for some fixed β ∈ [0, 1]. That means, if β = 1, the influence of increasing densities is neglected (end of tailbacks) and if β = 0, only the latter effect is incorporated. The case Dρ + (R) = 0 means that there is no increasing part in the function ρ, which implies together with ρ ∈ L 1 (R) and TV(ρ) < ∞ that only ρ = 0 can fulfill Dρ + (R) = 0. We only have discussed the probability distribution for the position p of the accidents so far. We assume that the size s follows the probability distribution µ size on (R, B(R)) and the capacity reduction c follows µ cap on ([0, 1), B([0, 1))). In a natural way, we collect the details using the product space for y = (p, s, c, ρ) ∈ E to define a Banach space E. Furthermore, we denote by E = σ(E) the smallest σ-algebra generated by the open sets induced by the norm · E . Finally, we define for every y ∈ E and every B ∈ E the product measure where ǫ z is the Dirac measure with unit mass in z. Since η(y, B) describes the transition from no accident to one accident, we expect η to be a kernel as the following lemma shows. Take y = (p, s, c, ρ),ỹ = (p,s,c,ρ) ∈ E, satisfying ρ,ρ = 0. We deduce We also have Hence, the mapping y → µ pos y (B) is continuous and therefore measurable.
So far, we only have specified the probability distribution of a jump in the case that a jump occurs. To construct the time of a jump, or accident, we additionally need information about how likely a jump at time t is. This can be done with rate functions and is based on the ideas of a marked point process, or, deterministic Markov processes, see [7,21].
A possible choice for a rate function ψ : E → (0, ∞) is given by where λ F , λ D > 0 scale the influence of accidents caused by high fluxes and ends of tailbacks, respectively. For fixed y = (p, s, c, ρ) ∈ E, the rate ψ(y) is finite. More precisely, ifρ(x, t) is a weak entropy solution to the IVP (1), then for a(x) = c a (x, p, s, c)c road (x) it holds that We have to keep in mind that for y = (p, s, c, ρ) ∈ E the values a ∞ , a ′ ∞ , a ′′ 1 might differ. We know that a ∞ = 1 and a ′′ = 0 for all x ∈ R \ I(p, s) by assumption. Hence, a ′′ 1 ≤ |I(p, s)| |a ′′ ∞ . Therefore, we assume a ∈ C 2 (R), cf. Lemma 2.1.
Let φ : E → E be the deterministic evolution, i.e.
where ρ(t) is the unique weak entropy solution to the IVP (1) with initial datum ρ 0 and the parameters p 0 , s 0 , c max = c 0 . Let (U i , i ∈ N) be a sequence of independent and identically distributed (i.i.d) random variables on some probability space (Ω, A, P ) each having a uniform distribution on [0, 1]. Furthermore, let (ξ i , i ∈ N) be a sequence of i.i.d exponentially distributed random variables on the same probability space (Ω, A, P ) and independent of (U i , i ∈ N) and choose t n ∈ [0, T ], y n ∈ E. The following thinning algorithm produces the next jump time T n+1 and corresponding post jump location Y n+1 .

Algorithm 1: Thinning algorithm
One can show, see [15], that for t ≥ t n and B ∈ E. We set T 0 = 0 and Y 0 = (p 0 , s 0 , c 0 , ρ 0 ) ∈ E and apply the thinning algorithm iteratively. In every iteration we obtain a new upper boundλ on the rates, which might increase but stays finite for finitely many iterations. Let denote ((T n , Y n ), n ∈ N 0 ) the constructed jump times and post-jump locations, then we define the piecewise deterministic process (PDP) (X(t), t ∈ [0, T ]) as 1. The total variation bound on the solution is quite pessimistic for reasonable initial datum.

The total variation bound can be very large in small time intervals and the Algorithm 1
can not be used efficiently to simulate the model.

3.
We expect X being a Markov process but standard results, see [21] can not be applied since BV is no Borel space and the existence of regular conditional distributions is not guaranteed.
Multiple accidents on roads. In order to implement multiple accidents in the model, we label accidents and extend the state space as follows: • positions are now given by p ∈ R N , • sizes of the accidents are s ∈ R N , • capacity reductions c ∈ [0, 1) N and set with the norm y E = p l 1 + s l 1 + c l 1 + ρ L 1 (R) + TV(ρ).
Let λ A > 0 be the rate of an accident and λ R > 0 be the rate of resolving an accident. We define m( c) = min{i : c i = 0} and π i (z, v) = (v 1 , . . . , v i−1 , z, v i+1 , . . . ) ∈ R N . A natural choice for the jump distribution is then given by Here, µ pos 1 CF F p, s, c (x, ρ(x))dx and F p, s, c (x, ρ) = c road (x)f (ρ) i∈N c a (x, p i , s i , c i ). The sum N ( c) = i∈N 1 ci>0 corresponds to the number of accidents and we see that B → η(y, B) is a probability measure. Since π i and m are measurable functions, the mapping y → η(y, B) is measurable if again y → µ pos y is measurable, see Lemma 2.2. Since λ A corresponds to the rate of an accident, we choose again The upper bound on the rate function is now given by where a(x) = c road (x) i∈N c a (x, p i , s i , c i ), y = ( p, s, c, ρ(t)) and ρ(t) is the unique weak entropy solution to (1). We explain the choice of (6) by the following example. We consider two accidents with capacity reduction c = (0.5, 0, 0.5, 0 . . . ), i.e. N ( c) = 2 and m( c) = 2. We set This implies that the probability of resolving the first accident and no new accident, i.e. B c1 = {0}, B c3 = B c2 = ∅, is given by In the same manner we obtain the probability of having a new accident somewhere with some size and no repairs, i.e. B c1 = B c3 = ∅, B c2 = B p = R and B s = [0, 1), Hence, if λ A = λ R , the probabilities are equal with value 1 3 .

Numerical treatment and computational results
The Cauchy problem (1) is numerically solved using the Lax-Friedrichs scheme with a temporal step size ∆t > 0 and a fixed relation ∆t ∆x such that the scheme converges to the weak entropy solution ρ of the Cauchy problem, cf. Lemma 2.1. We denote by the cell means of the initial datum ρ 0 for X i = i∆x and i ∈ Z.
Since the position, size and capacity reduction stays constant between the jumps, we define the discrete deterministic dynamics as where ρ 0 is a piecewise constant function on [x i− 1 /2 , x i+ 1 /2 ) given by the cell means ρ 0 i . Further, ρ(t) is the piecewise constant function given by the numerical scheme with step size ∆t and a possibly smaller last step size to reach exactly t.
Then, we then approximate µ F y bȳ Thanks to the piecewise constant cell averages, we enjoy an explicit representation of Dρ + as .
The discretized version of the rate function ψ(y) is then given bȳ In order to use Algorithm 1, we need a uniform upper bound onψ which will depend on the number of accidents and grows exponentially due to the total variation bound in Lemma 2.1. In [24], less restrictive bounds have been used to define an appropriate algorithm but the bounds propsed will also depend on the exponential growth of the estimation of the total variation. We will introduce an approximate scheme, where the jump times are not simulated exactly in the following. The idea is based on the simulation algorithm introduced in [8], where an algorithm has been proposed to approximate a continuous-time Markov Chain. The probability that an accident occurs at a time T n+1 , which is before T n + ∆t is given by as ∆t → 0. This is true since t → ψ(φ t (Y n )) is Lipschitz continuous by using Lemma 2.1 and the properties of C F , i.e.
Equation (7) motivates the following algorithm to approximate the next jump time T a n+1 . Algorithm 2: Approximate algorithm jump times The parameters ̺ ∈ (0, 1], ∆t ref > 0 are user-defined and (U i , i ∈ N) is a sequence of i.i.d. uniformly distributed random variables. The parameter ∆t ref allows to control the accuracy of the algorithm as the reference step size and ̺ is the acceptance ratio in the case that ∆t ref and T are large. We see that Algorithm 2 uses an adaptive step size, where the adaptivity is incorporated by the current value of the rate function ψ(y). We do not need any uniform bound, which is the obvious advantage and reduces the computational costs. Note that the exact solution operator φ has to be replaced by the discrete one in numerical implementations.
It remains to introduce the simulation procedure in the case that an accident happens or an accident does not cause capacity drop anymore, i.e. the simulation of η(y, ·). The highest index i, where c i > 0 and c i = 0 corresponds exactly to N ( c) by construction if we start with c j > 0 for j = 1, . . . N ( c) and c j = 0 for j > N ( c). One can use the well-known composition method, i.e. the distribution is a weighted sum of distributions, and we obtain the following procedure: 1. Choose whether an accident happens Z 1 = 1 or an accident is resolved Z 1 = 0 by a Bernoulli distributed random variable with P (Z 1 = 1) = λA λRN ( c)+λA . 2.
• Case Z 1 = 1: Choose independently a position p N ( c)+1 according to the law µ pos y , a size s N ( c)+1 according to µ size and c N ( c)+1 ∼ µ cap the corresponding capacity drop.
Simulating the new position is straightforward since i is picked according to and then the position within cell i as a uniform distribution on [x i− 1 /2 , x i+ 1 /2 ).

Simulation results
We The latter condition avoids a discontinuity for the periodic boundary conditions and implies that cars leaving at x = L enter in the same manner at x = −L again. Since we need enough regularity on c road to apply the total variation bound on the solution of (1), we use a mollifier M ǫ with support [−ǫ, ǫ] and R M ǫ (x)dx = 1. Then, c road (x) =c road * M ǫ (x) = Rc road (y)M ǫ (x − y)dy ∈ C ∞ and | supp(c ′′ road )| ≤ 2ǫM . We use the same ideas for the capacity reduction and definec a (x, p, s, c) = 1−c1 (p− s 2 ,p+ s 2 ) (x) for p ∈ [−L, L], s ∈ (−L, L) and c ∈ [0, 1 − c min ]. By defining c a (x, p, s, c) =c a (·, p, s, c) * M ǫ (x), and using a(x) = c road (x) i∈N c a (x, p i , s i , c i ), we deduce a, a ′ ∈ L ∞ (R), a ′ , a ′′ ∈ L 1 (R) as required.
Remark 3.1. We face only finitely many accidents P -a.s. such that the infinite product in a can be represented by a finite product. Therefore, the differentiation of a can be understood in the classical sense.
The first example is devoted to the understanding of the dynamics of the LWR model with accidents derived in the previous sections. We are interested whether the modeling ideas can be also observed in computational experiments. The data we use is as follows: a time horizon T = 60, a spatial discretization ∆x = 1 50 of [−10, 10] and ∆t ref = 1 20 . The initial density is chosen constant as ρ 0 (x) = 0.4 and the LWR flux is given by f (ρ) = ρ(1 − ρ). We assume a road capacity given by the non-smooth version as which implies a capacity reduction on [0, 5] caused by e.g. roads under constructions. To incorporate capacity drops caused by accidents, we use the functioñ In numerical investigations, we have recovered that smoothing the latter functions does not significantly change the results for a fixed spatial step size ∆x and ǫ < ∆x 2 , which reduces the computational costs significantly. For the stochastic part, we use λ R = 1 2 , λ D = 1 10 , λ F = 1 105 and assume as well as ̺ = 1.
A first insight into the behavior of the model. Having all the parameters at hand, except β from equation (4), we can get first insights into the behavior of the model using numerical simulations for varying β. The latter parameter describes the influence of the current flux on the position of possible accidents, see (3). Figure 1 shows the traffic density (black bold line) for different points in time and using only the information of Dρ + to determine the position of an accident, i.e. β = 0. The rectangles in the figures indicate the range of the road affected by an accident, where a bright color corresponds to a capacity drop of 0.99 and the other color of 0.5, see µ c in (8). Since the initial distribution is constant with a value of 0.4, we draw the density at the first time at which an accident happens in Figure 1(a). Due to a spatial inhomogeneous road capacity c road (x), the initial density profile changed to a non-constant equilibrium traffic density. As we would expect, the accident happens at the incresaing part of the density, i.e. at the end of the traffic jam, with a road capacity reduction of 0.99. At this position a traffic jam occurs until the accident is removed, see Figure 1(b). The traffic density relaxes to an equilibrium density again and the second accident happens at the end of the traffic jam as Figure 1(c) indicates. Again a capacity reduction of 0.99 has been randomly chosen and a third accident occurs right after the second accident. The latter can be seen in Figure 1(d), which shows the traffic density at the time, where the second accident gets resolved.
At the time, where both accidents are resolved, see Figure 1(e), we see the high impact of the previous accidents on the density, which does not reach the equilibrium state until the next accident occurs as Figure 1(f) shows. Again, the position of the accident is at an increasing part of the density. Altogether, we see that our model is able to map the ideas of accidents at places with an increasing density and the numerical solutions look very confident using the CFL condition with equality.       In the following, we discuss simulation results using the parameter β = 0.5 shown in Figure  2. We face an approximately equilibrium density at the time of a first accident again, see Figure  2(a). Here, the accident occurs close to the position zero, which is not an increasing part of the density. The accident is therefore created by the flux, which is uniform on the interval [-10,10] while the density is close to equilibrium.
As Figure 2(b) shows, the second accident happens at the traffic jam end. After the first accident has been removed, a third accident occurs and Figure 2(c) shows the traffic density at the time right before the fourth accident occurs. The fourth accident is inside the area of the second accident and has a small size of impact, see Figure 2(d). The latter accident occurred at this position since the flux around ρ = 0.5 is the most highest and we are not in a stationary state.
Numerical verification of the approximate scheme. In order to verify numerically that the approximate algorithm works well, we study the distribution of the first jump time, i.e. the first time of an accident. Formula (5) exactly describes the cumulative distribution function (CDF), which can be approximated using the Lax-Friedrichs scheme to approximate φ. Using the left-sided rectangular rule to approximate t 0 ψ(φ τ (y 0 ))dτ and the Matlab function ecdf * to compute the empirical cumulative distribution function (ECDF) yields the results shown in Figure 3 computed by using 10 4 samples of the first accident time T a 1 . First of all, we observe a very good fitting of the CDF by the ECDF computed with the approximation Algorithm 2. This implies that the corresponding probability distributions are close (in the weak sense). * Documentation: https://de.mathworks.com/help/stats/ecdf.html, 2019 Furthermore, we observe that the parameter β has no significant influence on the shape or values of the CDF as Figures 3(a) and 3(b) show.   (c) t = 9.95: third accident and first accident removed.  In order to compare a histogram generated by the approximation procedure with the exact probability density function (pdf) g(t), we can differentiate (5) and obtain g(t) = ψ(φ t (y 0 ))e − t 0 ψ(φτ (y0))dτ . Figure 4 shows a histogram of samples of T a 1 and the theoretical result g(t). We observe a good agreement between both quantities again, also independent of the choice of β.
Finally, we discuss the distribution of the first accident's position. Figure 4 shows the histogram of samples of the first accident's position, where we distinguish the cases β = 0 and β = 0.5 again. In both cases, the probability having an accident at position x = −4 is the most highest, which corresponds to the congestion end in the stationary traffic profile, see Figure 1(c) for example. One significant difference between β = 0 and β = 0.5 can be observed for x ∈ [0, 5], where in the case of β = 0, i.e. no flux information, no accident happens.
In contrast, for β = 0.5, there is a strictly positive probability having an accident in this interval, which is clear since the stationary value of ρ is approximately at the maximal flow, i.e. at 0.5.
To conclude, the numerical simulations inherit the ideas for the stochastic traffic flow model and the numerical results are convincing.

Conclusion
We successfully have derived a stochastic traffic flow model capturing random traffic accidents. Furthermore, a tailored numerical approximation scheme has been introduced, which also has been validated in numerical simulation examples.
The stochastic traffic flow model allows for road capacity planning and controlling variable speed limit systems in such a way that traffic accidents are rarely events, which might be future research. Additionally, the extension to a second order traffic models and networks can be considered.