Mystery Box Manager
produce allocation engine
Every week, surplus produce needs distributing into mystery boxes.
By hand, it's slow and uneven. Some boxes get shortchanged.
An ILP solver balances value, variety, and fairness at once.
Six penalty dimensions. 800 tuning trials. Every box is fair.
Tweak the priorities. The algorithm adapts instantly.
scroll to explore
XLSX MySQL ILP Solver Output Scorer

Pipeline

  • Weekly XLSX defines surplus produce; SSH-tunnelled MySQL supplies prices and box tiers
  • HiGHS ILP solver finds provably optimal allocations for each box tier
  • Output feeds directly back into the running Laravel system as tab-delimited data
  • Validated offline against 42 real historical offers spanning four data tiers
Manual
71
Value: 72% -28%
Same item: 4x excess
Categories: 3/8
vs
ILP-optimal
94
Value: 98% +26%
Same item: 2x max
Categories: 7/8

Hyper-dimensional scoring

  • Multiple penalty dimensions score every box: value, variety, concentration and more
  • Hitting the target value means nothing if half the box is carrots
  • Two-layer model penalises flooding at item and category level
  • Penalty weights tuned by Optuna, cross-validated against 42 historical offers
Optuna tuning cross-validated ILP solver provably optimal gap assessment EBM + ordinal regression

Tuning to proof

  • Optuna explores 800 weight configurations, cross-validated against real packing history
  • Best weights feed into an ILP solver that finds the provably optimal allocation
  • Glass-box EBM and ordinal regression on packer survey data diagnose scoring blind spots, distilling discovered patterns as new penalty terms