A Fast and Simple Algorithm for the Resource Constrained Shortest Path Problem
Abstract
Constrained pathfinding is a classic yet challenging network optimization problem with broad applicability across many real-world domains. The Resource-Constrained Shortest Path (RCSP) problem focuses on finding cost-optimal paths that satisfy multiple resource constraints. In this paper, we propose a novel heuristic-guided search framework that accelerates constrained search in large-scale networks, including those with negative costs and resources, by leveraging efficient queuing and pruning strategies. Experimental results on real-world benchmark maps show that our framework achieves up to two orders of magnitude speedup over state-of-the-art methods, demonstrating its effectiveness in solving challenging RCSP instances within limited time.
Keywords and phrases:
constrained pathfinding, shortest path problem, heuristic searchCopyright and License:
2012 ACM Subject Classification:
Computing methodologies Search methodologies ; Theory of computation Shortest pathsFunding:
This research was supported by the Department of Climate Change, Energy, the Environment and Water under the International Clean Innovation Researcher Networks (ICIRN) program grant number ICIRN000077. Mahdi Jalili is supported by Australian Research Council through projects DP240100963, DP240100830, LP230100439 and IM240100042.Editors:
Anne Benoit, Haim Kaplan, Sebastian Wild, and Grzegorz HermanSeries and Publisher:
Leibniz International Proceedings in Informatics, Schloss Dagstuhl – Leibniz-Zentrum für Informatik
1 Introduction
The Resource Constrained Shortest Path (RCSP) problem is a fundamental yet challenging network optimization problem. It focuses on finding cost-optimal paths between two nodes in a graph while adhering to constraints on the utilization of limited, potentially multidimensional resources. Many real-world problems can be modeled as an RCSP instance. Examples are planning time-constrained explorable non-shortest routes in roaming navigation applications [24], and finding energy efficient paths with detour limits for electric vehicles [4]. As a subproblem, RCSP has been utilized to solve orienteering problems [33], and the vehicle routing problem [12]. RCSP is an NP-Hard problem even for single resource constraint [16].
RCSP and its single-constraint variant, the Weight Constrained Shortest Path (WCSP) problem, have been studied in the literature for decades. Traditional solutions to RCSP are generally based on path ranking, dynamic programming (labeling) or branch-and-bound (B&B) approaches [25, 13], but recent studies have demonstrated that the labeling method is more effective for solving large-scale RCSP instances. The recent RCBDA* algorithm [31] is a labeling method that utilizes the dynamic programming approach presented in [29] to perform a bidirectional A* search guided by cost heuristics, using rigorous yet costly pruning rules to avoid exploring unpromising paths. Complete paths in this algorithm are obtained by matching backward and forward partial paths, and the amount of a critical resource available to each search is half of the total budget. The authors concluded that RCBDA* can perform faster than two other existing RCSP approaches on many instances, namely the Pulse algorithm (B&B method) [22] and the CSP (path ranking) approach in [30]. A parallel bidirectional search framework on the basis of Pulse was later developed in [10], known as BiPulse. This algorithm utilizes the the queuing mechanism developed in [9] to limit the depth of the Pulse search and postpone the exploration of deep branches of the search tree, where halted partial paths are explored in a breadth-first search manner. The authors reported better performance and more solved cases with BiPulse compared to RCBDA*. Both BiPulse and RCBDA* received awards for their contribution to RCSP [15]. WCEBBA* [3], WCA* [6] and WCBA* [5] are three other A*-based methods that leverage fast pruning rules in recent bi-objective search literature [32, 2] to tackle constrained pathfinding more efficiently. Although all of the algorithms have been shown to outperform RCBDA* and BiPulse on large graphs, their application is limited to instances with a single resource constraint. Another recent A*-based RCSP method, called ERCA* [27], takes advantage of recent advancements in multi-objective search with A* [26, 28] to improve the efficiency of its pruning rules through binary search trees. Like other A*-based methods, the search in ERCA* is guided by cost heuristics and prunes unpromising paths. Its pruning involves rigorously discarding any path that exceeds the resource budget or is dominated (i.e., no better in cost and resource usage) by another previously extended path to the same node, both before and during path extension. The authors reported several orders of magnitude faster runtime for ERCA* when compared with BiPulse. However, the performance of ERCA* against RCBDA* remains unknown. All of the above algorithms are designed and evaluated for problem instances with non-negative cost and resources.
Contributions.
This paper presents a novel and straightforward label-setting framework built upon A*, called NWRCA*, which incorporates effective search and lazy pruning strategies to accelerate constrained pathfinding in large-scale networks with negative costs and resources. We evaluate the framework in two variants that differ slightly in how they maintain search labels, and we investigate a faster method for computing A*’s heuristics that can potentially replace the conventional reweighting approach when dealing with negative-weight graphs. Extensive experiments demonstrate the success of the framework in solving difficult RCSP instances several orders of magnitude faster than ERCA* and RCBDA*.
2 Problem Definition
Consider an RCSP problem with resource limits is provided as a directed graph with a set of vertices and a set of edges . Every edge of the graph has attributes, represented as where is a form of vector (denoted boldface). An acyclic path consists of distinct vertices , where and for . The cost and resource usage of a path are determined by summing the attributes of all edges that make up the path. The RCSP problem aims to find (at least) one -optimal paths from (start or origin) to (goal or destination) such that the resource usages of the path are within the given limits, that is, we must have for each resource .
In line with the notation in the RCSP literature, we refer to our search objects as labels. Each label encapsulates the key information about a partial path from and is associated with an end vertex (last vertex of the path). Label traditionally stores value pairs and that measure the and of the path, respectively. Additionally, includes , a reference to the parent label of , and , an estimate of the of a complete path to by extending . Specifically, for each search label associated with vertex , we have where is a consistent heuristic function [17].
Definition 1.
The heuristic function is admissible iff for every , where is a -optimal path from to . is consistent if we have for every .
We assume all operations on the resource vectors are performed element-wise. In addition, we use the symbol for direct comparisons of resource vectors, e.g., denotes of label is no greater than that of label for all . Analogously, we use the symbol if the relation cannot be satisfied. We now define dominance over labels.
Definition 2.
Label is weakly dominated by label if we have and ; is strongly dominated by if and but or ; is not dominated by if or .
3 Resource Constrained Pathfinding with A*
Constrained pathfinding with A* involves a systematic search by exploring labels in best-first order, meaning that the search is guided by the partial path with the smallest estimate or -value.
Each iteration involves three main steps:
i) Extraction: remove one least- label from a priority queue , also known as Open list.
ii) Dominance pruning: skip exploring labels that are weakly dominated by at least one other label (with the same vertex);
iii) Expansion: generate new descendant labels, check them for feasibility (against resource limits), and, if not pruned, store them in for further expansion.
The search in this framework generally terminates once an optimal solution is found, or there is no label in to explore, where the latter means there is no feasible solution.
If there is only one resource, it is shown that dominance pruning can be done in constant time when performing best-first search [5, 6].
Nonetheless, this is not the case in RCSP with multiple resources and the dominance pruning remains a costly task.
RCSP with negative weights.
Many real-world RCSP problems deal with attributes that are negative in nature, such as energy recuperation in electric vehicles, or attributes that may exhibit negative values in specific circumstances, such as negative reduced costs in column generation or pricing problems [19]. Although recent A*-based RCSP solutions, such as ERCA* and RCBDA*, are primarily designed and evaluated for problem instances with non-negative edge attributes, they can be adapted to be used for instances with negative weights (but no negative cycles). This can be achieved through a graph reformulation phase, where all edge weights are shifted to non-negative values, for example, using Johnson’s reweighting technique [21]. However, as we will show in this section, our constrained search framework can be applied directly to graphs with negative edge weights, provided that its heuristic is consistent. With this introduction, we now describe our new RCSP algorithm.
Our approach.
Algorithm 1 presents the pseudocode of NWRCA*, our A*-based RCSP method that employs lazy dominance checks and can handle problem instances with negative edge weights (but no negative cycles). The algorithm begins by initializing a priority queue and a global cost upper bound , which maintains the best-known cost of any feasible solution found during the search. For each vertex , it also initializes a list to store the non-dominated labels resulting from all prior expansions (i.e., closed labels) associated with vertex . Like other A*-based RCSP algorithms, NWRCA* requires a heuristic function to establish -values. To enhance pruning of unpromising paths, we also compute lower bounds on using an admissible heuristic function . These cost and resource heuristics can be computed using single-objective Dijkstra runs [11], with re-expansions allowed to accommodate negative weights [20], assuming there are no negative cycles on any path from to in any dimension (cost or resources). A similar strategy has been explored in [1] for multi-objective search. As we will demonstrate in the experimental section, this heuristic construction method, despite its exponential worst-case complexity, often outperforms alternatives such as Johnson’s reweighting technique [21] in practice. NWRCA* then initializes a label with and inserts it into . Each iteration of the main search starts at line 8. Let be a non-empty queue. The algorithm extracts in each iteration a label with the smallest -value (line 9) and attempts the following steps.
Lazy dominance check.
NWRCA* borrows a lazy label pruning technique from the multi-objective search literature and delays dominance check of newly generated labels until they are extracted from , as in [18] and [1]. Let be a label extracted from with -value within the global upper bound. Also let be the end vertex associated with . Because the first dimension is always explored in sorted order (guaranteed in A* with a consistent heuristic), we observe that is already weakly dominated by previous expansions in terms of . Note that all expansions with use as lower bound. As a result, all prior expansions of must have exhibited -value no smaller than . This means that the dominance test can only be done by comparing the resource vector of , that is, , with that of (potentially all) previous expansions stored in . This process can be further improved by prioritizing the most recent expansion of as the first (potentially more informed) candidate for a quick dominance check, prior to a more rigorous dominance check against the labels of [1]. The expansion of label can be skipped if it is found to be dominated by any previously expanded label (lines 13-16). If is determined to be non-dominated, NWRCA* removes from the list any label whose resource vector is weakly dominated by (lines 18-19), and then adds to for future dominance checks at vertex (line 20). This removal is correct because any future label that would be dominated by will also be dominated by , making it unnecessary to keep the now-redundant label in .
Capturing solutions.
A tentative solution path is found if the search extracts a non-dominated label associated with the goal vertex (line 21). Expansion of solution labels is not necessary. However, in the absence of tie-breaking in , new solutions may offer better resources than previous ones. NWRCA* takes care of this situation by maintaining only non-dominated labels associated with the goal vertex in .
Expansion.
’s expansion involves generating new descendant labels through ’s successors (adjacent vertices). Given as an admissible heuristic function, descendant labels with estimated resource usage exceeding the given limit cannot lead to a feasible solution and can be pruned (line 30). Note that in the case of negative resources, new labels whose usage of exceeds the budget (i.e., ) can be pruned, provided that all partial paths are also required to satisfy the resource constraints (which is not assumed in this work). As part of NWRCA*’s lazy dominance pruning rule, newly generated labels are not checked for dominance against previously expanded labels or those still in ; instead, they are only checked when extracted from the queue. Thus, each descendant label will be added to if its estimated usage of to is within .
Termination.
NWRCA* explores labels based on their -value in ascending order. Given as global upper bound, the search can terminate safely once it extracts a label with -value greater than (line 10). Although this upper bound is initially unknown, it will get updated as soon as a feasible solution is discovered (line 22). The algorithm returns , a set containing -optimal labels with non-dominated (line 32). If there is no solution to a given instance (i.e., is never reached), this set would remain empty.
| It. | Generated but Pruned | ||
| 1 | |||
| 2 | |||
| 3 | |||
| 4 | |||
| 5 | |||
| 6 | |||
| 7 | |||
| 8 | |||
| 9 | |||
| 10 |
Example.
We further elaborate on the key steps of NWRCA* by solving a sample RCSP instance with three edge attributes (two resources), depicted in Figure 1. We assume resource limits are . The vertices and denote and , respectively. The graph is free of negative cycles, and the values inside each vertex denote and , calculated prior to the main search via three single-objective backward searches. We briefly explain all iterations (It.) of NWRCA* for the given instance, with the trace of and sets provided in Table 1. Pruned labels of each iteration are shown in the third column. For label extractions, we adopt the Last-In, First-Out (LIFO) strategy in the event of ties in -values of labels present in . The queue is initialized with the first label associated with .
-
It.1: The search starts with expanding the initial label . Since is the first expansion of and thus non-dominated, it is stored in . Expansion of generates three new labels: , , and . and are added to but is pruned as its resource estimates are out of bounds, i.e., we have .
-
It.2: There are two labels in . has the smallest -value and is expanded first. is non-dominated and its expansion generates and with and , respectively. Both labels are pruned since their resource estimates are out of bounds.
-
It.3: , associated with , is the only label in and is extracted. will be stored in as a non-dominated label. ’s expansion generates three new labels: , , and . However, only two of these are within the resource bounds and can be added to . is out of bounds as we have for its second resource estimate.
-
It.4: There are two labels in , both with the same -value. is extracted based on the LIFO strategy. is non-dominated, as this is the first expansion with . Expansion of generates two new labels ( and , both within the bounds) and adds them to .
-
It.5: is extracted based on the LIFO strategy. is non-dominated and its expansion generates two labels and , but only is added into as the second resource estimate for is not within the bound, i.e., we have .
-
It.6: There are three labels in , all with the same -value. The recent insertion is extracted with . This yields the first solution path, followed by updating . does not get expanded.
-
It.7: is extracted, and it appears as a non-dominated solution. However, ’s resource vector dominates that of the previous solution. Thus, replaces in .
-
It.8: is extracted. is a non-dominated label but dominates and replaces in . Expansion of generates two new labels ( and ). Both labels are within the resource bounds and thus added into .
-
It.9: is extracted with . is non-dominated and is added to . does not dominate the previous solution.
-
It.10: is extracted. Given the upper bound updated in It.6, the search terminates due to surpassing the upper bound , i.e., we have .
The example above shows how NWRCA* processes labels in the order of their -value. As we observed in It.6, NWRCA* may capture a dominated solution in the absence of tie-breaking, but we discussed in It.7 how the search refines the set in such circumstances to keep of solution paths non-dominated. We now briefly discuss the key differences of NWRCA* with two recent RCSP approaches, namely ERCA* and RCBDA*.
NWRCA* vs. ERCA*.
Although both algorithms utilize best-first search to guide their constrained search, they differ in four key aspects regarding how labels are handled: (1) ERCA* checks labels for both dominance and resource usage once during expansion and again before expansion, whereas NWRCA* performs upper bound pruning only during expansion and dominance check only before expansion; (2) ERCA* explores labels in lexicographical order of their in case of ties between -values in the queue (i.e., it compares labels based on resources in order, starting from the first resource), whereas NWRCA* does not perform tie-breaking; (3) ERCA* uses a specialized and relatively complex data structure (balanced binary search tree) to organize and dominance check labels during the search, whereas expanded labels in NWRCA* are stored in simple lists; (4) ERCA* immediately terminates upon finding a feasible solution, whereas NWRCA* terminates with all non-dominated solutions.
NWRCA* vs. RCBDA*.
The algorithms differ in four key aspects: (1) RCBDA* conducts a bidirectional A* search, requiring a specialized and time-intensive procedure to handle frontier collisions (joining bidirectional labels), whereas NWRCA* performs a simple unidirectional search. (2) RCBDA* checks new labels for dominance against all previous expansions of the vertex, whereas NWRCA* only checks against labels with non-dominated ; (3) RCBDA* checks labels for dominance only during expansion, which can lead to the expansion of dominated labels, whereas NWRCA* performs dominance checks before expansion; (4) Similar to ERCA*, RCBDA* does not compute all non-dominated solutions.
4 Theoretical Results
This section provides a formal proof for the correctness of constrained search of NWRCA* and presents theoretical results on why the algorithm can solve RCSP instances with negative weights but no negative cycles. Throughout this section, we assume there is no negative cycle on any path from start vertex () to goal vertex () in any dimension, and thus consistent and admissible heuristic functions and can be computed for the problem instance.
Lemma 3.
Assume the constrained A* search is guided by smallest (potentially negative) -values. Let and be labels extracted from in two consecutive iterations of the search. We have if is consistent.
Proof.
We distinguish two cases: i) if was available in at the time was extracted, the lemma is trivially true. ii) otherwise, is the descendant label of . For an edge linking to its descendant , ’s consistency ensures . Adding the cost to both sides of the inequality yields .
Corollary 4.
Consider the sequence of labels extracted from . If is consistent, then according to the conditions of Lemma 3, guarantees that . In other words, the -values of the extracted labels do not decrease throughout the process.
Lemma 5.
Suppose is extracted after , both with the same vertex. weakly dominates if .
Proof.
Since is extracted before , we have according to Corollary 4, and consequently . The other condition means that is no smaller than in all resources, verifying is weakly dominated by .
Lemma 6.
Let be a label weakly dominated by a previously explored label , both associated with the same vertex. The expansion of is not necessary.
Proof.
We prove this by contradiction, assuming that ’s expansion is necessary to obtain a -optimal and non-dominated solution path. As weakly dominates , it holds that and . In this scenario, the partial path represented by can be replaced with the one represented by , resulting in a path that is better than or equal to the optimal solution path obtained via . If the resulting path is better, it contradicts the assumption of ’s expansion leading to a non-dominated or optimal solution. If both paths are identical in terms of and , it becomes clear that the expansion of has been sufficient, and thus expanding is unnecessary, again contradicting the assumption. Therefore, we conclude that expanding the weakly dominated label is not necessary.
Lemma 7.
The expansion of label is not necessary if or .
Proof.
Given that is admissible, the second condition ensures that expanding towards cannot yield a solution within the resource limits. Similarly, since is admissible, the first condition guarantees that ’s expansion cannot produce a solution with a better than the best-known upper bound . Therefore, expanding cannot contribute to any optimal solution path, and thus is not necessary.
Theorem 8.
NWRCA* produces all -optimal solution paths with non-dominated resources for the RCSP problem.
Proof.
The algorithm explores all feasible search labels from towards in best-first order, in search of all optimal solutions. Labels are checked for dominance (Lemma 5) before expansion, and weakly dominated ones can be safely pruned, as they offer no improvement over previously expanded labels (with the same vertex) in either or (Lemma 6). Labels violating the upper bounds can similarly be pruned safely (Lemma 7). The algorithm also retains only non-dominated labels in the lists. This procedure is correct because if a recently extracted label weakly dominates a previously explored label , then any future label that would have been weakly dominated by is already weakly dominated by , rendering the storage of redundant. Building on the above, we just need to show that the algorithm terminates with returning non-dominated labels. NWRCA* prunes all weakly dominated labels, but captures all non-dominated labels with . However, since it does not process labels in any specific order of their , some tentative solutions may later appear dominated. Let be a new non-dominated solution extracted after solution . We must have , otherwise the algorithm was terminated if . In this case, the dominance check in lines 18-19 of Algorithm 1 removes from if it is deemed to be weakly dominated by new solution (in terms of ). Once the search exceeds , Corollary 4 ensures that expanding the remaining labels in cannot produce solutions with a primary cost better than . Thus, the termination criterion is correct, and NWRCA* returns as the set of all -optimal, non-dominated solution labels.
5 Empirical Analysis
We evaluate the constrained search performance of NWRCA* against two recent A*-based RCSP approaches: the award-winning RCBDA* algorithm [31] and ERCA* [27]. We did not consider BiPulse [10] as prior work [27] has demonstrated that it is outperformed by ERCA*. The algorithms were evaluated on 600 instances across three maps (NY, BAY, and COL) from the 9th DIMACS Implementation Challenge111http://www.diag.uniroma1.it/challenge9, featuring road networks with 264K to 435K vertices and 733K to 1M edges. For each map, we generated 25 random (,) pairs to be evaluated on four levels of tightness, resulting in 100 test cases. We study each test case in scenarios with two and three resources (). Following the RCSP literature, we define each resource limit for based on the tightness of the constraint as:
where and represent the upper and lower bounds on for paths from to , respectively. The upper bound is set by the (non-constrained) -optimal path. We choose the same for all resources.
To evaluate the algorithms on graphs with non-correlated but negative weights, following our previous work [1], we first enriched each map with Shuttle Radar Topography Mission222https://www2.jpl.nasa.gov/srtm/ height data, and set the edge weights of each map with four new attributes as follows. The of each edge is the energy requirement of an electric vehicle with three passengers on board, using the energy model in [7]. The calculated energy can be negative in some downhill links due to energy recuperation. We deliberately did not impose a bound on battery capacity, enabling the use of plain constrained search for computing energy-efficient paths. We chose a penalized height function for . Given as elevation of vertex , the second attribute of link is set to for uphill links, and for downhill links (negative). For and , we employed the (reversed) Johnson’s technique to generate cycle-free but random negative weights in two steps: i) we first assigned a random integer in the [-100,0] range, known as potential, to each vertex; ii) we then set the third cost of each link to be the potential difference between and , which was then added by a random integer in the [0, 10] range. The result is two sets of randomized negative weights in the [-100, 110] range with no negative cycle, which ensures the applicability of the selected algorithms over the instances. Note that the first and second dimensions cannot contain negative cycles due to the nature of the chosen metrics. The average percentage of negative weights observed across the maps for [] is [10, 42, 45, 45]%, respectively.
Implementation.
We used the publicly available C++ implementations of ERCA* and developed an improved version of RCBDA* in C++ based on its provided description. In doing so, we addressed a potential inefficiency in the design related to the label matching strategy of RCBDA*: rather than storing all expanded labels in a large pool and searching for complimentary labels (which adds unnecessary overhead in identifying the same matching vertex), we allocated a separate set for each vertex, optimizing the matching of partial paths during the bidirectional search. Additionally, the original description of RCBDA* does not include any dominance or infeasibility pruning rules. Nonetheless, our implementation incorporates these strategies, thereby improving its search efficiency. Both RCBDA* and ERCA* were provided with reweighted graphs (and budgets), ensuring that instances can be handled correctly in the presence of negative weights. We implemented our NWRCA* algorithm in C++, providing two variants that differ slightly in their label ordering mechanisms:
-
NWRCA*v1: (i) labels in lists are maintained in lexicographical order based on their -value, (ii) unexplored labels are ordered in a bucket-based queue and extracted using a LIFO strategy in the event of ties in their -values (as in WCA* [6]).
-
NWRCA*v2: (i) labels in lists are not maintained in any specific order, (ii) unexplored labels are ordered in a binary heap queue and extracted in lexicographical order of their resource estimates (i.e., ) in the event of ties in their -values.
These variants allow us to investigate the impact of lexicographical label ordering in both and lists on search performance. Note that the correctness of NWRCA* does not depend on labels being ordered lexicographically by and in . Keeping non-dominated labels in lexicographical order within each list in the first variant allows for partial traversal over labels of the list for both dominance checking and removal of dominated labels, but it incurs an additional sorting overhead (see [1] for more details). In contrast, the second variant provides faster insertion/removal of labels to/from the list (with minimal ordering overhead), but requires two linear scans over all labels in , one to ensure that a newly extracted label is non-dominated and another to remove any dominated labels from the list.
We compiled all C++ code using the GCC7.5 compiler and optimization level O3. The experiments were conducted on a single core of an Intel Xeon Platinum 8175 processor, clocked at 2.5GHz, with 16GB of RAM and a one-hour time limit per run. It is worth mentioning that RCBDA* and both variants of NWRCA* were implemented within the same framework, using the same data structures to manage labels. Therefore, the performance comparisons between the algorithms are head-to-head. Our code is publicly available333https://bitbucket.org/s-ahmadi/multiobj.
| Reweighting time (s) | Lower bounding (s) | |||||
|---|---|---|---|---|---|---|
| Approach | NY | BAY | COL | NY | BAY | COL |
| Graph Reformulation (Johnson) | 1.64 | 2.92 | 4.02 | 0.41 | 0.50 | 0.54 |
| Modified Dijkstra | - | - | - | 0.52 | 1.00 | 1.02 |
Computation of heuristics.
Our first analysis explores two approaches for computing heuristic functions for instances with three resources: (i) graph reformulation using Johnson’s technique (as in ERCA*), and (ii) a modified version of Dijkstra’s algorithm that allows for re-expansions. For the first approach, we used the improved Bellman-Ford algorithm [23, 8, 14] to reweight edge costs, followed by Dijkstra’s to compute lower bounds. In case of RCBDA*, two rounds of lower-bound computation are required (one for the forward search and another for the backward search). Table 2 compares the average computation time for both approaches, assuming unidirectional heuristics are needed (as in ERCA* and NWRCA*). We observe that, the approach (i) requires a considerable amount of time to preprocess the graphs but enables faster computation of lower bounds, whereas the second approach, using modified Dijkstra’s algorithm, delivers 3.5 to 4 times faster overall processing time without the need for reweighting in our (sparse) road networks. While approach (ii) can be advantageous in scenarios where the graph configuration changes between queries, it may be up to twice as slow compared to approach (i) when the search graph is static and already reweighted, though the difference is less than 0.5 seconds. Nonetheless, computing heuristic functions for NWRCA* using approach (ii) offers several benefits: i) it provides a simple yet efficient setup for constrained A* search with negative weights; ii) it eliminates the need for a time-intensive graph reformulation step, which is advantageous in dynamic scenarios; iii) it performs comparably to conventional methods when weights are non-negative (would be equivalent to standard Dijkstra).
| Search time (s) | Search time (s) | ||||||||||
| Map | Algorithm | MeanA | MeanG | Max. | MeanA | MeanG | Max. | ||||
| NY | NWRCA*v1 | 100 | 1.01 | 0.24 | 11.0 | - | 100 | 33.29 | 2.89 | 461.0 | - |
| NWRCA*v2 | 100 | 3.24 | 0.59 | 38.1 | 2.5 | 100 | 108.21 | 7.73 | 1607.3 | 2.5 | |
| ERCA* | 100 | 66.04 | 11.46 | 765.5 | 50.5 | 67 | 1513.00 | 217.35 | 3600.0 | 93.7 | |
| RCBDA* | 100 | 18.91 | 1.74 | 31.1 | 12.1 | 86 | 803.41 | 44.62 | 3600.0 | 44.8 | |
| BAY | NWRCA*v1 | 100 | 3.31 | 0.54 | 31.1 | - | 100 | 125.21 | 8.65 | 1803.5 | - |
| NWRCA*v2 | 100 | 10.20 | 1.31 | 124.6 | 2.4 | 96 | 335.69 | 22.84 | 3600.0 | 2.5 | |
| ERCA* | 95 | 306.88 | 27.28 | 3600.0 | 50.0 | 54 | 1922.49 | 479.12 | 3600.0 | 98.9 | |
| RCBDA* | 97 | 208.72 | 6.41 | 3600.0 | 28.8 | 73 | 1320.69 | 136.40 | 3600.0 | 122.0 | |
| COL | NWRCA*v1 | 100 | 2.14 | 0.50 | 21.9 | - | 100 | 67.92 | 7.70 | 720.7 | - |
| NWRCA*v2 | 100 | 6.18 | 1.22 | 61.3 | 2.4 | 100 | 201.75 | 19.63 | 1797.5 | 2.4 | |
| ERCA* | 97 | 204.77 | 26.46 | 3600.0 | 52.3 | 60 | 1779.38 | 468.34 | 3600.0 | 96.0 | |
| RCBDA* | 96 | 297.38 | 9.68 | 3600.0 | 379.0 | 72 | 1346.47 | 169.16 | 3600.0 | 112.4 | |
| Instances with two resources | Instances with three resources | ||||||||||
Algorithmic performance.
Table 3 presents the experimental results for both scenarios (). It displays the number of test cases successfully solved (), the arithmetic and geometric mean (MeanA and MeanG) and maximum constrained runtime observed (in seconds) by each algorithm. To enable a fair comparison of actual search performance across algorithms, and since all algorithms use same heuristic functions, we exclude preprocessing times (graph reformulation and lower bounding) from our runtime analyses. Therefore, the runtimes reported in this table refer solely to resource-constrained search time. All algorithms solved their easiest instances in less than 0.1 seconds. For unsolved cases, the search time is recorded as the timeout. It can be observed that both variants of NWRCA* have successfully solved almost all instances for each map in both scenarios, except for the BAY map where NWRCA*v2 leaves four instances unsolved. The outperformance is even more pronounced in the BAY and COL maps with , where ERCA* and RCBDA* could solve less than 75% of cases. In terms of computation time, both variants of NWRCA* deliver significantly better performance than ERCA* and RCBDA* in all metrics. The detailed results reveal that NWRCA*v1 consistently outperforms other algorithms, including NWRCA*v2, across nearly all instances, successfully solving its most challenging case in under 31 minutes.
The parameter in the last column of Table 3 presents the (arithmetic) average slowdown factor for each algorithm relative to the top-performing algorithm, NWRCA*v1. This factor is calculated by comparing the search time of each mutually solved instance with the corresponding search time of NWRCA*v1, highlighting the relative slowdown. We also show in Figure 2 (Left) the runtime distribution of NWRCA*v1 against other algorithms over instances of all maps with three resources (). Based on the results, NWRCA*v2 performs nearly 2.5 times slower than NWRCA*v1. This difference in performance is primarily due to NWRCA*v2’s costly queuing process, which requires lexicographical ordering of labels in (tie-breaking with ), and NWRCA*v1’s more efficient label pruning mechanism. This improved pruning efficiency, in particular, stems from the partial traversal of the lists, where non-dominated labels are maintained in lexicographical order of their .
Larger slowdown factors are observed for ERCA* and RCBDA*, with both algorithms being outperformed by up to two orders of magnitude on average. The more than one order of magnitude performance gap between ERCA* and NWRCA* is primarily due to NWRCA*’s more efficient lazy pruning strategy and its simpler yet effective data structure for dominance checks, both contributing to significantly faster search times. In contrast, ERCA* suffers from a more rigid dominance pruning strategy that attempts to eliminate dominated and infeasible labels both at generation time and again upon extraction from the queue. While early dominance checks can help reduce queue size, they add computational overhead when applied to non-dominated labels. Furthermore, rechecking resource feasibility after extraction is redundant, as resource limits remain unchanged throughout the search, resulting in wasted computation and reduced efficiency.
Figure 2 (Right) also shows the number of solved cases for each algorithm, sorted by runtime, on the COL map with three resources. We observe that both variants of NWRCA* solve 60% of instances within 50 seconds, whereas ERCA* and RCBDA* require above 17 minutes to achieve the same success rate. In summary, both variants of NWRCA* demonstrate significantly faster performance than the state of the art in terms of computation time, with NWRCA*v1 being approximately twice as fast as NWRCA*v2.
ERCA* vs. RCBDA*.
No performance comparison was provided between ERCA* and RCBDA* by the authors of ERCA*. Our results show that, while the improved RCBDA* algorithm solves more instances and achieves better average runtimes than ERCA* on certain maps, it does not consistently outperform ERCA*. The strong performance of RCBDA* in many instances is due to its bidirectional framework, which combines perimeter and alternating search strategies. In terms of worst-case runtime performance (Figure 2 (Left)), ERCA* generally performs better than RCBDA* but tends to be consistently around two orders of magnitude slower than NWRCA*v1, whereas RCBDA* can be over three orders of magnitude slower than NWRCA*v1 in some cases.
6 Conclusion
This paper introduced a novel, fast heuristic-guided label-setting approach with effective pruning mechanisms for efficiently solving resource-constrained shortest path (RCSP) problems in large-scale graphs. Unlike existing methods that aim to find a feasible solution, our framework identifies all non-dominated optimal solutions for a given RCSP instance. It also naturally handles instances with negative costs and resources, provided the cost heuristic is consistent and the search graph contains no negative cycles. We explored different configurations of the framework, distinguished by how heuristics are derived and how search labels are stored and explored during the search process. Experimental results highlight the importance of efficient ordering of labels in constrained search over large graphs and demonstrate the superiority of the proposed framework in solving challenging RCSP instances within tight time limits, outperforming state-of-the-art methods, including an enhanced version of the award-winning RCBDA* algorithm, by up to two orders of magnitude on average.
References
- [1] Saman Ahmadi, Nathan R. Sturtevant, Daniel Harabor, and Mahdi Jalili. Exact multi-objective path finding with negative weights. In Sara Bernardini and Christian Muise, editors, Proceedings of the Thirty-Fourth International Conference on Automated Planning and Scheduling, ICAPS 2024, Banff, Alberta, Canada, June 1-6, 2024, pages 11–19. AAAI Press, 2024. doi:10.1609/ICAPS.V34I1.31455.
- [2] Saman Ahmadi, Guido Tack, Daniel Harabor, and Philip Kilby. Bi-objective search with bi-directional A*. In Petra Mutzel, Rasmus Pagh, and Grzegorz Herman, editors, 29th Annual European Symposium on Algorithms, ESA 2021, September 6-8, 2021, Lisbon, Portugal (Virtual Conference), volume 204 of LIPIcs, pages 3:1–3:15. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2021. doi:10.4230/LIPIcs.ESA.2021.3.
- [3] Saman Ahmadi, Guido Tack, Daniel Harabor, and Philip Kilby. A fast exact algorithm for the resource constrained shortest path problem. In Thirty-Fifth AAAI Conference on Artificial Intelligence, AAAI 2021, Virtual Event, February 2-9, 2021, pages 12217–12224. AAAI Press, 2021. doi:10.1609/AAAI.V35I14.17450.
- [4] Saman Ahmadi, Guido Tack, Daniel Harabor, and Philip Kilby. Vehicle dynamics in pickup-and-delivery problems using electric vehicles. In Laurent D. Michel, editor, 27th International Conference on Principles and Practice of Constraint Programming, CP 2021, Montpellier, France (Virtual Conference), October 25-29, 2021, volume 210 of LIPIcs, pages 11:1–11:17. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2021. doi:10.4230/LIPIcs.CP.2021.11.
- [5] Saman Ahmadi, Guido Tack, Daniel Harabor, and Philip Kilby. Weight constrained path finding with bidirectional A*. In Lukás Chrpa and Alessandro Saetti, editors, Proceedings of the Fifteenth International Symposium on Combinatorial Search, SOCS 2022, Vienna, Austria, July 21-23, 2022, pages 2–10. AAAI Press, 2022. doi:10.1609/SOCS.V15I1.21746.
- [6] Saman Ahmadi, Guido Tack, Daniel Harabor, Philip Kilby, and Mahdi Jalili. Enhanced methods for the weight constrained shortest path problem. Networks, 84(1):3–30, 2024. doi:10.1002/net.22210.
- [7] Saman Ahmadi, Guido Tack, Daniel Harabor, Philip Kilby, and Mahdi Jalili. Real-time energy-optimal path planning for electric vehicles. arXiv preprint arXiv:2411.12964, 2024. doi:10.48550/arXiv.2411.12964.
- [8] Richard Bellman. On a routing problem. Quarterly of applied mathematics, 16(1):87–90, 1958.
- [9] Manuel A. Bolívar, Leonardo Lozano, and Andrés L. Medaglia. Acceleration strategies for the weight constrained shortest path problem with replenishment. Optim. Lett., 8(8):2155–2172, 2014. doi:10.1007/s11590-014-0742-x.
- [10] Nicolás Cabrera, Andrés L. Medaglia, Leonardo Lozano, and Daniel Duque. An exact bidirectional pulse algorithm for the constrained shortest path. Networks, 76(2):128–146, 2020. doi:10.1002/net.21960.
- [11] Edsger W. Dijkstra. A note on two problems in connexion with graphs. Numerische Mathematik, 1:269–271, 1959. doi:10.1007/BF01386390.
- [12] Dominique Feillet, Pierre Dejax, Michel Gendreau, and Cyrille Gueguen. An exact algorithm for the elementary shortest path problem with resource constraints: Application to some vehicle routing problems. Networks, 44(3):216–229, 2004. doi:10.1002/NET.20033.
- [13] Daniele Ferone, Paola Festa, Serena Fugaro, and Tommaso Pastore. On the shortest path problems with edge constraints. In 22nd International Conference on Transparent Optical Networks, ICTON 2020, Bari, Italy, July 19-23, 2020, pages 1–4. IEEE, 2020. doi:10.1109/ICTON51198.2020.9203378.
- [14] Lester R Ford Jr. Network flow theory. Technical report, Rand Corp Santa Monica Ca, 1956.
- [15] Bruce L. Golden and Douglas R. Shier. 2019–2020 glover-klingman prize winners. Networks, 2021. doi:10.1002/net.22072.
- [16] Gabriel Y. Handler and Israel Zang. A dual algorithm for the constrained shortest path problem. Networks, 10(4):293–309, 1980. doi:10.1002/net.3230100403.
- [17] Peter E. Hart, Nils J. Nilsson, and Bertram Raphael. A formal basis for the heuristic determination of minimum cost paths. IEEE Trans. Syst. Sci. Cybern., 4(2):100–107, 1968. doi:10.1109/TSSC.1968.300136.
- [18] Carlos Hernández, William Yeoh, Jorge A Baier, Ariel Felner, Oren Salzman, Han Zhang, Shao-Hung Chan, and Sven Koenig. Multi-objective search via lazy and efficient dominance checks. In Proceedings of the Thirty-Second International Joint Conference on Artificial Intelligence, pages 7223–7230, 2023.
- [19] Gerhard Hiermann, Jakob Puchinger, Stefan Ropke, and Richard F. Hartl. The electric fleet size and mix vehicle routing problem with time windows and recharging stations. Eur. J. Oper. Res., 252(3):995–1018, 2016. doi:10.1016/J.EJOR.2016.01.038.
- [20] Donald B Johnson. A note on dijkstra’s shortest path algorithm. Journal of the ACM (JACM), 20(3):385–388, 1973. doi:10.1145/321765.321768.
- [21] Donald B. Johnson. Efficient algorithms for shortest paths in sparse networks. J. ACM, 24(1):1–13, 1977. doi:10.1145/321992.321993.
- [22] Leonardo Lozano and Andrés L. Medaglia. On an exact method for the constrained shortest path problem. Comput. Oper. Res., 40(1):378–384, 2013. doi:10.1016/j.cor.2012.07.008.
- [23] Edward F. Moore. The shortest path through a maze. In Proc. of the International Symposium on the Theory of Switching, pages 285–292. Harvard University Press, 1959.
- [24] Keisuke Otaki, Tomosuke Maeda, Takayoshi Yoshimura, and Hiroyuki Sakai. Roaming navigation: Diverse constrained paths using heuristic search. IEEE Access, 11:75617–75627, 2023. doi:10.1109/ACCESS.2023.3295830.
- [25] Luigi Di Puglia Pugliese and Francesca Guerriero. A survey of resource constrained shortest path problems: Exact solution approaches. Networks, 62(3):183–200, 2013. doi:10.1002/net.21511.
- [26] Francisco Javier Pulido, Lawrence Mandow, and José-Luis Pérez-de-la-Cruz. Dimensionality reduction in multiobjective shortest path search. Comput. Oper. Res., 64:60–70, 2015. doi:10.1016/j.cor.2015.05.007.
- [27] Zhongqiang Ren, Zachary B Rubinstein, Stephen F Smith, Sivakumar Rathinam, and Howie Choset. ERCA*: A new approach for the resource constrained shortest path problem. IEEE Transactions on Intelligent Transportation Systems, 2023.
- [28] Zhongqiang Ren, Richard Zhan, Sivakumar Rathinam, Maxim Likhachev, and Howie Choset. Enhanced multi-objective a* using balanced binary search trees. In Lukás Chrpa and Alessandro Saetti, editors, Proceedings of the Fifteenth International Symposium on Combinatorial Search, SOCS 2022, Vienna, Austria, July 21-23, 2022, pages 162–170. AAAI Press, 2022. doi:10.1609/SOCS.V15I1.21764.
- [29] Giovanni Righini and Matteo Salani. Symmetry helps: Bounded bi-directional dynamic programming for the elementary shortest path problem with resource constraints. Discret. Optim., 3(3):255–273, 2006. doi:10.1016/j.disopt.2006.05.007.
- [30] Antonio Sedeño-Noda and Sergio Alonso-Rodríguez. An enhanced K-SP algorithm with pruning strategies to solve the constrained shortest path problem. Appl. Math. Comput., 265:602–618, 2015. doi:10.1016/j.amc.2015.05.109.
- [31] Barrett W. Thomas, Tobia Calogiuri, and Mike Hewitt. An exact bidirectional A* approach for solving resource-constrained shortest path problems. Networks, 73(2):187–205, 2019. doi:10.1002/net.21856.
- [32] Carlos Hernández Ulloa, William Yeoh, Jorge A. Baier, Han Zhang, Luis Suazo, and Sven Koenig. A simple and fast bi-objective search algorithm. In J. Christopher Beck, Olivier Buffet, Jörg Hoffmann, Erez Karpas, and Shirin Sohrabi, editors, Proceedings of the Thirtieth International Conference on Automated Planning and Scheduling, Nancy, France, October 26-30, 2020, pages 143–151. AAAI Press, 2020. URL: https://aaai.org/ojs/index.php/ICAPS/article/view/6655.
- [33] Pieter Vansteenwegen, Wouter Souffriau, and Dirk Van Oudheusden. The orienteering problem: A survey. Eur. J. Oper. Res., 209(1):1–10, 2011. doi:10.1016/J.EJOR.2010.03.045.
