Back to Labs Archive
Strategy and Ops
2026-03-15
8 min

I Built a Route Optimization System. The Algorithm Wasn’t the Hard Part.

Designing a vehicle routing system for Used Cooking Oil collection to supply Sustainable Aviation Fuel feedstock across Indian metros.

Executive Summary and Impact

Byufuel aggregates Used Cooking Oil (UCO) from commercial kitchens to supply Sustainable Aviation Fuel (SAF) refiners across Indian metros. This article details the mathematical formulation and practical translation of real-world fleet dynamics, priority outlet windows, and live traffic re-solving into an operational Google OR-Tools optimization engine.

Feedstock DomainUCO / SAF
Core ModelCVRPTW + OR-Tools
Fleet ConstraintsTime Windows and Priority
Primary ProxyDistance / Volume Ratio

Core Thesis

The route optimization algorithm was relatively straightforward. The difficult part was deciding what "optimal" actually meant, translating operational reality into constraints, and turning the solver's output into something a fleet operator could actually use.


Act I: Problem Definition and Objective Misalignment

1. "Optimize the Routes" Sounds Like a Well-Defined Problem

Byufuel sits in the middle of the used cooking oil supply chain. It collects UCO from restaurants, hotels, commercial kitchens, and other food outlets and aggregates it for downstream processing.

When we were given the task of optimizing collection routes, the first instinct was obvious:

Build a routing algorithm.

The actual problem was much less obvious.

What exactly should the algorithm optimize?

The initial problem statement framed the objective around cost and carbon emissions per litre of UCO collected. But those are not variables that a routing solver can simply minimize without additional assumptions.

We could estimate the cost of a route from its distance. We could use distance as a proxy for fuel consumption and therefore transport-related emissions. But the amount of UCO collected also mattered.

A route collecting substantially more UCO could be preferable to a slightly shorter route.

So the practical objective became:

Key Insight

Keep the collection route efficient in distance while maximizing how much UCO we collect for every kilometer travelled.

That distinction changed how we thought about the entire problem.

We weren't just looking for the shortest route.

We were building a system that had to balance where vehicles went, what they could carry, which outlets mattered, and how much material they could collect along the way.


2. The Solver Wasn't the First Thing We Built

The first thing we needed was not an algorithm.

It was a list of rules.

The initial project brief contained broad requirements such as time windows, vehicle capacities, dynamic pickups, traffic, and the requirement to serve all vendors.

But each of those requirements had to become something the optimization model could actually understand.

For example:

This translation was the real engineering work.


Act II: Translating Operations into Constraints

3. Turning Fleet Operations Into Constraints

The final system had to represent several pieces of operational reality simultaneously.

Heterogeneous vehicles

The fleet was not homogeneous.

Different vehicles had different carrying capacities and operational characteristics. A routing solution therefore could not simply treat every vehicle as interchangeable.

The solver had to decide which vehicle should serve which collection points while respecting each vehicle's capacity.

Time windows

Collection was not possible at arbitrary times.

The MVP incorporated pickup time windows, including the general operating window and outlet-specific restrictions where applicable. The solver therefore had to produce routes that were not only geographically feasible, but temporally feasible.

Priority outlets

Priority turned out to require more nuance than simply assigning a numerical weight.

We ended up with two levels:

This is a good example of something that looks like a small business rule but has a direct effect on the mathematical formulation. "Priority" wasn't a label in a spreadsheet anymore. It became a constraint on the sequence of visits.


4. The Carbon Problem We Couldn't Pretend to Solve

Objective Ratio: (kg CO₂ emitted) / (litres of UCO collected)

But that requires a reliable relationship between every route and its actual fuel consumption. We did not have that.

Fuel consumption depends on vehicle characteristics, traffic, driving behaviour, road conditions, and other factors. Treating all of those as known would have created a much more sophisticated model, but not necessarily a more truthful one.

So we made the modeling assumption explicit:

System Constraint

Route distance would act as the operational proxy for transport-related fuel consumption and emissions.

That meant the optimizer could work with something measurable and available rather than creating false precision around an emissions model we did not have the data to support.


Act III: CVRPTW Formulation and OR-Tools Engine

5. What the Optimization Problem Actually Became

Once the operational rules were formalized, the problem fit naturally into a Capacitated Vehicle Routing Problem with Time Windows (CVRPTW).

Objective Function and Constraints:

At a high level, the solver receives:

It then has to construct a set of vehicle routes that serve the required outlets while respecting capacity and time limits.

The algorithmic machinery was Google's OR-Tools. Once the problem was formulated correctly, this part was surprisingly straightforward.

Fleet Layer
Heterogeneous Vehicles
3.5T, 7T, 14T Volumetric Bounds
Temporal Constraints
Strict Time Windows
06:00-09:00 Narrow Slots
Priority Outlets
High-Yield Sinks
Unserved Overflow Penalty
Solver Engine
Google OR-Tools
Guided Local Search (GLS)
[Depot Dispatch][Route 1: Priority Outlets][Route 2: Secondary Outlets][Real-time Re-solver Trigger on Delay]
Figure 1: CVRPTW Fleet Allocation and Operational Constraint Pipeline showing depot dispatching, priority ordering, narrow time window compliance, and re-solver triggers.

6. Then We Had to Deal With the Real World

A solver can return a perfectly valid route that a human operator would never want to use.

This became obvious during the demos. Operators cared about things that weren't obvious from the optimization formulation:

  1. KPI Headers First: Operators did not want to inspect a long list of stops. They wanted the answer immediately: How much UCO is expected? How long will it take? How full will the vehicle be?
  2. Vehicle Selection Thresholds: For smaller collections under a specific threshold, a moped was preferable. Above that threshold, a larger vehicle was used.

7. Dynamic Pickups and Traffic Navigation

Instead of trying to manually patch an existing route when a new pickup arrived during the day, we treated a new pickup as a new optimization event—re-solving for the remaining unserved locations.

For navigation, the system generated a separate Google Maps route link for each vehicle driver.

That gave us a clean separation of responsibilities:


Act IV: Operational Adoption and Lessons

8. Changed Belief

Operator Takeaway

Initial belief: Route optimization is primarily an algorithmic problem. Give an optimizer a list of locations and it will find the best route.

Changed belief: The algorithm is often the easy part. The real challenge is converting an ambiguous business objective into measurable quantities, translating operational behaviour into constraints, deciding which assumptions are acceptable, and designing the output around how people actually make decisions.

Explore all Labs & ExperimentsGet in Touch →