🧩 Constraint Solving POTD:Vehicle Routing Problem with Time Windows (VRPTW) #24883
Closed
Replies: 1 comment
-
|
This discussion has been marked as outdated by Constraint Solving — Problem of the Day. A newer discussion is available at Discussion #25088. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Today's constraint solving problem explores one of the most practically important combinatorial optimization problems in logistics and operations research.
Problem Statement
You manage a fleet of delivery vehicles based at a central depot. Each vehicle must serve a set of customers, returning to the depot when done. The twist: every customer has a time window
[e_i, l_i]during which service must begin, and each customer requiresd_iunits of cargo. Each vehicle has capacityQ.Goal: Find routes for the minimum number of vehicles (primary) with minimum total travel distance (secondary) such that:
ibegins within[e_i, l_i]l_iSmall Concrete Instance
5 customers, 2 vehicles, depot at node 0, capacity
Q = 15:One feasible solution:
Why It Matters
Parcel delivery & e-commerce — Every major courier network (UPS, FedEx, Amazon Logistics) solves millions of VRPTW instances daily; shaving 1% off total distance saves millions in fuel.
Healthcare & home services — Scheduling nurse visits, medical equipment deliveries, and meal services for elderly patients all have hard time-window constraints driven by patient needs and medication schedules.
Field service management — Telecom technicians, HVAC repair crews, and cable installers must arrive within promised windows, making VRPTW the backbone of field service optimization platforms.
Modeling Approaches
Approach 1: Constraint Programming (CP)
Decision variables:
route[v][p]— customer served at positionpin vehiclev's route (∈ {0..n}, 0 = depot)start[v][p]— time service begins at positionpin vehiclev's routeload[v][p]— cumulative load at positionpKey constraints:
Trade-offs: MIP benefits from mature LP relaxations and powerful branching heuristics (branch-and-cut). The 3-index formulation has
O(n² · V)binary variables — expensive for large instances, but strong LP bounds. The big-M time linking constraints weaken the LP relaxation.Approach 3: Large Neighbourhood Search (LNS) / Metaheuristic
For large real-world instances (hundreds to thousands of customers), exact methods are impractical. LNS iteratively:
Trade-offs: Finds high-quality solutions quickly; no optimality guarantees. Shaw's Related Removal operator (remove customers close in space/time) is particularly effective at escaping local optima.
Example CP Model Snippet (OR-Tools Python)
Key Techniques
1. Time-Window Propagation & Temporal Reasoning
The time dimension in OR-Tools (and similar CP solvers) maintains a lower bound
earliest[i]and upper boundlatest[i]for each node visit, propagating reductions forward and backward through the route graph. This is essentially a shortest/longest-path computation on a time-expanded DAG — tighter than generic arc consistency.Forward pass:
earliest[j] = max(e_j, earliest[i] + t_{ij} + s_i)Backward pass:
latest[i] = min(l_i, latest[j] - t_{ij} - s_i)Any node where
earliest[i] > latest[i]triggers a domain wipe-out.2. Symmetry Breaking
The fleet of identical vehicles creates massive symmetry: permuting which vehicle handles which route gives equivalent solutions. Break this with:
load[1] >= load[2] >= ... >= load[V]vdeparts depot no earlier than vehiclev-1Without symmetry breaking, solvers waste effort proving many equivalent optima infeasible.
3. Column Generation (for exact solvers)
Large VRPTW instances are solved optimally via branch-and-price: the LP relaxation of a set-partitioning formulation is solved by column generation, where each column represents a feasible route. The pricing sub-problem is an Elementary Shortest Path Problem with Resource Constraints (ESPPRC) — itself NP-hard but tractable via dynamic programming with dominance rules (Irnich & Desaulniers, 2005).
Challenge Corner
References
Solomon, M.M. (1987). "Algorithms for the Vehicle Routing and Scheduling Problems with Time Window Constraints." Operations Research, 35(2), 254–265. (The definitive benchmark instances, still in use today.)
Cordeau, J.-F., Desaulniers, G., Desrosiers, J., Solomon, M.M., & Soumis, F. (2002). "VRP with Time Windows." In The Vehicle Routing Problem, SIAM Monographs on Discrete Mathematics. (Comprehensive survey of exact and heuristic methods.)
Shaw, P. (1998). "Using Constraint Programming and Local Search Methods to Solve Vehicle Routing Problems." CP 1998, LNCS 1520. (Introduced the Related Removal operator for LNS.)
Google OR-Tools Routing Documentation — [developers.google.com/optimization/routing]((developers.google.com/redacted) (Practical guide with VRPTW examples, actively maintained.)
What solver or approach have you used for VRPTW in practice? Share your experience below! 👇
Beta Was this translation helpful? Give feedback.
All reactions