Constraint Programming (CP) offers an intuitive, declarative framework for modeling Vehicle Routing Problems (VRP). While classical successor-based CP models can be adapted to handle optional visits or insertion-based heuristics, sequence variables provide a significantly more natural and elegant formulation for these requirements. Building upon our prior work that introduced the initial concept, the main contribution of this article is the complete semantic and operational formalization of sequence variables as a computational domain. Specifically, we formally define the sequence domain and its update operations, and detail the implementation and data structures required to integrate sequence variables into trail-based CP solvers. Furthermore, we introduce consistency levels for associated constraints on this domain alongside specialized global constraints tailored for routing problems. Finally, we demonstrate that sequence variables simplify problem modeling while achieving competitive computational performance on Pickup and Delivery Problems with and without Time Windows, the Dial-a-Ride Problem, and a Prize-Collecting Scheduling Problem.
Figures & tables
Type of variable
Feature
Successor
Head-tail sequence
Insertion-based sequence
Nearest neighbor heuristics
✓
✓
✓
Insertion-based heuristics
✓
Optional visits
✓
✓
Memory complexity on VRP with n nodes and k vehicles
Table 2. The compositions of subdomains in Example 4.3 . A check mark in one of the last 4 columns indicates that the corresponding sequence in the first column is included within the subdomain.
Figure 1. Compact domain implementation. On the left, the partial sequence s and the graph G(V,E) are shown. Below them is a table showing the edges E−,E+ , the insertion counters nI , and the successors s+ and predecessors s− of the nodes (only relevant for nodes v\in\lx@scalerel@obj{\overrightarrow{s}} ). The right-hand part shows the domain after performing an insertion with (α,v3) , extending the partial sequence.
Operation
Description
Complexity
isFixed()
Returns true if there are no remaining insertions
O(1)
isMember(vi)
Returns true if v_{i}\in\lx@scalerel@obj{\overrightarrow{s}}{}
Table 5. Correspondence between operations on a boolean variable Ri(Sq) defined over a node vi in a sequence variable S . The left part shows queries over the domains, while the right part shows updates of the domains.
Figure 2. \mathrm{Cumulative}(\lx@scalerel@obj{\overrightarrow{S}},(s_{0},s_{1},s_{2},s_{3}),(e_{0},e_{1},e_{2},e_{3}),(2,1,1,2),3) over a fixed sequence variable \lx@scalerel@obj{\overrightarrow{S}}=\alpha\cdot s_{0}\cdot s_{1}\cdot e_{1}\cdot e_{0}\cdot s_{3}\cdot e_{3}\cdot\omega . The sequence is shown at the top, and the graph below shows the accumulated load for each node v\in\lx@scalerel@obj{\overrightarrow{S}} . Note how nodes s2,e2 related to activity 2 are not part of the sequence.
Figure 3. Sequences created from a fully connected graph G(V,E) with V={α,v1,v2,v3,ω} , where all nodes are required ( V=R ). Nodes α and ω are implicit and not shown. Left: each sequence is extended by inserting any node at each step. Right: a node is first selected for insertion, then all its feasible positions are considered for insertion before moving to the next node (first v1 , then v2 , then v3 ).
Figure 4. Paths generated by Algorithm 6 from an initial path (left). Numbers indicate the order in which the paths are considered.
Figure 5. Primal-gap performance on the PDP, PDPTW, and DARP. The top row shows the mean primal gap over time; lower-left curves indicate faster convergence. The bottom row shows the percentage of instances with final gap at most the x-axis value after 15 minutes; upper-left curves are better.
Figure 6. PCSP solution
Figure 7. Primal-gap performance on the PCSP. The left plot shows the mean primal gap over time; lower-left curves indicate faster convergence. The right plot shows the percentage of instances with final gap at most the x-axis value after 15 minutes; upper-left curves are better.
Appendix figures & tables4 assets
Supplementary material from the paper’s appendix.
Appendix
Figure 8. A sequence variable S with partial sequence \lx@scalerel@obj{\overrightarrow{s}}=\alpha\cdot s_{0}\cdot s_{1}\cdot e_{2}\cdot s_{3}\cdot e_{3}\cdot\omega (top) and its corresponding load profile (bottom) when using a \mathrm{Cumulative}(\lx@scalerel@obj{\overrightarrow{S}},(s_{0},s_{1},s_{2},s_{3}),(e_{0},e_{1},e_{2},e_{3}),(2,1,1,3),4) constraint. Edges between insertable nodes are not shown. For the partially inserted activity 1 , the closest node after which e1 can be inserted is e2 ; hence, rectangle 1 ends at le2+ instead of ls1+ on the load profile.
Figure 9. Two load profiles for different sequences, with a capacity of 2. With ls0s0+1 , we detect that an activity of load 2 can be put between s0 and e1 on the left but cannot be put between s0 and e0 on the right.
Succ
Succ-LNS
CPO
RF (2021)
OR-Tools Routing
Hexaly
Seqvar
Name
k
∣R∣
bks
Mean ± SD
Best
Mean ± SD
Best
Mean ± SD
Best
Mean ± SD
Best
Mean ± SD
Best
Mean ± SD
Best
Mean ± SD
Best
R1a
3
24
190.02
18.26
±
0.00
18.26
6.03
±
2.00
3.19
3.62
±
1.54
0.71
0.00
±
0.00
0.00
-
-
2.98
±
1.42
0.54
0.00
±
0.00
0.00
R1b
3
24
164.46
33.22
±
0.00
33.22
7.81
±
3.66
4.34
12.81
±
4.15
4.32
0.00
±
0.00
0.00
0.00
±
0.00
0.00
3.69
±
1.33
1.38
0.82
±
1.35
0.00
R7a
4
36
291.71
-
-
11.22
±
4.71
4.71
23.55
±
14.85
6.09
0.00
±
0.00
0.00
-
-
4.39
±
2.03
1.08
2.06
±
1.34
0.00
R7b
4
36
248.21
-
-
10.87
±
1.96
7.33
12.95
±
3.48
8.11
-
-
-
-
8.58
±
2.32
5.75
2.41
±
1.46
1.07
R2a
5
48
301.34
-
-
8.03
±
2.79
2.87
29.61
±
24.07 †
12.59
-
-
-
-
6.70
±
4.01
2.39
1.55
±
1.05
0.29
Appendix
Table 6. Primal gaps (%) to the best known solution (bks) on DARP instances after 15 minutes of runtime. Entries report the mean primal gap ± the sample standard deviation and the best primal gap over ten runs. A dash indicates that no run found a feasible solution. Except for entries marked with † , numerical entries are based on ten feasible runs. For marked entries, statistics use the feasible runs specified in the table note. Best mean and best gap values are in bold.
MZN-Succ
MZN-Disj
CPO
OR-Tools Routing
Hexaly
SeqVar
Dataset
n
m
Mean ± SD
Best
Mean ± SD
Best
Mean ± SD
Best
Mean ± SD
Best
Mean ± SD
Best
Mean ± SD
Best
A_E
50
3
17.11
±
2.19
16.40
19.34
±
0.84
19.25
0.00
±
0.00
0.00
4.25
±
1.59
4.25
32.30
±
3.54
25.26
0.00
±
0.00
0.00
4
18.35
±
1.94
17.81
20.02
±
3.03
19.86
0.11
±
0.18
0.00
3.81
±
1.35
3.81
31.41
±
2.59
28.11
0.00
±
0.00
0.00
100
3
61.79
±
8.10
61.75
36.24
±
3.76
36.24
0.75
±
0.90
0.00
4.62
±
0.29
4.62
39.28
±
1.40
35.04
0.41
±
0.29
0.28
4
77.99
±
11.88
77.99
56.11
±
38.28
56.11
0.70
±
0.74
0.00
3.93
±
1.09
3.93
40.80
±
3.84
37.13
0.32
±
0.43
0.00
150
3
96.44
±
6.17
96.44
44.42
±
2.57
44.29
0.36
±
0.53
0.28
3.83
±
2.80
3.83
45.59
±
1.73
38.84
0.59
±
0.42
0.14
Appendix
Table 7. Primal gaps (%) to the best known solution (bks) on PCSP instances. Entries report the mean primal gap ± the sample standard deviation across constituent instance-level mean gaps; best gaps retain the existing mean of per-instance best gaps. A dash indicates that no feasible solution was found for the corresponding group. Except for entries marked with † , numerical entries use all ten runs of each constituent instance. For marked entries, the affected instance contribution uses its feasible runs only, as specified in the table note. Best mean and best gap values are in bold.