ELAI S.r.l.

The shortest tour arrives late: what should a delivery planner optimise?

Three customers, six routes, and one deadline: a complete example separates minimum distance, service time, and feasibility without unmeasured savings claims.

The shortest tour arrives late: what should a delivery planner optimise?

A customer promise is not measured in kilometres

A business must plan three deliveries with one vehicle. One customer has a deadline, and unloading times differ across customers. Asking an AI planner only for the shortest route can produce a distance-optimal solution that is unusable for service. The algorithm is not necessarily at fault: we may have specified the wrong problem.

What changes when a deadline is imposed as a constraint instead of hoping it emerges from distance minimisation? We build a small case solvable by complete enumeration of all six customer orders. We use no real traffic, mapping engine, or EL-AI customer data. This synthetic case explains how objectives and feasibility change a business decision.

Assumptions, coordinates, and clock

Depot D is at (0,0) km, A at (1,0), B at (4,0), and C at (4,3). Distances are Euclidean straight-line segments, not roads. Assumed constant speed is 1 km/min, equivalent to 60 km/h. There is no waiting, traffic, or road restriction. Departure is at minute zero, each customer is visited once, and the vehicle returns to the depot.

Service takes 10 minutes at A and one minute each at B and C. B requires arrival by minute 6 inclusive; the requirement concerns arrival, not unloading completion. Each customer receives one crate, all loaded initially; vehicle capacity is three crates. Service time advances the clock without adding distance. These details prevent mixing units or omitting time while the vehicle is stationary.

The recurrence turning a tour into a schedule

Let d(i, j) be distance in km, v speed in km/min, s_i service in minutes, and a_i arrival time in minutes. After arriving at i, service is completed before travelling to j. The next arrival equals the previous arrival plus service and travel time. Initially a_D=0 and s_D=0. This simple recurrence shows why customer order changes arrivals despite identical total service time.

d(i,j) = sqrt((x_i-x_j)^2 + (y_i-y_j)^2) a_j = a_i + s_i + d(i,j)/v minimise L(pi) = sum_(consecutive i,j in D,pi,D) d(i,j) subject to a_B <= 6 min; initial load = 3 crates <= Q

pi is customer order, L total length, and Q capacity. Minimisation applies only to feasible routes. We do not subtract “minutes” from “kilometres” in a physically meaningless score. A lateness-penalty objective is possible, but needs a cost per minute and an explicit decision on negotiable delay. Our requirement is hard.

Two nearly equal tours, different outcomes

D-A-B-C-D covers 1+3+3+5=12 km. Arrival at A is minute 1, service ends at minute 11, and arrival at B is minute 14: eight minutes late. Reversing the tour is insufficient: D-C-B-A-D is also 12 km, but C is reached at minute 5, its service ends at minute 6, and B is reached at minute 9. Both distance minima violate the deadline.

D-B-C-A-D reaches B at minute 4, within the bound. After one minute of service it reaches C at minute 8. After C’s service, the √18 km leg to A yields arrival near minute 13.2426. Ten minutes of service and a one-kilometre return finish near minute 24.2426. Total distance is 8+√18≈12.2426 km. About 0.2426 extra km satisfy the requirement; the entire tour does not finish earlier than the 12 km tours, which finish at minute 24.

OrderDistance kmB arrival minFinish min
ABC12.000014.000024.0000
ACB12.242619.242624.2426
BAC16.24264.000028.2426
BCA12.24264.000024.2426
CAB16.242623.242628.2426
CBA12.00009.000024.0000

Every row implicitly starts and ends at D. Table values are rounded to four decimals for reading; code retains full results. Only BAC and BCA meet B’s arrival bound, and BCA is shorter. Since all six allowed alternatives were evaluated, this is optimal for the finite model, not merely an heuristic’s best found route. It is not proof of optimality for a real city.

Synthetic map in km and comparison of total distance versus arrival at B. The dashed line marks minute 6; green points satisfy the requirement. Map segments are Euclidean, not roads or traffic measurements.
Synthetic map in km and comparison of total distance versus arrival at B. The dashed line marks minute 6; green points satisfy the requirement. Map segments are Euclidean, not roads or traffic measurements.

Assumptions change the answer

The code includes sensitivity checks with A service times 0, 1, 2, 5, and 10 minutes and B deadlines 4, 6, 10, and 14 minutes. These are recalculations, not forecasts. For example, with zero A service and deadline 6, ABC reaches B at minute 4 and becomes feasible; with A service 10 and deadline 14, ABC is feasible again without changing distance. Unloading duration is not a detail to append after optimisation.

Capacity can empty the feasible set. If capacity is two crates but all three must be loaded for one trip, none of the six routes is feasible. Reordering creates no space. The code checks this without fabricating a solution: reloading, multiple trips, or another vehicle require different models and were not solved here. “No solution under these assumptions” is an informative outcome.

From an inspectable toy model to operations

Enumerating n customers requires n! orders and roughly n operations per direct evaluation. It is transparent for three customers but scales poorly. Dedicated solvers, heuristics, and learned methods can address larger cases, provided they share the same time, capacity, and objective contract. AI may estimate travel times; predictions do not replace constraint checks and introduce uncertainty. No solver comparison or traffic model training was performed.

We read the primary OR-Tools Vehicle Routing Problem with Time Windows guide, including data, time callback, and time-dimension constraints. It illustrates separating travel costs from allowed windows; we neither copy its matrix nor execute OR-Tools. Real operations need a road network, validated service times, loading rules, tolerances, and an evaluation protocol. This article establishes no deployed EL-AI logistics planner or customer savings.

The answer: optimise only what we can accept

The shortest tour is not inherently wrong: it solves an incomplete objective for this business. Here increasing distance from 12 to about 12.2426 km serves B on time without shortening the whole tour or proving general economic gain. Make the customer commitment measurable, encode it as a constraint, then minimise distance among acceptable alternatives. Before judging planner intelligence, check the problem it was given.

Source and reproducibility

Google OR-Tools — Vehicle Routing Problem with Time Windows.

import math
points={'D':(0,0),'A':(1,0),'B':(4,0),'C':(4,3)}
service={'D':0,'A':10,'B':1,'C':1}
for order in ['ABC','BCA']:
    time=distance=0.0;current='D';arrivals={}
    for node in [*order,'D']:
        leg=math.dist(points[current],points[node])
        distance+=leg;time+=leg  # synthetic speed: 1 km/min
        arrivals[node]=time;time+=service[node];current=node
    print(order,distance,arrivals['B'],time)

Code, data, and instructions · JSON. Educational calculations executed with Python 3.14.0; figures with Matplotlib 3.11.2. AI-assisted analysis, without claiming peer review or human review. Original illustrative ImageGen cover: it does not document EL-AI people, premises, or installations. Sources accessed 21 October 2026.