
Jurij Tokarski
A Warehouse Algorithm Cut Prep Time 70%
Staff spent hours choosing which cartons to open. An algorithm now picks them in seconds, cut prep time 70%, and still runs six years on.
In 2020 an owner, a friend of a friend, called me. His warehouse staff spent hours matching products to shipments.
The company imported whole trucks of cartons, hundreds per delivery. It sent the goods on in outgoing shipments, each made of packages for its clients.
On day one the owner gave me two rules: older deliveries shipped first, and each package stayed under a customs value cap. Every carton opened meant items picked out and repacked by hand. So the real question was never how much stock there was, but which cartons to open.

The Spreadsheet Was the Only Map
Each delivery arrived with its own Excel file, often thousands of rows long. A row was one product in one carton, described in 10 to 15 columns: a database dumped into a spreadsheet.
Staff compared that spreadsheet with the cartons by hand to fill each shipment, and the work was wearing the team out.
With hundreds of cartons and thousands of products, even the most experienced staff made mistakes. One wrong product meant an unhappy client and an expensive return.
Only Three or Four Columns Mattered
I started with the data: an import for each delivery's Excel file.
Of the 10 to 15 columns, only three or four told products apart. I set grouping rules around them. Each product also kept its delivery, so the same product from two deliveries counted as two and older stock could leave first.
Thousands of unreadable rows became a clean virtual warehouse.
Choosing Cartons Was the Real Work
With the import working, I mapped the whole workflow. The app now covered creating shipments, assigning packages to clients under the customs cap, calculating weights and costs, and generating the documents. Each shipment got one page with its totals.
One page per shipment: totals, packages, cartons and weight, built from the imported data
But standing in the warehouse, I watched a staff member squint at a carton label and check a printed spreadsheet. Then they walked to another aisle, opened a carton and took two items, dozens of times over.
Every step meant matching tiny numbers on cartons against endless rows on paper. That was the hard part: knowing which cartons to open and what to take from each. The app had to take over that cross-checking.
The Buffer Picks Cartons in Seconds
My answer was an algorithm called the Buffer. It works in five steps:
- Takes the shipment's requirements.
- Checks every carton in the warehouse against them.
- Ranks first the cartons the shipment needs in full: they never need opening.
- For cartons it needs in part, says what to take and what to leave.
- Prints a report for the warehouse staff.
Hours of mental cross-checking became seconds of computer work. The output is one list of cartons per shipment.
The Buffer's list: a carton marked Single leaves whole
Mixed Cartons Broke the First Version
In mid-2020, mixed cartons threw the first Buffer's counts off. A carton holding several products, one or two of each, didn't fit the rules I had written.
I kept patching the counts, and every fix broke a more important case. What held was a manual step I had added days earlier: a button where staff confirm a carton can go out whole.
Paper Stayed Next to the Scanner
I also added a barcode scanner to the app, in place of the printed spreadsheet. Each carton already had a barcode that matched one of the columns in the Excel file.
Many warehouse workers still preferred paper. Rather than fight it, I kept it: the Buffer's printed report went along with the app.
For each carton, the screen and the printout gave the same three answers:
- Take the whole carton: the shipment needs all of it.
- Take specific items: the shipment needs part of it.
- Leave it: this shipment doesn't need it.
Bigger Shipments Found Two Limits
In early 2021, shipments got bigger, and my first data design couldn't hold them: it kept whole cartons inside each shipment's record. Marking a carton as scanned started to fail. As a stopgap, I made the app save each scan in the background, and scanning worked again.
That spring, a delivery of 500 cartons came in, and more than half of them left whole. The rest of the shipment had to come from cartons outside its list, and the scanner couldn't see those. A month later, I made each scan search the whole warehouse.
Four Years In, the First Upgrade
Late in 2021, I handed the app over to the owner. It then ran for three years without a deploy, and by 2024 it needed an update.
I rebuilt its two core parts, the Buffer and the scanner. The new Buffer points to each carton instead of storing a copy, the structural fix the first limit had called for.
The new scanner also answered an old problem: the aisles were often dim, which made barcodes hard to read. It got a torch that turns on instantly and a 2x zoom.
Since then the fixes have been small. Once, the app hung on a carton with no items left in it, and the fix shipped the same day.
Anyone Can Build a Shipment Now
The app has run for six years, with one upgrade. What started as a carton picker became the warehouse's core system.
The client summed up what the app changed:
Building an efficient shipment used to take the most experienced staff. With the Buffer's list and the scanner, anyone on the floor can do it. This is what I call automating the hard part.
Which carton do I open? The Buffer still answers in seconds.
Got thoughts on this? Reply by email.

Jurij Tokarski
I run a solo business and produce software. Usually I'm shipping for clients or building for myself. Sometimes I pause to write about it.