Back to Blog
route optimization algorithmsvehicle routingmiddle mileCVRPTWdispatch planning

Route Optimization Algorithms for Night Freight

Route optimization algorithms for overnight middle mile: match solver type to scale, lock hard constraints, and score plans on time and hours not miles alone.

October 30, 2026

Route Optimization Algorithms for Night Freight

The most popular advice about route optimization algorithms is to choose the method that cuts the most miles. For night freight, that's the wrong starting point. A short route can still put a truck at a closed gate, exhaust a driver's available hours, or miss the handoff that keeps the next facility moving.

The useful objective is a feasible, low-variance night: a plan operators can execute without depending on every ramp, dock, and loading crew performing exactly as expected. Judge an algorithm by the plan it produces before dispatch and by how safely it handles changed travel times afterward.

Algorithm Families and the Night Each One Fits

Which route optimization algorithm fits the network

Algorithm family Network it fits Optimality Speed in practice Failure if misused
Shortest path, including Dijkstra and A* One vehicle, point to point Optimal for the specified path problem Very fast for individual paths Ignores fleet capacity, shared docks, and appointment scheduling
Exact MIP and Lagrangian decomposition Small, stable customer sets Proven optimal on solved instances Allow a bounded solve period and check the remaining gap Proof takes longer than the dispatch deadline allows
Adaptive large-neighborhood search and metaheuristics Large regional customer sets Can approach best-known solutions, without proof Tunable to the pre-dispatch planning budget Search stalls among poor alternatives
Packaged heuristics such as OR-Tools Fleet plans with many customers Feasible when the encoded constraints are satisfied, not automatically optimal Suitable for time-limited planning Dispatcher treats default output as the operational optimum
Hybrid prediction plus reoptimization Time-dependent or uncertain nights Limited by prediction quality and constraint enforcement Repairs can run quickly once the system is configured Thin travel history produces brittle forecasts

Dijkstra and A* answer a narrower question than most freight operators need: which road path connects an origin and destination under a specified cost? They're useful inside a routing system, but they don't independently assign work across trucks or reserve shared dock capacity. Adding more stops doesn't turn a shortest-path engine into a fleet scheduler.

Match the method to the decision

An exact mixed-integer program, or MIP, represents assignments, sequences, and restrictions mathematically. Decomposition divides that work into smaller connected problems. Use these approaches when the network is stable enough, and the planning deadline allows enough time, for proving solution quality to matter.

Benchmark scale provides context, not a purchasing guarantee: the vehicle-routing benchmark comparison distinguishes Solomon instances with 100 customers from Gehring–Homberger instances reaching 1,000 customers, and reports a comparison in which OR-Tools solutions were more than 10% above the best-known solution on instances exceeding 600 customers.

Those benchmark sizes aren't hard operating limits. Tight appointments, shared resources, and uneven loads can make a smaller network difficult.

Adaptive large-neighborhood search removes part of a candidate schedule and rebuilds it differently. Other metaheuristics explore alternatives through swaps, reassignment, or controlled acceptance of temporarily worse solutions. Their value is practical search coverage within the time available, not a certificate that no better plan exists.

Learning hybrids serve a different role. A predictor can estimate gate delay or suggest a repair, but a constraint layer must still reject an overloaded truck or an impossible shift.

For adjacent freight-planning context, operators can browse automotive logistics articles from Arete Global Shipping Services. Keep that context separate from solver validation: useful industry reading isn't evidence that an algorithm fits your network.

Before choosing software, mark the table row that matches tonight's stop count, appointment complexity, and uncertainty. Then test it against your actual planning deadline.

Overnight Middle Mile as a Routing Model With Hard Locks

Start with a capacitated vehicle-routing problem with time windows, usually shortened to CVRPTW. Trucks leave a depot, serve the assigned facility visits, remain within load limits, meet operating windows, and return to the depot. The Operations Research paper on vehicle routing with time windows describes an exact decomposition approach that separates assignment decisions from constrained route subproblems.

For a basic overnight model, each required facility visit is served exactly once. If an operation requires separate collection and delivery visits at the same address, represent those as distinct tasks with their own dependencies. Don't let an oversimplified address list erase the work.

A diagram illustrating the components of an overnight middle mile route optimization model with hard locks.

Separate restrictions from preferences

Hard constraints define whether a candidate can be dispatched. Soft penalties distinguish acceptable candidates from more desirable ones. A preferred arrival can carry a penalty for deviation, but an actual appointment cutoff cannot become optional because another route saves mileage.

Middle-mile constraints to encode before solving

Constraint Hard or soft What breaks if ignored How to encode it
Driver hours and mandatory breaks Hard Unsafe or illegal shift Maximum duration plus required breaks under applicable rules
Facility appointment windows Hard Missed node and refused handoff Time window on every stop
Dock or gate slots Hard Queue, rejection, or blocked door Limited dock resource by time bucket
Box-truck type and capacity Hard Excess cube, excess weight, or wrong equipment Load demand against compatible vehicle class
Start and end at the depot Hard Driver isn't back for the next wave Closed route with a return deadline
Fixed service time at each DC Hard On-time arrival followed by late departure Service duration added after arrival
Preferred arrival or optional fuel stop Soft Minor earliness or an unnecessary stop Preference penalty, not a prohibition

An optional fuel-stop preference is soft. Having enough fuel to complete the assigned work safely isn't. Likewise, fixed service duration is a required planning input, not a promise that loading will always finish on schedule.

Use our guide to hours-of-service rules to help distinguish applicable compliance requirements from an internal target shift. Don't insert a universal driver-hours limit without checking the vehicle and operation.

For equipment context, Galhor Inc.’s explanation of freight delivery for Class 8 operators provides adjacent reading. Equipment categories still need their own compatibility rules; a route built for one vehicle class shouldn't automatically transfer to a box truck.

Planning rule: If the solver can buy fewer miles by breaking a safety or appointment constraint, the model is configured incorrectly.

Build the travel-time matrix by time of night, then add service duration separately. Otherwise, a plausible arrival estimate can conceal an impossible departure.

Runtime Against Optimality Before the Trucks Roll

A mathematically perfect plan delivered after dispatch has started is a missed planning deadline. The dispatcher needs time to review assignments, resolve exceptions, and brief drivers. Solver runtime belongs inside that operating clock, not outside it.

Set a latest acceptable release time before solving. Reserve part of the available planning period for validation and communication rather than letting the optimizer consume it all.

A diagram illustrating the sequential process of logistics route planning, emphasizing the balance between optimality and runtime.

Run a bounded planning loop

  1. Build a baseline before dispatch. Start with the selected algorithm family and the current demand, vehicles, and appointments. Keep the best feasible candidate available throughout the run, so a timeout doesn't leave dispatch empty-handed.

  2. Use departure-sensitive estimates. Replace a single travel-speed assumption with estimates for the period each leg will run. Assign explicit buffers to uncertain approaches and terminal entry rather than hiding all contingency in a later depot-return time.

  3. Monitor buffer consumption. Compare actual arrival and departure events with the planned margin. A truck can remain close to its predicted location while a slow live load consumes the time needed for the next handoff.

  4. Repair only after a defined trigger. Write the delay, appointment-risk, or capacity threshold before the night begins. When it trips, evaluate a targeted change rather than repeatedly rebuilding every unaffected route.

Exact methods are useful when a certificate of quality justifies the wait. For a changing night, a time-limited search or prediction-and-repair workflow may be more useful. The relevant comparison is the best executable plan each method produces by the release deadline.

A solver timeout isn't automatically failure. It may return a feasible incumbent, meaning the best candidate found so far, without proving optimality. Conversely, a successful software response isn't automatically dispatch approval: the candidate still needs operational validation.

Preserve the evidence

Store the input snapshot, solve duration, release time, and accepted plan version. Without those records, a planner can't tell whether a disappointing night came from weak search, stale inputs, or an execution event.

Keep optimality gap, on-time arrival, miles per trip, driver-hours, and replan frequency as separate tracks. Combining them into a single score can conceal a service failure behind an attractive mileage reduction.

A fast infeasible answer and a perfect late answer both miss the gate.

When no feasible candidate exists, report the conflicting work explicitly. Dispatch needs an exception to resolve, not a polished route that quietly omits a required visit.

KPIs That Separate a Good Plan From a Short One

Lead the dashboard with on-time arrival and driver-hours consumed. Those measures show whether the operator completed the promised work within the available shift. Put mileage underneath them, where it belongs as a cost measure rather than a substitute for service.

Averages need particular care. An attractive average arrival error can coexist with a damaging late tail, while an early truck may wait outside a facility rather than provide useful service.

Scorecard for an overnight route plan

KPI What it measures How to read it Trap
Optimality gap Difference from a bound or best-known solution A warning light, not a trophy Zero gap on the wrong model
On-time arrival Share of stops inside their windows Primary service result Counting premature arrival that blocks a dock as success
Late-arrival risk Buffer breaches or the late tail Favor dependable execution A flattering average ETA
Miles per trip Distance driven Secondary cost measure Short miles that miss the handoff
Driver-hours consumed Recorded time, including dwell Must fit the applicable shift and work limits Hidden loading time
Replan frequency How often dispatch changes the plan Interpret alongside disruption severity Either a frozen bad plan or unnecessary churn
Fuel or emissions Measured use compared with modeled estimates Report a defensible range Treating assumed efficiency as measured performance

For optimality gap, label the reference clearly. A mathematical lower bound and a best-known candidate aren't interchangeable. A candidate can improve on a published best-known solution without establishing a proof of optimality.

Audit environmental claims separately

A 2025 AI-based multimodal routing study calibrated emissions estimates using OBD-II telematics, environmental sensors, GPS trajectories, and independent roadside or municipal reports, and found that a 10% adjustment in fuel-efficiency assumptions produced 7.5% emissions variability.

That sensitivity is a reason to validate the model, not a forecast for your fleet. Separate avoided mileage from measured fuel consumption, and report an uncertainty range for modeled emissions. Changes in load, temperature, vehicle condition, and stop-and-go operation need to be reflected in the comparison.

Gegan's quantitative research explained with practical examples offers useful context for defining measurements and making fair comparisons. For an operating scorecard, our logistics performance metrics guide can help frame the measures dispatch and facility leaders review together.

Name the operations manager authorized to approve a slower, lower-emissions candidate. Dispatch should record the reason and confirm that the candidate preserves mandatory service and safety requirements. An environmental objective doesn't authorize relaxing either.

Reject a dashboard that displays only miles saved. It hasn't shown whether the night worked.

A Twin Cities Overnight Lane When the Clock Moves

Consider a hypothetical night connecting a local depot, distribution centers, and hub nodes across the Twin Cities. The work is scheduled facility-to-facility freight, not a sequence of residential deliveries. At Peak Transport, we plan driver routes in advance, and our local middle-mile work gets drivers home after their shift rather than sending them on long-haul overnight trips.

The planner begins with the appointment grid and expected loading duration. The shorter corridor includes a ramp with unreliable overnight progress; the alternative adds distance but offers more dependable arrival timing. Both fit the load and equipment requirements.

A semi-truck enters a warehouse yard at night with other trucks docked at loading bays.

Put known exposure into the baseline

The planner classifies appointment grids, recurring ramp congestion, and known winter-weather exposure as predictable disruption. These belong in departure-sensitive estimates and scenario tests before anyone receives a route.

A 2025 time-dependent vehicle-routing study found that wind speed and direction altered optimal routing in more than 80% of large-scale test cases, with gradients, vehicle load, temperature, and pavement type also included in the model.

That finding doesn't establish which Twin Cities corridor to choose. It shows why a static travel estimate shouldn't be treated as an immutable property of a road.

For this hypothetical lane, scenario testing puts the short corridor's delayed arrival beyond the receiving appointment. The longer corridor retains enough margin to complete the handoff. The planner selects the longer option because its lower travel-time variability protects the actual service commitment.

Keep the briefing stable without ignoring trouble

After the driver receives the route, dispatch freezes ordinary optimization changes. A marginal mileage improvement isn't enough reason to issue a new sequence while the driver is already executing the plan.

Then an unplanned dock hold occurs. This is random disruption, unlike the ramp exposure already included in planning. Dispatch checks the next appointment and remaining shift margin instead of immediately ordering a detour.

While the hold remains within the authorized buffer, the route stays unchanged. Once the written trigger is breached, dispatch evaluates a local repair, confirms the receiving facility can accept it, and records the approved change. Any human override includes a reason, not just a revised line on the map.

Route stability means avoiding unnecessary changes, not refusing necessary ones.

The night ends with a comparison of planned and actual miles, late-arrival exposure, recovery mileage, and hours consumed. In this scenario, the shortest candidate would have reached the receiving facility after its appointment closed. The selected corridor costs extra distance but completes the handoff and leaves a workable depot return.

That's the test route optimization algorithms need to pass: not whether the initial line looks efficient, but whether the assigned work remains executable when conditions move.

Connecting the Optimizer to Dispatch Systems

The optimizer belongs between validated operating inputs and an approved dispatch record. It shouldn't operate as a separate map that someone manually copies into driver instructions. That separation makes it too easy for appointments, vehicle assignments, and route versions to disagree.

Treat the integration as a controlled handoff. Each stage needs a named owner and a clear response when required information is missing.

Move from input to auditable execution

  1. Create a complete planning input. Pull orders, appointments, dock slots, vehicle compatibility, and remaining driver availability from the transport management or dispatch system. Make required restrictions explicit fields. Missing dock availability should block automatic release, not become unlimited capacity.

  2. Export an executable plan. Send stop sequence, planned arrival and departure, service duration, buffer allocation, and vehicle assignment into each driver's dispatch record. Include the plan version so the driver and dispatcher can confirm they're discussing the same instructions.

  3. Return live operating events. Feed telematics, arrival confirmations, loading completion, and gate status back on a predetermined cadence. Preserve event timestamps and distinguish a late update from a delayed truck. Otherwise, a stale message can trigger an unnecessary repair.

  4. Propose a limited repair. When an approved threshold trips, constrain the search to affected work wherever practical. Preserve completed stops and unaffected commitments. Dispatch reviews the proposal before releasing instructions, including any facility confirmation needed for the revised handoff.

  5. Log the decision. Record accepted changes, rejected recommendations, and human overrides with their reasons. Keep the prior version available so an analyst can reconstruct what dispatch knew when the decision was made.

Give each component a boundary

The solver proposes, the constraint layer enforces, and dispatch decides. Prediction software shouldn't be allowed to overwrite mandatory restrictions, and a dispatcher shouldn't need to infer those restrictions from a map.

Use our dispatch system software guide when mapping route outputs to the records operators use. The integration requirement isn't that systems exchange files. They must exchange enough meaning to preserve the approved plan.

Define a fallback for unavailable feeds before relying on live reoptimization. A documented manual confirmation can replace a missing event when an authorized person verifies it, but an unverified assumption shouldn't masquerade as current status. Keep the last approved instructions visible while dispatch resolves the exception.

Lock the Planning Loop Before Tomorrow Night

Before releasing tomorrow's assignments, apply a go-or-no-go gate. A route that looks plausible on a screen isn't ready until the planner can show what makes it executable and who will manage exceptions.

Make release conditional

  1. Confirm the model represents the work. Include required visits, capacity, operating windows, depot return, and time-of-night travel estimates. Check that collection and delivery dependencies haven't disappeared during data import.

  2. Validate every mandatory restriction. Test a deliberately invalid candidate to confirm the system rejects it. A restriction appearing in a settings screen isn't sufficient evidence that the exported plan respects it.

  3. Check the algorithm against the deadline. Use tonight's stop count, resource conflicts, and uncertainty to set the search budget. Confirm there's a feasible candidate ready for review before driver briefing begins.

  4. Require a balanced release scorecard. Include service timing, late-arrival exposure, mileage, driver-hours, and expected replanning needs. Keep measured fuel results separate from modeled environmental estimates, with uncertainty visible.

  5. Authorize the exception process. Write down the reoptimization trigger, the person who approves changes, and the conditions for a human override. Confirm drivers have a clear way to identify the current approved instructions.

Release test: If dispatch can't explain an exception without opening the optimizer, the handoff isn't complete.

For readers who need execution rather than another solver, we run structured overnight box-truck middle-mile lanes in the Twin Cities. Peak Transport's Route Optimization uses data modeling to reduce mileage and cut fuel consumption, supporting the link between distribution centers and hubs.

The decision isn't which algorithm has the most impressive name. It's whether tomorrow's assignments are feasible, briefed, and supported by an exception process that still works when the weather changes.


Peak Transport offers planned, local middle-mile box-truck operations between distribution centers and hubs, supported by data-informed route planning. Visit Peak Transport to discuss your Twin Cities overnight lanes, facility windows, and handoff requirements so the conversation starts with an executable night, not just fewer miles.