Lading
Plans where produce goes, when, and at what price
Created on 15th October 2026
•
Lading
Plans where produce goes, when, and at what price
The problem Lading solves
A produce aggregation hub loses stock every day because the oldest batch goes to the wrong market at the wrong time. Today's careful answer is first-expiry-first-out (FEFO): ship the batch that expires soonest first. But FEFO never asks which market a batch can still reach before it spoils, whether the only truck should go to the batch with no other option, or whether a 20% markdown would sell stock that will otherwise rot.
Lading plans the whole morning at once. For every batch on the floor it decides which market it goes to, which truck slot it leaves on and what discount it sells at, with "on sale before it expires" as a hard rule. A dispatcher can lock or veto any assignment and the plan re-solves around it. Every choice comes with its reason, for example "Bengaluru, not Hyderabad: Hyderabad arrival 13h vs 12h shelf life left." When a route is delayed, a truck breaks down, demand spikes or a new order comes in, it replans live and shows what moved and why.
Measured against FEFO on 50 held-out synthetic days, each played out against 30 realized versions of demand, travel delay and shelf life:
- Net revenue: +₹48,588 per day (median), better on 50 of 50 days
- Spoiled stock: −366 kg per day (median), less on 39 of 50 days
- Demand filled: +1.64 percentage points (median), more on 44 of 50 days
- 0 violations from an independent validator that imports none of the planner's code
All scenarios are synthetic and every assumption is disclosed in the repo. One control, a healthy day with ample shelf life and trucks, failed its pre-registered rule and is reported. Every number comes from make reproduce.
Challenges I ran into
- Routing trucks made the planner too slow. Modelling each truck as a vehicle with round trips left an 11-16% optimality gap after 15 seconds. I rewrote slot choice as each batch's last fresh departure plus one cumulative truck-capacity row per slot, which is exact for an earliest-deadline-first schedule. 60-batch days now solve to a 0.5% gap in about 2 seconds, and brute-force enumeration matches the optimum on 5 small cases.
- My baseline was too weak, so I made it stronger. A cold audit found my FEFO could only discount to 0% or 30% while Lading used the full 0/10/20/30% ladder. I gave FEFO the whole ladder, re-froze the planner and reran every held-out day. The median gain fell from ₹58,942 to ₹46,412 on the same machine, and I report the lower number.
- The pre-registered arm lost. Planning on pessimistic shelf life and travel time did worse than planning on the forecast on the tuning days. A rule I wrote before the freeze picked the forecast arm as the headline, and the robust arm stays in every table.
- Two machines gave two answers. The HiGHS solver stopped at different plans within the same 0.5% gap on my arm64 Mac and the x86 server. I now generate the results on the deploy server, where the live site solves, so the site matches the numbers exactly, and I disclose the drift.
- One control failed and stays failed. On a healthy day both planners still lose up to 6.8% of stock to unsold consignment when real demand comes in under forecast. I kept the failure in the results instead of changing the rule.
Cheer Project
Cheering for a project means supporting a project you like with as little as 0.0025 ETH. Right now, you can Cheer using ETH on Arbitrum, Optimism and Base.