Stochastic Shortest Paths and Risk Measures
Abstract.
We consider three shortest path problems in directed graphs with random arc lengths.
For the first and the second problems, a risk measure is involved. While the first problem consists in finding a path minimizing this risk measure, the second one consists in finding a path minimizing a deterministic cost, while satisfying a constraint on the risk measure. We propose algorithms solving these problems for a wide range of risk measures, which includes among several others the and the probability of being late. Their performances are evaluated through experiments.
One of the key elements in these algorithms is the use of stochastic lower bounds that allow to discard partial solutions. Good stochastic lower bounds are provided by the socalled Stochastic On Time Arrival Problem. This latter problem is the third one studied in this paper and we propose a new and very efficient algorithm solving it.
Complementary discussions on the complexity of the problems are also provided.
Key words and phrases:
On time arrival, random travel time, risk measure, resource constraint, shortest path, usual stochastic order1. Introduction
1.1. Context
Finding shortest paths in networks has numerous applications. There are direct applications, e.g. organizing the routes of a fleet in logistics or finding the best trajectory for an airplane, but there are also less obvious applications, such as the ones arising as subproblems in column generation approaches.
As for other optimization problems, there is currently a need for taking into account uncertainty in shortest path problems, both from theoretical and practical point of views. Taking into account the uncertainties allows a better optimization. For instance, congestion in road networks has a strong influence on travel times, and modeling delay is crucial when on time arrival is required. Several works have already been carried out on this topic – see our literature review in Section 2 – but as far as we know, none deal with the problems expressed in the general form we address in the present paper.
1.2. Problems
We consider various shortest path problems with random arc lengths. They all have in common the following elements: a directed graph without loops, two vertices that are respectively the origin and the destination, and independent random variables that model random travel times. The objective is always to find the best  path. ‘Best’ can take various meanings and we adopt a versatile approach.
The most natural case consists probably in taking no additional constraints into account. In order to be as general as possible, we study the problem of minimizing a given risk measure of the sum of the ’s along the path. A risk measure is a mapping from a set of random variables to the set of real numbers. The mean, the variance, or the probability of being above some threshold are examples of risk measures. Another risk measure is the conditional value at risk and is well known in finance but maybe less in operations research. It has many interesting features. Details are given later in the paper.
Given a risk measure , we define the following problem.
Stochastic Shortest Path Problem
Instance. A directed graph , two vertices , independent random variables .
Solution. An elementary  path .
Measure. The quantity .
When the are deterministic and is linear, we obtain the usual (deterministic) shortest path problem.
Another way to take into account stochasticity when modeling an optimization problem consists in introducing probabilistic constraints. Still assuming given a risk measure , we can define the following problem.
Stochastic Resource Constrained Shortest Path Problem
Instance. A directed graph , two vertices , independent random variables , a nonnegative number , and nonnegative numbers .
Solution. An elementary  path such that
.
Measure. The quantity .
When the are deterministic and is linear, we obtain the usual (deterministic) resource constrained shortest path problem.
1.3. Assumption on the travel times
All random variables , which model the time needed to traverse an arc , are assumed to take their values in and to have finite supports. In a computational perspective, it is a natural assumption. When complexity features are discussed, the variable is described by its distribution, which is assumed to be encoded as its support and the probability of each value in the support.
1.4. Contributions
We propose an algorithm for each of the aforementioned problems when the arc lengths satisfy the assumption above and when the risk measure penalizes delay. The mean, the probability of being above some threshold, and the conditional value at risk are examples of such risk measures, but not the variance. “Penalizing delay” will be mathematically specified with the help of the socalled usual stochastic order, which is an order defined on the set of random variables – see Section 3. However, our approach remains completely natural. The efficiency of our algorithms, which turns out to be high, is proved by an extensive experimental study.
One of the main ideas used in these algorithms consists in attaching to each vertex of the graph a random variable that is a lower bound of the length of a  path. “Lower bound” is here to be understood in the sense of the usual stochastic order. As usual with lower bounds in shortest paths algorithms, these stochastic lower bounds allow to discard a priori some partial paths and to reduce the space of possible solutions.
It turns out that good lower bounds are solutions of another problem, namely the Stochastic On Time Arrival Problem. There are already efficient algorithms solving this problem, but we propose a new one, which seems to be very efficient.
The complexity of the problems dealt with in the paper are also discussed.
1.5. Plan
We start with a literature review (Section 2). We describe in Section 3 the usual stochastic order and the various risk measures covered by our work. The stochastic lower bounds used in our algorithms and their links with the Stochastic On Time Arrival Problem are described in Section 4, as well as the new algorithm we propose for this latter problem. The algorithms for the Stochastic Shortest Path Problem and the Stochastic Resource Constrained Shortest Path Problem are described in Sections 5 and 6 respectively, as well as their complexity analysis. The paper ends with an extensive experimental study (Section 7).
2. Literature review
2.1. Deterministic shortest path
The shortest path problem with deterministic travel times is one of the most studied problems in Operations Research. Efficient polynomial algorithms are known since the end of the fifties. Recently, research has focused on improving algorithm efficiency thanks to preprocessing, and state of the art techniques compute shortest paths on continental road networks in fractions of a microsecond. An exhaustive survey on shortest path algorithms for route planning can be found in (Bast et al. , 2014).
2.2. Deterministic constrained and multicriteria shortest path
Deterministic shortest paths with resource constraints have many direct applications in logistics and transportation. Moreover, many operations research problems require to find such shortest paths as a subroutine (e.g. vehicle routing problems). Resource constrained shortest path have therefore been extensively studied, and a detailed literature review is out of the scope of this paper. A review of state of the art techniques can be found in (Irnich & Desaulniers, 2005).
Several problems close to the resource constrained shortest path problem belong to multicriteria optimization (Ehrgott, 2005). Many algorithms have been developed for the bicriteria (Raith & Ehrgott, 2009) and multicriteria shortest path problem (Tarapata, 2007). State of the art solution methods for resource constrained or multicriteria shortest path problems often rely on labeling algorithms with preprocessing (Dumitrescu & Boland, 2003; Boland et al. , 2006).
2.3. Stochastic shortest path
Stochastic shortest path problems have been extensively studied since the seminal work of Frank (1969). Models differ by the probability distributions used to model delay on arcs, and by the risk measure optimized.
A first line of papers considers the probability of on time arrival: a path maximizing the probability of on time arrival, or analogously, a path with minimum quantile of given order is searched. Approaches have been developed for both continuous (Frank, 1969; Chen & Ji, 2005; Nikolova et al. , 2006; Nikolova, 2010) and discrete distributions (Mirchandani, 1976). An efficient labeling algorithm has recently been described when arc distributions are normal (Chen et al. , 2013). In a recent preprint, Niknami et al. (2014) proposes independently an idea that bears similarities with ours by using the solution of the Stochastic On Time Arrival Problem to obtain lower bounds for the Stochastic Shortest Path Problem with . Note that our approach covers actually more general situations, even in this special case.
A second line of papers defines a shortest path as a path minimizing the expectation of a cost function (Loui, 1983). Dynamic programming can be used when cost functions are affine or exponential (Eiger et al. , 1985). Murthy & Sarkar (1996, 1998) present an efficient labeling algorithm when arc distributions are normal and cost functions are piecewiselinear and concave. Instead of considering the expectation of a cost functions, Sivakumar & Batta (1994); Nikolova et al. (2006); Nikolova (2010) search the path that minimizes a positive linear combination of mean and variance.
2.4. Stochastic on time arrival
The Stochastic on Time Arrival Problem searches to maximize the probability of arrival before a given thresholds on adaptive paths (Fu, 2001; Fu & Rilett, 1998; Hall, 1986). An adaptive path is an application which, given a vertex reached and the time it took to get to this vertex indicates the next arc to choose to maximize the probability of on time arrival at destination. Fan & Nie (2006) provide an algorithm for continuous distributions, and Nie & Fan (2006) provide a pseudopolynomial algorithm for discrete distributions. Samaranayake et al. (2012) develop a faster algorithm for discrete distributions, and Sabran et al. (2014) provide preprocessing techniques to improve algorithm speed.
2.5. Shortest path under probability constraint
Finally, the problem of finding a minimum cost path for deterministic arc costs under stochastic resource constraints have been introduced in Kosuch & Lisser (2010), which proposes a solution algorithm based on linear programming is derived.
3. Usual stochastic order and risk measures
3.1. Usual stochastic order
For any random variable , let be its cumulative distribution. The usual stochastic order is a partial order defined on the set of cumulative distributions as follows: if for all . Endowed with the usual stochastic order, the set of cumulative distributions turns out to be a lattice. It means that each collection of cumulative distributions has a unique least upper bound (join) and a unique greatest lower bound (meet).
We use the same notation to extend the usual stochastic order to random variables. Two random variables and are such that if . Note that in the context of random variables, it is a quasiorder: it is reflexive and transitive like a partial order, but not antisymmetric. The usual stochastic order is a classical notion in probability theory and enjoys several properties. Missing details and a more complete introduction may be found in Müller & Stoyan (2002).
One property is particularly useful in our work and is used in the paper without further mention.
Let , , , and be random variables such that and are independent, and and are independent. If and , then .
By a slight abuse, we define the meet (resp. the join) of a collection of random variables as a random variable with cumulative distribution equal to the meet (resp. the join) of the ’s. We use the classical notation for the meet and for the join. We have in particular for any collection of random variables the following equality
The meet of the empty collection is as usual equal to and its join is equal to .
Since the supports of the random variables are assumed to be integer valued and of finite cardinality, their meet (resp. the join) can easily be computed: for each in the union of their supports, we simply keep the largest (resp. smallest) value among those taken by the cumulative distributions at . In the paper, we only use the meet operation.
3.2. Risk measures
A risk measure is said to be consistent with the usual stochastic order if implies . The algorithms for the Stochastic Shortest Path Problem and the Stochastic Resource Constrained Shortest Path Problem introduced in this paper only require the consistency of the risk measure with the usual stochastic order. It is not a strong assumption since being consistent with the risk measure simply means penalizing delay. Note however that the variance does not satisfy this condition.
For examples, the following risk measures are covered by our work.

for any increasing function .

for any .

for any .

for any .
The first risk measure among the ones listed can be used for instance when the cost of being late is modeled. We can cite as an illustration the case of goods delivery, an increasing step function can model the successive penalties of a late delivery.
The second one is typically used to measure the probability of going beyond some deadline. It corresponds to the risk measures of a traveler going to the airport: the only onjective is to arrive before the time when boarding gate is closed.
The third and fourth risk measures are widely used in finance.
is the value at risk (with confidence level ) and is defined by
Given a confidence level , a random variable is smaller than its value at risk with probability at least , and is the threshold value for which this inequality holds. For instance, if a bus company advertises the policy “our buses are on time for of the trips”, then the shortest path with respect to gives the smallest travel time for which this policy holds.
is the conditional value at risk (with confidence level ) and is defined by
Given a confidence level , the conditional value at risk of a random variable can be described in a somehow informal way as its average value in the worst cases. In the context of shortest paths with random travel times, a equal to corresponds to a shortest path problem where expectation is minimized. A equal to corresponds to a robust approach: the optimal solution is the solution with minimal worst case behavior. As a consequence, enables to obtain a tradeoff between expectation and robustness. This cost function suits well most traveler behavior: a small path with small gives a small average traveling time with a low risk of very large travel time.
4. Stochastic lower bounds and On Time Arrival
4.1. Stochastic lower bounds
Efficient shortest path algorithms are often based on lower bounds that allow to discard partial paths and to reduce the space of solutions that is explored. We do not depart from it and introduce stochastic lower bounds, which, instead of being single values, are random variables.
We consider the following equation, where denotes the set of arcs of the form .
(1) 
Proposition 3 below shows that this equation has always a solution which can be calculated in polynomial time. Before stating and proving this proposition, we explain the interest of this equation for stochastic shortest path problems.
Proposition 1.
Let be a solution of Equation (1). For any vertex and any  path , the inequality holds.
Proof.
An induction on the number of arcs in allows to conclude. ∎
4.2. On Time Arrival
The Stochastic On Time Arrival Problem aims at finding the path in that maximizes the probability of reaching before some time limit . If the solution has to be computed a priori, we are exactly in the case of the Stochastic Shortest Path Problem, with , which is a risk measure covered by the present work. In the Stochastic On Time Arrival Problem, the path can be built during the trip. Concretely, an optimal policy has to computed. A policy for this problem associates to each pair an arc . Such a policy is optimal if it maximizes the probability of reaching before . If there is in a circuit with for all , the problem may not be welldefined. We suppose therefore that there are no such circuits. Under this assumption, and using elementary properties of Markov chains, we get that solving Stochastic On Time Arrival Problem is equivalent to finding a solution of the following equation for all (see also Fan et al. (2005) for a first formulation of this kind in a continuous setting):
(2) 
The quantity is then the probability to reach from in less than time under an optimal policy. The decision to be taken at time on vertex is determined by the for which the maximum is attained when and in Equation (2).
Given a realization of the random variables , the path obtained following the policy of Equation (2) is not necessary elementary. Samaranayake et al. (2012) provides a simple example of network in which an event realization leads to a nonsimple path. We therefore adopt the following hypothesis: when a path crosses several times the same arc , then we consider that delays encountered on the arc correspond to independent realizations of the random variable .
Without loss of generality, we can assume that there exists in at least one  path (otherwise, the vertex can simply be removed from ). We have for all and is nondecreasing. Thus, can be considered as a cumulative distribution, and we can introduce a random variable whose cumulative distribution function is .
This construction shows that any algorithm solving Equation (1) solves the Stochastic On Time Arrival Problem as well.
Proposition 2.
Remark 1.
If all ’s are deterministic, the Stochastic On Time Arrival Problem coincides with the usual deterministic shortest problem, for which by the way the solution computed a priori coincides with the solution computed during the trip.
4.3. An algorithm
We describe now a new polynomial algorithm computing a solution of Equation (1), and thus solving also the Stochastic On Time Arrival Problem.
A random variable and an integer are attached to each vertex and updated during the algorithm. Initially, and for each vertex , while and . During the algorithm, a queue of vertices “to be expanded” is maintained. Initially, the queue contains only .
The algorithm ends when is empty. While is not empty, the following operations are repeated:

Extract from the vertex with minimum . In case there are several such vertices, choose one with maximal value of .

Set .

For each arc in , expand along : if , then

Update .

Update to .

Add to (if it is not already present).

Proposition 3.
This algorithm terminates in less than iterations, where is the maximum length an elementary  path can take (over all possible paths and over all possible events). Setting to be the last value of for each provides then a solution of Equation (1).
Algorithms in Nie & Fan (2006) and in Samaranayake et al. (2012) make a stronger assumption on arc distributions: they suppose the existence of a such that for all arcs . Moreover, the number of iterations of the algorithm in Nie & Fan (2006) is always and in Samaranayake et al. (2012) it is a , while in our approach, it corresponds to a worst case behavior: In general, we expect our algorithm to terminate after iterations for a small . The worst encountered in the numerical experiments was , see Section 7 for more details.
Proof of Proposition 3.
At any time during the algorithm, let have the distribution of the last time was expanded and let be the value of right before being set to because of the expansion. If has never been expanded, let and . The update rule of ensures thus that
Thus, if the algorithm terminates, we have and for each vertex . As is only updated when one of its outneighbor is expanded, we have
(3) 
Therefore is then a solution to Equation (1).
It remains to prove that the algorithm terminates in a finite number of iterations.
We prove that does not decrease along the algorithm, and that if this quantity remains constant for consecutive iterations, then does not increase.
Equation (3) implies that for any . Since and coincide up to , we have
(4) 
Moreover, just before being updated because of the expansion of a vertex , the integer is equal to because of the way the vertex has been selected in . This remark and Equation (3) implies together that after an expansion along an arc , we have .
Consider the algorithm right after a vertex has been expanded.
Let be such that . If has just been updated to , then
and since is a nondecreasing map, we have . If has not been updated while being already such that , then because of the selection rule of .
Therefore, the next vertex to be expanded will either be such that , or such that and .
To finish the proof of termination, we show now that at any time during the algorithm. If , the inequality is clearly satisfied. Otherwise, let be the last vertex that has been expanded and whose expansion has lead to an update of . We consider the algorithm right after this expansion. is thus the value of right before having being set to , and has been updated by the expansion.
Note that since does not decrease along the algorithm (it does not decrease because each is the value of at some previous iteration, and this latter quantity is non decreasing, as already noted). We already know that . Thus, if , we have as required. It remains to check whether it is possible to have simultaneously. In such a case, we would necessarily have since does not increase when remains constant. Since is a nondecreasing map, we would have and thus
with the help of Equation (4). Thus, should have been updated to a value greater than . Hence, in any case, we have .
Now, denote by the maximum length an elementary  path can take. We claim that once has been updated for the first time, we have all along the algorithm. It can be proved by a direct induction on the number of arcs an elementary path may have with the help of Equation (3). Moreover, since the inequality holds along the algorithm, we may have only for . Therefore, after at most iterations, the test “” is always false. It implies that after at most iterations, the algorithm terminates. ∎
Remark 2.
For each elementary path , define to be the maximum length it can takes over all possible realizations. Denote by the set of all elementary  paths. Proposition 3 is actually true for . Indeed, in the proof above, we show that the algorithms terminates after a finite number of iterations. Denote . Proposition 1 ensures that . Thus, as soon as , the test “” is always false. It implies that after at most iterations, the algorithm terminates.
Remark 3.
When all are deterministic, this algorithm coincides with Dijkstra’s algorithm.
5. Stochastic Shortest Path Problem
5.1. Complexity
When is linear over independent random variables and dealt with as an oracle, the Stochastic Shortest Path Problem can clearly be solved in polynomial time by any Dijsktralike algorithm. However, we were not able to decide whether the problem remains polynomial in the general case, still dealing with as an oracle. Nevertheless, we are able to prove the following theorem.
Theorem 4.
There is no polynomial algorithms with a complexity function independent of solving the Stochastic Shortest Path Problem, unless NP.
Proof.
The proof consists in describing a polynomial reduction of the deterministic resource constraint path problem to some Stochastic Shortest Path Problem, with an adequate risk measure consistent with the usual stochastic order. The deterministic resource constrained path problem consists in a directed graph , two vertices , nonnegative integers (the costs), nonnegative integers (the resources), and a nonnegative integer (the capacity). It aims at finding a path with and with minimal cost . It is an NPhard problem, see Handler & Zang (1980).
To that purpose, we define two risk measures and .
where . We define
The risk measure is consistent with the usual stochastic order because for all implies . As well as , the risk measure is consistent with the usual stochastic order because and for all implies . Thus is also consistent with the usual stochastic order.
We describe now the reduction to the Stochastic Shortest Path Problem. Given an arc , we define as follows:
can only take two values.
The deterministic resource constrained shortest path problem has a feasible solution if and only if the Stochastic Shortest Path Problem has a solution of cost less than . In this case, the optimal solutions of both problems coincide, as we show now.
We assume that the deterministic resource constrained shortest path problem has a feasible solution. Let be an optimal solution of the Stochastic Shortest Path Problem. We have then and , which implies that the deterministic resource constraint shortest path problem has a feasible solution of cost . Conversely, an optimal solution of the deterministic resource constrained shortest path problem provides a feasible solution of the Stochastic Shortest Path Problem of cost . ∎
Note the used in the proof being fixed, the Stochastic Shortest Path Problem becomes polynomially solvable. The proof above works precisely because the complexity function must be independent of the risk measure.
5.2. Algorithm
For any path , we denote by the random variable . Sometimes in the proofs or in the computations, the path can be nonsimple. In this case, independent copies of the ’s appearing several times in the sum are used. We assume given for each vertex a random variable such that for all  paths . Such a collection of random variables , which play the role of stochastic lower bounds, can be computed for instance by the techniques presented in Section 4.
These stochastic lower bounds are used to discard some partial paths that are not subpaths of an optimal path. It resembles classical techniques used by shortest path algorithms in the deterministic setting, see for instance Bast et al. (2014) for state of the art techniques, in which the lower bound is a real number, while in our setting the lower bound is a random variable.
We present the algorithm, which is a labeling one. A label is a pair , where is a vertex and is a random variable. Labels are stored in a queue . Initially, contains a unique label . If there is no  paths, the algorithm returns nothing. Otherwise, an elementary  path is computed and is set to . The algorithm ends when is empty. While is not empty, the following operations are repeated:

Extract a label of .

If and : update to .

Otherwise: If , expand label : for each arc in , add a new label to , where .
Theorem 5.
Suppose that for all and that there exists at least one solution. If is consistent with the usual stochastic order, then the algorithm described above terminates after a finite number of iterations and at the end, is the optimal value of a solution of the Stochastic Shortest Path Problem.
Before giving the proof, we give the two ideas the algorithm relies on. Note that a label corresponds actually to some  path that the algorithm tries to expand in an optimal path (more details are given in the proof below).
The first idea is the following. At any time during the algorithm, is an upper bound on the optimal cost. Suppose that is not tight. If is an  subpath of an optimal solution, then
(5) 
In an enumeration of all the  paths to find an optimal path, any partial path that does not satisfy Equation (5) can thus be discarded.
The second idea is that, when an  path is such that , then can be updated to . Such an update reduces the number of paths satisfying Equation (5).
As it is described, the algorithm computes only the optimal cost of a solution. The algorithm can easily be adapted to find the optimal path itself, simply by maintaining, for each label the label whose expansion has lead to its creation.
Remark 4.
It is easy to deal with the presence of variables with . If , remove and add arcs for with as well as arcs for with .
Proof of Theorem 5.
We associate to each label an  path such that : If is associated to the label and if is obtained by expanding , we define as the path . It is easy to see that there is at most one label associated to a given path. This remark will be useful in the proof.
Initially, is equal to , where is the elementary  path computed at the beginning of the algorithm. Besides, can only decrease during the algorithm. In addition, we have by consistency of with the usual stochastic order, and because . Thus, as only labels such that are expanded, and as, given a path , there is at most one label such that , the number of labels that are expanded during the algorithm is upperbounded by the number of paths such that .
To prove that the number of paths satisfying is finite, we need the following claim.
Let and be random variables satisfying the assumption of Section 1.3 and denote by be the sum of independent copies of . Suppose that . Then there exists an integer such that .
This claim is proved as follows. Given an integer , the event requires that at least copies of are equal to . Using this idea and then the Stirling formula, we obtain . For any integer , we have thus . It implies that for any , where is the maximum value can take, there is a such that when . The quantity is finite, because of the finiteness of the support of . Defining proves the claim.
As a consequence of the claim, there is only a finite number of paths such that . As implies by consistency of with the usual stochastic order, there is only a finite number of paths such that . Hence, only a finite number of labels are expanded and the algorithm terminates after a finite number of iterations.
We prove now that the algorithm returns the correct value. Note that is at any time the cost of some  path. Let be the  path that has updated for the last time. Note that is not necessarily elementary.
Suppose that there is at least one  path, otherwise the algorithm would return . Denote by any elementary  path. There are subpaths of starting at and for which there exists a label such that . The path reduced to the vertex is one of them. Let be such a subpath with the largest number of arcs, be such that , and be the destination of . We also denote by the  subpath of . Since has been chosen with a largest number of arcs, the label has not been expanded. If , we have larger than or equal to the last value of . Otherwise, and we had when has been extracted. Since is nonincreasing during the algorithm and since we have , the cost is necessarily larger than or equal to the last value of , which is larger or equal to the cost of some elementary  path: itself if it is elementary, or the elementary subpath obtained by removing the cycles otherwise. Thus the last value of , which is equal to , is the optimal cost.∎
5.3. Speeding up the algorithm
Keys
We can speed up the algorithm by making a priority queue and using a key equal to for the element . The idea behind this choice is that we give priority to the label that seems to be the most promising, as is a lower bound on the cost of any  having as subpath. The efficiency of the methods depends on the quality of the stochastic lower bound . In such a way, we may discard more partial paths, since the upper bound will likely be smaller than without the use of such keys.
Upper bounds
Suppose that, in addition to the lower bounds , we maintain for each vertex a list , where the are elementary  paths. Then, these paths can be used to update the minimum known cost during the algorithm. Let be a label. The path is an  path. As a consequence, for any distribution , path is an  path. Thus, if , we have identified a path whose cost is smaller than the current upper bound on the cost of the optimal path, and can be updated to . Improving the upper bound during the algorithm enables to reduce the number of labels considered, and thus speeds up the algorithm.
The lists can be built heuristically during some preprocessing. In our experiments, we built them during the computation of the lower bounds with the Stochastic On Time Arrival Problem algorithm.
6. Stochastic Resource Constrained Shortest Path Problem
6.1. Complexity
The Stochastic Resource Constrained Shortest Path Problem is NPhard, since the deterministic case is a special case and is already NPhard.
6.2. Algorithm
As in Section 5.2, we denote by the random variable , where independent copies of ’s appearing several time in the sum are used, and we assume given for each vertex a random variable such that for each  path . We assume moreover given for each vertex the optimal cost of an unconstrained  path. The costs can be efficiently computed using Dijkstra’s algorithm.
The labeling algorithm for the Stochastic Resource Constrained Shortest Path Problem goes as follows. A label is a triple where is a vertex, is a random variable, and is a cost. Labels are stored in a queue . Initially, contains a unique label , and . The algorithm ends when is empty. While is not empty, the following operations are repeated:

Extract a label of .

If and if the inequalities and hold: update to .

Otherwise: If and , expand label : for each arc in , add a new label to .
In the following theorem, we use the notation “”, which means that there exists a random variable such that .
Theorem 6.
Suppose that for each arc we have or and that . If is consistent with the usual stochastic order, then the algorithm described above terminates after a finite number of iterations and at the end, either and the Stochastic Resource Constrained Shortest Path Problem admits no feasible solutions, or is finite and equal to the optimal value of a solution of the Stochastic Resource Constrained Shortest Path Problem.
In the case when , any path is feasible, and the optimal solution of the Stochastic Resource Constrained Shortest Path Problem is the unconstrained shortest path, which can be computed with Dijkstra’s algorithm.
As noted in Section 5.2, this algorithm can easily be adapted to return a shortest path itself, and to deal with arcs such that and by the same kind as the one presented in Remark 4.
We do not give the proof of Theorem 6 since it is very similar to the one of Theorem 5. We nevertheless explain three ideas on which the algorithm relies. They are very similar to the ones used in Section 5.2 for the Stochastic Resource Constrained Shortest Path Problem. Again, a label corresponds to some  path that the algorithm tries to expand in an optimal path
The first idea is the following. If an  path is a subpath of a feasible  path, then
This inequality provides thus a condition that allows to discard partial path that cannot be completed into feasible paths.
The second idea is the following. Assume that is an upper bound on the optimal cost of the Stochastic Resource Constrained Shortest Path Problem. Suppose that is not tight. If is an  path subpath of an optimal solution, then
It can be used to discard partial paths that cannot be completed into optimal paths.
The third idea is the following. Each time a feasible  path satisfying is encountered, we have met a better feasible path and can be updated to .
6.3. Speeding up the algorithm
The same techniques as the ones described in Section 5 can be used to speed up the algorithm.
Keys
The cost , can be used as a key for the element . It represents a lower bound on the best cost that could be obtained with a path extending .
Upper bounds on the complete path
Compared to the Stochastic Shortest Path Problem of Section 5, the only difference in the context of the Stochastic Resource Constrained Shortest Path Problem is that a list of pairs must be stored for each vertex instead of a list of sole random variables .
7. Experimental results
The algorithms have been coded in C++. The priority queue was implemented using the datastructures map and multimap of the C++ standard library. Experiments were carried out on a MacBook Pro with a 2,5 GHz Intel Core i5 processor and 4 Go RAM. Fast Convolution products were performed using the BSD licensed Fast Fourier Transform library KissFFT (Bogerding, 2013).
7.1. Instances
The algorithms were tested on square grid networks of various sizes and distribution types. The origin is the upper left corner of the grid and the destination is the lower right corner of the grid. A rough description of these instances is available on Table 1. The name of each instance indicates the width of the grid, and the distribution. Three types of distributions have been considered: randomly generated generic distributions, lognormal distributions with randomly generated parameters, and gamma distributions with different sizes.
Instances can be found on the following webpage:
http://cermics.enpc.fr/parmenta/shortest_path/
The remaining of this subsection is devoted to additional information regarding the way the instances were generated.
Distributions of the ’s
We describe the way the distributions of arc travel times are built. For all three distributions, the minimum value can take is uniformly drawn at random between and . We denote this minimum by .
The generic distributions are then built as follows. The size of the support is then drawn uniformly at random between and . The quantity is set to , where is generated by selecting at random some prefixed intervals, in which we draw uniformly at random the value of . The prefixed intervals are chosen in a way that enforces strong variations in the value of the variances among the arcs.
Regarding the lognormal (resp. gamma) distributions, a maximum value for the mean is first selected. For the lognormal distributions, M is set to , except for instance g100Ll, for which it is set to . For the gamma distributions, we set . Then, a mean is uniformly generated between and , and a standard deviation is uniformly generated in . The quantity is set to , where is the density of a lognormal (resp. gamma) distributions of mean and variance at time . When becomes smaller than some threshold , it is set to . It ensures a finitesize support.
Since we are expecting the complexity of the operations on distributions to be correlated to the size of paths distributions, we provide in Table 1 the size of the Stochastic On Time Arrival Problem solution distribution support at the origin.
Risk measures
We made the experiments with two risk measures: and .
For the first one, we set to be equal to for some parameter , where is the solution of the Stochastic On Time Arrival Problem at the origin. For the Stochastic Shortest Path Problem, was chosen in . For the Stochastic Resource Constrained Shortest Path Problem, was set to .
We did so because if is too small, then for each path from origin to destination, which implies that all the solutions of the Stochastic Shortest Path Problem have the same solutions, and that the Stochastic Resource Constrained Shortest Path Problem is infeasible. On the contrary, when is too large, all elementary origindestination paths have the same risk measure , which implies that they are all optimal solutions of the Stochastic Shortest Path Problem, and that the Stochastic Resource Constrained Shortest Path Problem is practically an unconstrained deterministic shortest path problem.
For the second risk measure, we made the experiments for the Stochastic Shortest Path Problem with . The values and are usual values of the parameter. While the value is higher than what is usually used for the , we think that in the context of the Stochastic Shortest Path Problem, such a value corresponds to the expected travel time of the worst day in a week, which sounds reasonable when a commuter searches an optimal path. For the Stochastic Resource Constrained Shortest Path Problem, was set to .
Additional parameters in the case of the Stochastic Resource Constrained Shortest Path Problem
The Stochastic Resource Constrained Shortest Path Problem requires two additional parameters: the resource constraint and the arc costs . We set to be equal to for some . We use