The most difficult thing about this problem is mixed size boxes. Knowing where every box is is easy when they're all the same dimension and stacked neatly, but what about when they're packed randomly, many boxes are askew, and they're all different sizes? Then you need to get into complicated time-of-flight sensors, point clouds, surface/box recognition logic/AI, etc..
The world changed quite a lot due to standardized shipping containers. It was a mess before that.
I really do think the same could be applied to shipping packaging.
There are 12 sized boxes and that's that. They need to be stacked a certain way.
Or maybe a bit of flex here and there for some things.
Nobody really has the wherewithal or power to do that, but you know ... Xi could. I can see that being something China imposes, and then it's a standard that naturally gets exported.
Amazon basically does this, I think? As a consumer, I hate it, because I end up with a huge box and loads of useless paper whenever something isn't the right aspect ratio for one of the standard boxes.
Obviously for distribution of stock you could probably be smarter about it and waste less space/cardboard since you've probably got lots of each size of item.
I think some of the time for this, is they have X of common standard sized box, and Y of less common smaller/differently shaped box, and eventually they run out of Y sized box, so they go down the list of close matches until they find a box in stock at that particular packing station. I've ordered the same thing (baby formula premix ready to drink, fairly large, fairly heavy) in sets of two for several months and it's been shipped at least four different ways that I can remember; I doubt the bin packing algorithm is changing that drastically from week to week.
Amazon has so many though [0] that I don't really think that's directly why that happens - I'd assume it's just laze (whether human or algorithmic!) in finding the optimal box, and going with one that's obviously big enough, to hand, or whatever.
I worked for Amazon in sustainability for some time. "Fitting" 'perfectly' requires literally billions of shape combinations, because multiple items ship in one box. I question whether it would save any holistic measure of energy/emissions/waste to solve that problem to any measure of 'perfectly'.
The work Amazon has done to change box types, switch to bags, etc., has reduced waste considerably per package, though I suspect the absolute amount of waste has continued to increase with business growth.
When I worked at a grocery store, our solution for re-stacking pallets of merchandise was to place the largest boxes at the bottom and build upward with smaller boxes. Obviously this wouldn't be a great way to do things in a shipping container given the amount of vertically wasted space, but it worked in a warehouse.
Of course, the reason we were re-stacking pallets is because our original managers were so bad at managing inventory that the 20ish backstock carts were full, so we would routinely have 15-25 pallets of backstock in the warehouse... when ideally the carts should only ever be half full. Saved their jobs when I took the order gun from them, lol.
The nice thing about shipping containers is that you have walls that can provide lateral stability and a bit of retention. Loading for UPS you would basically play 3D Tetris building walls of boxes. As you neared the end of each row you would pick a box 2-3 inches too wide to fit and smash it in there to lock everything up.
To unload you most reverse the process. Unless it gets busy then you just pull the whole wall down at one time and bulldoze the boxes onto the rollers.
Restacking pallets in warehouses is way harder. It’s more like building a house of cards but no card is the same size.
> place the largest boxes at the bottom and build upward with smaller boxes
I think this is actually a basic rule in packing / loading. Get the big things in first and then work around them with the small things. It's how I load my car when going on a big trip. The main exception is things that you will need quickly without having to unload everything.
'Big things first' is also why mixtures (e.g. muesli) settle in transit with the larger pieces at the top and dust at the bottom. Small things can work their way under the big things but the converse isn't true, unless the whole volume is vigorously shaken.