Skip to content
F

FreshRoute

One-day produce dispatch, explained and verified

Created on 15th October 2026

•

F

FreshRoute

One-day produce dispatch, explained and verified

The problem FreshRoute solves

PS 03 — perishable produce distribution. A depot holds batches of tomatoes, spinach, bananas, mangoes and onions, each with a different remaining shelf life. Today someone has to decide which batch ships first, to which market, and whether a discount is worth it. Usually that is a greedy rule in a manager's head.

What FreshRoute does

  • Plans the day as a max-profit min-cost flow over batch, market and lane (stock, demand, lane capacity, transport cost).
  • Never creates a shipment that would arrive with less than one sellable day, or after the market's delivery window.
  • Searches discount levels per market and commodity against a shared cost model, with the price elasticity shown as an assumption (0.5 / 1.0 / 1.5 selector).
  • Gives every dispatch a one-line reason ("spinach B18 has 2.2d left, ships 800 kg to Pune APMC and arrives with 1.1d to sell").
  • A separate verifier re-checks stock, lane capacity, shelf life and delivery window: 0 violations on all 30 held-out datasets.

Measured honestly (30 held-out seeds of our generator, 1000-1029, same cost model for everyone)

  • Against four baselines, including a careful urgent-first best-margin dispatcher and that dispatcher plus a flat 30% surplus discount.
  • Net revenue vs the strongest baseline: +0.8% at elasticity 0.5 and +4.1% at 1.5 on the default set; +0.0% (a tie) on the shelf-life-binding set at 0.5. Never worse on any dataset.
  • Really spoiled kg: the same as the strongest baseline. Against FIFO-to-nearest / FIFO-to-highest-price it avoids about 9,300-14,200 kg per dataset.
  • Plan runs in ~30 ms in the browser; 33 tests; README tables are generated by npm run eval, so docs cannot drift from results.

Our claim is narrow: a small, testable single-day dispatcher whose every line is explained and whose output is verified feasible. We do not claim better waste numbers than forecasting products like Afresh, Wasteless or RELEX.

Live app: https://wild-bugs-ten.vercel.app/ · Code: https://github.com/Ryugi62/wild-bugs-freshroute · Demo video: https://wild-bugs-ten.vercel.app/docs/demo.mp4

Challenges I ran into

1. Our first headline was wrong, and we retracted it. v1 reported +5.6% net revenue and 38% less waste. An independent red-team pass showed most of that came from a price elasticity of 1.5 (where a 30% discount raises revenue by definition) and from baselines that were not allowed to discount. We added a 0.5 / 1.0 / 1.5 elasticity sweep, a fourth baseline (dispatcher + flat 30% surplus discount) and made the most conservative value the headline.

2. "Spoilage" was 0 kg for everyone. The original generator never made shelf life bind, so every strategy spoiled nothing and the metric could not separate them. We added a shelf-life-binding set (60% short-life batches, known +0.4-0.9 day trip delays, thinner demand), show it side by side with the default set on the same seeds, and split undispatched stock into expired vs held by remaining life. Result: we match the strong rule-based dispatcher on spoiled kg and say so.

3. A sign bug in uplift. On days where the baseline's net revenue is negative, a percentage uplift flips sign, so "never worse" and a "-35% minimum uplift" appeared together. Fixed by always reporting the INR difference and showing a percentage only when the baseline net is above 0, with a test that the two can never contradict.

4. Delivery windows and cliffs. Adding hard delivery windows made the model realistic but steep: a trip 0.25 days late loses the whole shipment. We publish the stress test as wins / ties / losses (ties are not counted as wins) and a +0.25 day buffered variant that cuts spoiled kg by 29% at a real revenue cost, instead of hiding the trade-off.

Discussion

Builders also viewed

See more projects on Devfolio