Overcoming The CAP Theorem of Food Delivery
How we deliver fresh food with broad selection and near-zero cost
Written by Adithep Narula and Jimmy Cao, with input from Charles-Axel Dein.
It’s 11:52am on a Tuesday, eight minutes before the first lunch windows land. One kitchen inside one of our CloudKitchens facilities is running five minutes behind, and the courier waiting on it already has orders from three other kitchens ready in the bag, all bound for different offices.
The ready orders are starting to go cold. If the courier waits, one late kitchen can make every other office on the route late too. If the courier leaves, the late orders still need to be picked up, routed, and delivered by someone else.
That one late kitchen forks into a chain of coupled decisions, all due in the next ninety seconds:
Does the courier leave now, dropping the late orders to protect the rest of the route?
If they leave, which backup courier can pick up the late orders without making another route worse?
If they wait, which offices are most likely to miss their delivery window - and is that worse than splitting the route?
These are a few of the questions someone, or something, has to answer in real time for every order. It is a coordination problem that plays out tens of thousands of times a day across hundreds of moving couriers.
These complex coordination problems are the cost we pay for refusing the tradeoffs every other food delivery model makes. To understand why we take these difficult tradeoffs, you have to understand the economics of the product category.
The CAP Theorem of Food Delivery
According to the American Time Use Survey from the Bureau of Labor Statistics, meal preparation and cleanup is the single most time-consuming household activity for Americans aged 15 and over — and people who do it spend over an hour a day on it. The rise of online food delivery has shown just how much people are willing to pay to buy that hour back. But the model behind most food delivery is still stuck with a basic trade-off.
Selection, freshness, and cost are the three dimensions that define any food delivery service, and today’s established players generally get two of the three:
Huge selection, fresh, expensive (DoorDash, Uber Eats, Meituan, iFood) - These are the consumer apps we all know. You get speed and selection, and you pay heavily for both.
Reasonable selection, days-old or frozen, cheap (Factor, CookUnity, HelloFresh) - The meal-kit and prepared-meal providers. They win on cost by preparing food ahead of time and bulk-delivering it, but the meal is days old or frozen by the time you eat it.
Limited selection, fresh, cheap (ezCater, Forkable, Fooda, traditional catering): They take a different path: limit the menu to food a few restaurants can prepare in bulk, then deliver it cheaply to pre-arranged settings.
Every model seems to give up one side of the triangle. It starts to look like a law of the category - a CAP theorem for food delivery. This fundamentally limits the impact these services can have. But the trade-off is not a fundamental law. It is an economic pattern created by the physical infrastructure food delivery has been built on. Change the infrastructure, and the economics can change with it.
That’s the bet at Atoms: with the right physical infrastructure and technology, you can have all three. We’re building toward fresh, nutritious meals delivered at a cost that approaches a trip to the grocery store - giving back the hour a day spent on meal prep to the people who need it most.
Picnic is our lunch delivery service, and it is where that larger bet meets logistics. We run CloudKitchens facilities that co-locate dozens of restaurant partners, which gives customers a broad selection without forcing couriers to pick up across the city. We offer scheduled delivery windows, which turn sporadic orders into predictable demand for the kitchens. Together, they allow our courier partners to deliver large batches to offices instead of one or two orders at a time. That is how you deliver on three qualities at the same time: selection from co-located kitchens, freshness from scheduled windows, and lower cost from sophisticated batching.

When the Plan Meets Reality
Our model makes the economics work because once you can turn a stream of independent, dynamic requests into predictable batches, it allows us to do something no on-demand platform can: plan ahead of time.
Given the orders we expect, the facilities to pick up from, and the delivery windows each building is promised, we search for the set of routes that covers everything with the fewest couriers. It is the same dense, multi-stop planning a carrier like UPS or Amazon does overnight. The output is a static plan, and on paper it’s close to optimal.
The catch is that package carriers and food delivery networks operate on very different clocks. When reality diverges from a parcel plan, a driver calls out, a depot runs late, the system can absorb it with slack: the package arrives tomorrow. Our “package” is a cooked meal, and if it’s an hour late, it has lost most of its value. We need the route density of an offline package network and the reflexes of an on-demand one, at the same time.
And reality diverges constantly - not on the demand we engineered away, but on supply and execution. Couriers call out with no notice, kitchens can be understaffed or otherwise fall behind on cooking, orders get misplaced. The same nested delivery plan that makes us efficient also couples us tightly: a slow kitchen, a missed handoff, or a wrong batch grabbed in the rush does not stay local; it ripples outward into a cascade of late deliveries.
Every one of these collapses to the same priority order: cover every order, deliver it correctly, get it there on time, and do it as cheaply as possible — in that order. Holding that line across a live network, as conditions change by the minute, is the whole problem. It is harder than either the offline plan or the real-time scramble on its own.

Translating into Engineering Challenges
Successfully operating our delivery network is an engineering challenge spanning operations research, distributed systems, machine learning, and mobile. Here are a few of the problems that define the work:
A Multi-Echelon Routing Problem: At its core there is a large-scale combinatorial optimization problem known as the Vehicle Routing Problem (VRP), where the goal is to find a set of delivery routes that minimizes the overall cost given multiple pickup and delivery locations, heterogeneous fleets and tight time constraints. Food delivery makes this harder. The Meal Delivery Routing Problem (MDRP) captures the dynamic, urgent, and unpredictable nature of online food delivery, which also relies on an independent-contractor courier supply. Most platforms respond to that uncertainty by simplifying the problem into greedy online matching problems: assign one order, or a small set of orders, to one courier as quickly as possible. That works, but it leaves a lot of courier capacity unused. Picnic changes the shape of the problem by removing much of the unpredictable demand up front. Orders are scheduled before a cutoff, facilities are known, and delivery windows are fixed. This is the algorithmic difference between delivery that can cost as much as the meal itself, and delivery that is cheap enough for the eater not to pay a delivery fee at all.
Real-Time Decision Making, Not Just Offline Planning: However, with food delivery, we can only remove so much uncertainty and have very little slack in the system for when things go wrong. Orders that get misplaced, restaurants that fall behind with cooking, couriers that get lost in unfamiliar office towers all need a new solution within minutes. So we must be able to react in real time - this imposes tight latency constraints onto an NP-hard optimization problem that traditional food delivery platforms don’t even try to solve. This forces us to invent novel techniques to decompose the problem, compute new solutions fast, and keep the solutions as stable as possible between iterations of the plan, since couriers that are already moving cannot be reshuffled without creating chaos. The bleeding edge of this work draws on classical operations research as well as modern reinforcement learning techniques because sequential decision-making under uncertainty is what Markov Decision Processes model.
Resource Allocation Under Uncertainty: As mentioned in the original MDRP paper, ensuring enough courier supply can be even more important than clever routing on eventual quality of service when operating at scale. So we also need to consider the scheduling of couriers as a first-class sub-problem. This is especially tricky when you have independent contractors who can choose to reject work at any time.
State Estimation From Noisy Signals: To plan and decide anything, the system needs an accurate picture of the physical world. We need to forecast order volumes, predict task times, and get accurate travel times between locations as inputs to the planning process. We then need to close the loop on these predictions by accurately instrumenting the real world when our couriers execute the plans to learn and adjust. GPS signals drop out in subways or reflect off buildings in urban canyons, manually triggered in-app timestamps can be equally unreliable, so the full picture comes from sensor fusion across various instrumentation techniques that feed both our real-time systems and data pipelines for training prediction models.
Byzantine Inputs: Anything a user reports could be wrong - food grabbed from the wrong rack, a status tap that doesn’t match reality, or a missed scan, whether accidental or not. Recovery and reconciliation have to be first-class, and weather sits in the same bucket: it shifts demand and travel times fast enough to invalidate the optimizer’s inputs in real time.
Real-Time State Across Three Clients: When an operator acts, reassigns an order, pulls in a backup, that change has to stay consistent across the backend that holds the source of truth, the WebSocket-powered ops console where every manager sees the same picture at once, and the courier’s phone over a flaky network. A routing change that doesn’t reach the phone the second it’s made is worse than no change at all.
Where We’re Headed
Humans and software run this network together today, with operators and automated systems making real-time calls side by side. But a tightly coupled network scales only so far on human coordination, so we’re pushing further: from tooling that helps people react, toward a continuous reconciliation loop for the physical world.
If that sounds like a Kubernetes controller, the philosophy is identical. The system treats our optimized plan as the desired state, constantly ingests the live stream of physical telemetry as the actual state, and continuously works to close the gap - resolving the vast majority of network drift automatically and escalating only the genuinely novel anomalies to a human operator.
Getting there means solving large-scale combinatorial optimization problems fast enough to matter during a lunch rush; sophisticated data pipelines and ML models that instrument and predict the messy real world; complex, sequential decision-making systems that react in real time to deal with the unexpected in near optimal ways; and the real-time infrastructure that keeps every operator and courier synchronized on the exact same state at once.
The work spans frontend, backend, mobile, operations research, and data science. If you’re drawn to real-time optimization, operational complexity, and systems that have to work under the hard constraints of the physical world, we’re hiring across North America.
Come build it with us.



This is an excellent piece that clearly connects real-world issues to their engineering counterparts. While the CAP theorem and K8s controllers provide abstract layers to manage this complexity, the actual world presents challenges that are significantly more unpredictable and time-sensitive.