ElasticRun | Blogs

Optimizing Line Haul Transportation in E-commerce: The Smart Way to Balance Cost and Speed

Written by Tanay Shah - Senior Lead Engineer at ElasticRun | May 26, 2025 3:44:34 PM

In the world of e-commerce logistics, middle-mile transportation is the silent powerhouse. It connects first-mile pickup points to last-mile delivery centers and determines whether your delivery promise holds strong—or falls apart. 

While last-mile delivery is what customers see, the success of that experience hinges on the efficiency of the line haul network connecting fulfillment and dispatch centers behind the scenes

After discussing optimizing the last mile processes in our previous blog, we now turn our attention to the crucial, yet often underappreciated, middle mile: the line haul layer that makes or breaks delivery performance at scale.

In this blog, we’ll focus exclusively on land-based transportation for middle-mile optimization—excluding air or rail modes to keep the discussion relevant to most e-commerce use cases.

 

The M × N Dilemma: Too Many Lanes, Too Little Volume

Let’s say your e-commerce network has:

  • M first-mile sort centers (where shipments originate), and

  • N last-mile sort centers (from where orders are dispatched).

This results in M × N potential line haul lanes. But here’s the catch: not every lane has enough volume to justify sending a dedicated vehicle. Running individual trucks for each lane would inflate costs and leave most vehicles underutilized.

 

Why Multi-Stop Lanes Are the Only Way Forward

To tackle this, logistics planners need to build multi-stop line haul lanes—where a single vehicle:

  • Picks up shipments from one or more first-mile centers, and

  • Drops off shipments at one or more last-mile centers.

The goal? Maximize vehicle fill rates while keeping delivery timelines in check. But doing this well is not just about stringing together a few stops—it’s a complex optimization challenge.

Designing efficient multi-stop lanes introduces a web of cost and timing variables, creating a fundamental tradeoff:

  • Point-to-point lanes are fast but expensive.

  • Multi-stop lanes are cost-efficient but slower.

 

Walking the Tightrope: Cost vs Speed

The ultimate goal is to design a network that delivers fast and affordably—at scale. It’s not a tradeoff—it’s an engineering challenge. The most optimized networks achieve both speed and cost efficiency by designing with intent.

To move closer to this ideal, logistics leaders must think across these strategic dimensions:

  • Sort Center Network Configuration
    → Are your first- and last-mile hubs geographically optimized to reduce detours, dead kilometers, and transit time?

    → Could repositioning or adding micro-sort nodes unlock faster, leaner routes?

  • Order Segmentation by SLA and Geography
    → Can you group orders by urgency and destination corridor to create SLA-aligned routes instead of one-size-fits-all dispatch?

  • Contracting vs. Market Engagement Strategy
    → Are you locking in contracts where stable volume exists to lower per-shipment cost?

    → Are you keeping enough flexibility for unpredictable lanes to avoid overcommitting capacity?

From Strategy to Structure: Building a Resilient Line Haul Backbone

Once you’ve identified the right levers—like network layout, SLA-based segmentation, and contracting models—the next step is translating these into a resilient line haul structure. This is where long-term planning decisions around stability and flexibility come into play.

 

Planning Ahead: Stability vs Flexibility in Your Network

Line haul optimization doesn’t start on the day of dispatch—it starts much earlier with network planning based on projected demand.

You need to make strategic choices:

  • Which lanes show stable, predictable demand?

    → These can be locked in with long-term contracts with fixed fleet vendors.

  •  
  • Which lanes are highly volatile or seasonal?

    → These are best served through spot-market vehicles, giving you daily flexibility.

This introduces another multi-way tradeoff:

  • Stability: Long-term contracts offer reliability and lower rates, but reduce flexibility.

  • Flexibility: Market vehicles provide agility but come with price fluctuations and availability risks.

  • Efficiency: Choosing the wrong type of engagement for the wrong lane can lead to underutilized assets or inflated costs.

The ideal network design involves identifying core lanes to anchor with contracts—and building agile playbooks for the rest.

While demand-based network planning sets the foundation, the real challenge begins when these plans must meet practical, daily operational constraints.

 

Stable Demand

Volatile Demand

Fixed Contract

✅ Preferred

❌ Risky

Market Sourcing

❌ Inefficient

✅ Adaptive

 

The Math Behind The Movement: A Hard Problem with Harder Realities

This challenge can be modeled as a variant of the Capacitated Pickup and Delivery Problem with Time Windows (CPDPTW)—a classical NP-hard problem in operations research. Here's what makes it tough:

  • You must route vehicles to pick up and drop off shipments.

  • Each route must respect vehicle capacity and delivery time windows.

  • You must minimize total distance, time, or cost—ideally, all three.

  •  

But there’s another layer: fleet optimization.

You’re not just deciding where the vehicle goes—but also which type of vehicle to send:

  • Should you send a tempo or a 3-ton truck?

  • Can one large vehicle cover multiple lanes, or should you split across smaller vehicles?

  • Which vehicles are actually available in that region today?

Selecting the right mix of vehicles based on regional availability, cost structure, and route feasibility turns this into a joint optimization problem—routing and vehicle selection combined.

Also, With every new variable or constraint —centers, constraints, vehicles—the complexity multiplies. There’s no one-size-fits-all algorithm. It’s a hard problem in theory and even harder in practice.

We will soon publish a technical blog series diving deep into how to build models and algorithms to solve this class of problems—from heuristics to metaheuristics and hybrid AI approaches.

The reality is, solving this in real operations is far from easy. The fastest way off the blocks is to use purpose-built solutions like GreenFlow, which are not only theoretically robust but also battle-tested across the Indian e-commerce landscape.

 

How The Libera TMS by Elasticrun Solves This At Scale

Libera TMS solution was built to tackle exactly these kinds of complex, high-scale logistics problems.

Here’s how it makes line haul optimization work in the real world:

  • AI-driven lane design: Clusters sort centers based on volume trends, geography, and delivery SLAs.

  • Dynamic multi-stop routing: Builds vehicle routes that adapt daily to volume, traffic, and priority orders.

  • Capacity- and fleet-aware scheduling: Assigns the optimal vehicle type from the local fleet pool to match lane demand.

  • Contract vs market intelligence: Recommends which lanes are best suited for long-term contracts and which should remain dynamic.

  • Cost-speed balancing knobs: Lets planners define whether cost savings or speed is more critical, then optimizes accordingly.

  • Real-time re-routing: Automatically adjusts for last-minute disruptions—vehicle breakdowns, delays, or surge volumes.

The result? High-utilization lanes, lower costs, and consistent service levels, even in a rapidly evolving e-commerce environment.

 

 

The middle mile may be invisible to customers, but it’s where logistics teams either save or lose money—and time. Getting line haul optimization right requires a delicate balance of planning, real-time orchestration, and technology. As networks scale, solutions like GreenFlow help businesses stay efficient, resilient, and ready for what’s next.