anyLogistix
Expand
Font size

Smart Food Routing (Last Mile Optimization)

In this example, we will use the Last Mile Optimization experiment to optimize transportation routes in our supply chain by solving the Capacitated Vehicle Routing Problem with Time Windows (CVRPTW).

Problem Definition

A company delivering food within the city of Ljubljana, Slovenia, wants to improve the efficiency of its supply chain by implementing a daily process for solving the analytical task of scheduling deliveries with time windows and limited vehicle capacity.

Current Task

We are considering one day of the company's operations. Within this day, a route optimization cycle will be performed based on static data (available vehicles and orders for the day with their respective time windows when customers are ready to accept these orders).

A total of 20 customers in the city center (various offices and individual clients) were registered for the considered horizon.

Their orders were registered in the system with precise time windows when they are ready to accept deliveries.

The company has a central distribution center from which deliveries to customers will be made. The distribution center has two types of vehicles with their own capacities and speeds.

For this task, we assume that transferring goods from the courier to the customer during delivery takes 1 minute per unit of goods, and loading vehicles for shipment from the distribution center takes 3 minutes.

Goals

Obtain an optimal schedule for shipments, loadings, and unloadings of registered customer orders within the city, relative to delivery time and distance traveled by vehicles.

Solution

To create the required scenario, we perform the following steps:

  • Define customer demand as a Historic demand in the Demand table.
  • Create two types of vehicles:

  • Create a fleet for the distribution center for each vehicle type (Fleets table):

  • Add necessary paths between all points on the map so that vehicles can move not only from the distribution center to customers but also between customers. These paths will be used for optimization (Paths table).
  • Add registered customer time windows during which they are ready to accept orders (Time Windows table).
  • Add loading and unloading gates to model the required processes of transferring orders from couriers to customers and loading vehicles for delivery (Loading and Unloading Gates table):

Running the Simulation experiment

Let us run the Simulation experiment. Observing received result, we can see the following KPI metrics:

We can observe the complete fulfillment of all orders, as well as transportation costs according to the specified calculation policies. Additional dashboard pages provide a more detailed overview of the run results.

It is important to note that LTL shipping policies were used in the Shipping table to model uncontrolled shipments. Because of this, couriers delivered one order at a time and waited at the customer's location until their time window for accepting goods opened. This scheme was used to demonstrate unorganized deliveries without centralized planning.

Setting up the Last Mile Optimization experiment

Last Mile Optimization essentially implements the CVRPTW, where:

  • Customers and distribution centers are defined.
  • Customers have their individual orders for specific product in certain amount.
  • There are time windows for distribution center/customer operations.
  • Vehicles have capacity limitations.
  • Various business constraints exist, such as mandatory return to the distribution center, maximum vehicle waiting time, etc.
  • The optimization goal is to build routes for each vehicle such that:
    • Each order is fulfilled exactly once.
    • Vehicle capacity constraints are respected.
    • Time windows for locations are not violated.
    • The total travel time is minimized.

Opening the Last Mile Optimization experiment settings panel allows us to define the planning horizon, vehicle types participating in the optimization (optimal ones will be selected for delivering specific sets of orders by a courier in a single trip), maximum shipment duration, maximum vehicle idle time, the enabled parameter for returning vehicles to the distribution center, and many others, which can be explored on the experiment settings page.

Preview Orders table suggests that all our customer orders registered for this day will be taken as input data for the optimizer:

Running the Last Mile Optimization experiment

Let us run the Last Mile Optimization experiment. After the allotted 30 seconds for optimization, the following result will be obtained:

In the Milk Runs dashboard page, all found routes can be seen, with the optimized delivery time by delivering orders to multiple customers at once.

Now, let us open the Shipments Schedule Table dashboard page. The table provides detailed information on all shipments: when the courier arrived at each point, when unloading occurred, and where delays happened. This table displays the schedule we wanted to obtain:

Conclusion

The Last Mile Optimization experiment significantly improves delivery efficiency by intelligently planning routes considering time windows and fleet constraints, based on solving the CVRPTW problem.

Unlike scenarios with uncontrolled deliveries, using this optimization approach:

  • Reduces the total distance traveled by consolidating orders into routes.
  • Increases vehicle load rates, minimizing empty runs.
  • Lowers logistics costs by ensuring better resource allocation.
  • Allows importing found solutions into the scenario for further integration into supply chains.

Last Mile Optimization becomes a powerful tool for tactical planning in urban logistics, especially with high order density and strict time constraints. Its application enables data-driven decisions daily and easily scales the approach to other regions or time horizons.

How can we improve this article?