Why logistics is an AI problem now
Logistics has always been an optimisation discipline. What has changed is the volume and granularity of the data and the expectations of customers. E-commerce, food delivery and on-demand services have turned what used to be a few predictable trunk routes into millions of small, time-sensitive trips. Every order generates GPS traces, scan events, payment records and customer messages, and the companies that turn that exhaust into better decisions win on cost and reliability.
The last mile is where this matters most. It is widely regarded as the most expensive leg of the journey because the economies of scale disappear: one vehicle, one rider, many stops, each with its own access problems. In Lagos, add unpredictable traffic, informal addressing, flooding during the rainy season and customers who may not be home or reachable. My training in Geomatics Engineering at the University of Lagos makes this a familiar puzzle to me: a large share of the difficulty is spatial before it is algorithmic.
How the technology actually works
Routing and the vehicle routing problem
The core mathematical problem is the vehicle routing problem (VRP) and its many variants: time windows, capacities, pickups and drop-offs, multiple depots. It is NP-hard, so production systems rely on heuristics and metaheuristics such as local search, guided search and large neighbourhood search. Open-source solvers like Google OR-Tools make these accessible to small teams. More recently, researchers have trained neural networks to construct routes directly; the paper Attention, Learn to Solve Routing Problems! (Kool et al.) showed that attention-based models trained with reinforcement learning can produce competitive solutions for classic routing benchmarks quickly. In practice, learned models are most useful as fast initial solutions or as components inside a classical search.
Travel-time and ETA prediction
Routing is only as good as its cost matrix. Road-network distances are a poor proxy for time in congested cities, so teams train models on historical GPS traces to predict segment-level travel times by hour, day and weather. Graph neural networks over the road network can capture how congestion propagates from one corridor to another. ETA models then combine travel-time predictions with stop-level service time, which is often the bigger source of error: finding the gate, calling the customer, handling payment.
Demand forecasting and dispatch
Fleet sizing and rider scheduling depend on forecasting order volumes by zone and hour. Dispatch for on-demand services is a sequential decision problem, which is why reinforcement learning and approximate dynamic programming appear in research on ride-hailing and courier assignment: the system must decide not just the best match now, but how today's assignment positions the fleet for tomorrow's orders.
Address intelligence
Where formal addresses are weak, machine learning helps geocode free-text descriptions ("opposite the mosque, second gate"), cluster historical delivery points and learn the true drop-off location for a customer from past successful deliveries. This is often the highest-leverage model in an African logistics stack.
Real-world examples
Large parcel carriers have publicly discussed route-optimisation systems that sequence driver stops daily and continuously re-plan as conditions change. Food-delivery and ride-hailing platforms run real-time dispatch engines that batch orders, predict preparation times and match riders. The International Transport Forum at the OECD has published extensively on how data-driven urban freight and shared mobility reshape city streets, including the congestion and safety side effects.
Across Africa, logistics startups have built businesses around digitising fragmented trucking markets, matching shippers with independent truck owners and using data to price loads and predict delays. Last-mile players in Lagos, Nairobi and Accra have invested heavily in their own mapping and address layers because commercial maps miss so much of the informal city. The lesson is consistent: whoever owns the best ground-truth spatial data has a durable advantage.
Risks, limitations and ethics
- Algorithmic management of workers. Dispatch and performance algorithms effectively manage riders. Opaque penalties, unrealistic ETAs and pressure to speed create real safety risks on roads that are already dangerous. Teams should treat rider welfare as a design constraint, not a cost.
- Feedback loops. If an algorithm sends fewer riders to neighbourhoods with historically low order completion, service there gets worse, completion drops further and the model "learns" it was right. Monitor service levels across areas explicitly.
- Brittle optimisation. A perfectly optimised route leaves no slack. When a bridge floods or a road closes, tightly coupled plans fail all at once. Robust or stochastic optimisation trades a little efficiency for resilience.
- Location privacy. GPS traces of riders and customers' home locations are sensitive personal data. In Nigeria, the Nigeria Data Protection Commission oversees obligations that apply directly to this kind of processing.
- Externalities. Faster, cheaper delivery can increase vehicle trips and congestion. Cities are increasingly asking platforms to share data and account for this.
Implementation guidance for teams
- Instrument everything from day one. Capture timestamped GPS, arrival, handover and failure events with consistent IDs. Without this, you cannot measure ETA error or service time, and every model is guesswork.
- Solve the address problem early. Build a customer location layer that improves with each successful delivery. Even simple clustering of confirmed drop-off points beats geocoding vague text.
- Use a classical solver before a neural one. OR-Tools or a well-tuned metaheuristic will get most teams very far. Reserve learned routing for when you have scale and a clear latency need.
- Model service time separately. Driving time and stop time have different causes. Separating them makes both models better and points to operational fixes such as better gate instructions or pre-payment.
- Plan for low connectivity. Rider apps should cache routes and sync events when the network returns. Many routing failures in the field are really sync failures.
- Close the loop with riders. Riders know which roads flood and which estates block motorcycles. Give them a fast way to report it, and feed that into the routing graph.
The World Bank's transport work is a helpful reminder that logistics efficiency is ultimately tied to public infrastructure. Software can route around bad roads, but it cannot pave them.
Conclusion
AI is making logistics more responsive, but the winners in emerging markets will be teams that combine optimisation skill with deep local spatial knowledge and genuine respect for the people doing the driving. The most sophisticated routing engine in the world is useless if it sends a rider down a street that becomes a river every July. Ground truth, robust planning and humane operations are the real competitive advantages.
Key takeaways
- The last mile is expensive and unpredictable; most errors come from service time and addressing, not just driving.
- Classical VRP solvers remain the workhorse; learned routing models are best as fast components or warm starts.
- Travel-time prediction on the road graph and address intelligence are high-leverage models in African cities.
- Algorithmic management, location privacy and service-area feedback loops need explicit safeguards.
- Robustness and offline-first design beat brittle "perfect" optimisation in volatile environments.
References & further reading
- Attention, Learn to Solve Routing Problems! — arXiv (Kool, van Hoof and Welling)
- OR-Tools — Google for Developers
- International Transport Forum — OECD
- Transport topic overview — World Bank
- Nigeria Data Protection Commission — NDPC
Cover image: original illustration created for this article. Cited works remain the property of their respective authors and publishers.