Part 1 · Routing

From the CVRP to fuel-aware heterogeneous fleets

27 October 20263 min readLevel: IntermediateNeeds: Integer programming basicsTürkçe oku

The vehicle routing problem asks a simple question: a depot, a set of customers with known demands and a fleet of vehicles; which vehicle visits which customers, in which order, at minimum cost? Simple to state, hard to solve, and the starting point of almost every real logistics model.

This note builds the model in three steps. Each step adds one thing real fleets care about.

Step 1: the capacitated VRP

Let V={0,1,…,n}V = \{0, 1, \dots, n\} be the depot 00 and the customers V′={1,…,n}V' = \{1,\dots,n\}, with demands qiq_i and travel costs cijc_{ij}. We have KK identical vehicles of capacity QQ. The binary variable xijx_{ij} is 11 if some vehicle drives directly from ii to jj, and uiu_i is the load delivered on a route up to and including customer ii.

min⁡∑i∈V∑j∈V, j≠icij xijs.t.∑j≠ixij=1,∑j≠ixji=1∀i∈V′∑j∈V′x0j≤Kuj≥ui+qj−Q (1−xij)∀i,j∈V′, i≠jqi≤ui≤Q∀i∈V′xij∈{0,1}\begin{aligned} \min \quad & \sum_{i \in V} \sum_{j \in V,\, j \ne i} c_{ij}\, x_{ij} \\ \text{s.t.} \quad & \sum_{j \ne i} x_{ij} = 1, \quad \sum_{j \ne i} x_{ji} = 1 && \forall i \in V' \\ & \sum_{j \in V'} x_{0j} \le K \\ & u_j \ge u_i + q_j - Q\,(1 - x_{ij}) && \forall i, j \in V',\ i \ne j \\ & q_i \le u_i \le Q && \forall i \in V' \\ & x_{ij} \in \{0, 1\} \end{aligned}

The first line says every customer is entered once and left once. The load constraints do two jobs at the same time: they keep each route within capacity, and they rule out subtours, because a cycle that never returns to the depot would need uu to increase forever.

Step 2: a heterogeneous fleet

Real fleets mix vehicle types: a few large trucks, more small vans. Give each type k∈Kk \in K a capacity QkQ_k, an available count mkm_k and its own cost, and add the type as an index: xijkx_{ijk} is 11 if a vehicle of type kk drives from ii to jj. The changes are mechanical:

  • each customer is visited once by some type: ∑k∑jxijk=1\sum_k \sum_{j} x_{ijk} = 1;
  • a vehicle that enters a customer leaves it with the same type: ∑ixijk=∑ixjik\sum_i x_{ijk} = \sum_i x_{jik};
  • at most mkm_k routes of type kk leave the depot: ∑jx0jk≤mk\sum_j x_{0jk} \le m_k;
  • the load constraints use QkQ_k for routes of type kk.

Step 3: fuel that depends on load

A loaded truck burns more fuel than an empty one, so the order of stops matters: deliver heavy orders early and the rest of the route is cheaper. A common linear model is fuel per kilometre αk+βkℓ\alpha_k + \beta_k \ell for a type-kk vehicle carrying load ℓ\ell.

The trick is to stop thinking about load at customers and think about load on arcs. Let fijk≥0f_{ijk} \ge 0 be the load carried on arc (i,j)(i,j) by a type-kk vehicle:

min⁡∑k∑i∑j≠idij(αk xijk+βk fijk)s.t.∑k∑ifijk−∑k∑lfjlk=qj∀j∈V′qj xijk≤fijk≤(Qk−qi) xijk∀i,j,k\begin{aligned} \min \quad & \sum_{k} \sum_{i} \sum_{j \ne i} d_{ij} \big( \alpha_k\, x_{ijk} + \beta_k\, f_{ijk} \big) \\ \text{s.t.} \quad & \sum_{k}\sum_{i} f_{ijk} - \sum_{k}\sum_{l} f_{jlk} = q_j && \forall j \in V' \\ & q_j\, x_{ijk} \le f_{ijk} \le (Q_k - q_i)\, x_{ijk} && \forall i, j, k \end{aligned}

The flow balance says each customer keeps exactly its own demand; the bounds tie the flow to the arcs that are actually used and enforce capacity. The objective is still linear. A model from this family, with a heterogeneous fleet, capacity limits and emissions counted as an operating cost, is the one I published in Politeknik Dergisi (2024) and applied to staff shuttle routes. The load-dependent fuel cost above is exactly the objective of Monthly Problem #01.

In practice

  • Formulations with load or flow variables have weak LP relaxations. A MIP solver will prove optimality for a few dozen customers; beyond that, expect large gaps.
  • Real instances add time windows, driver shifts, speed effects and depot rules. Each is easy to model and each makes exact solving harder.
  • The usual workflow: an exact model on small instances to get trusted optimal values, and a metaheuristic for the real size, checked against those values. The exact model is your measuring stick, not your production engine.

Exercises

  1. Show that a subtour 1→2→11 \to 2 \to 1 violates the load constraints of Step 1.
  2. In Step 3, what does the objective reduce to when every βk=0\beta_k = 0?
  3. Two vehicle types have the same capacity but different αk\alpha_k and βk\beta_k. Sketch a route where the “cheaper” vehicle is the wrong choice.

Discussion

Questions or corrections? Send me an email.

Send an email