PDA

View Full Version : Stupid computers!



xoggoth
25th June 2015, 09:50
Due to the simplistic postage calculations on my website, it sometimes costs us a lot more to post a large order than we have charged for, so I was attempting to implement some proper calculations. By weight is obviously easy enough but one also has to calculate what could fit in a large letter and Parcel Force charges by volume. How do you arrange items of different sizes to make up the least volume where volume is based on the maximum dimension in each direction?

Thought this would simple but it ain't. You need to be a professor:

algorithm - How can I programmatically determine how to fit smaller boxes into a larger package? - Stack Overflow (http://stackoverflow.com/questions/140406/how-can-i-programmatically-determine-how-to-fit-smaller-boxes-into-a-larger-pack)

But actually packing something sensibly yourself requires almost no thought at all, proving computers have a long way to go before they take over the world. If they had asked The Terminator to fit various quantities of different items x, y and z in a square box, he would have gone "cannot compute, cannot compute, cannot compute, ..." in a rising pitch and his head would have exploded. Problem sorted.

tractor
25th June 2015, 09:57
Due to the simplistic postage calculations on my website, it sometimes costs us a lot more to post a large order than we have charged for, so I was attempting to implement some proper calculations. By weight is obviously easy enough but one also has to calculate what could fit in a large letter and Parcel Force charges by volume. How do you arrange items of different sizes to make up the least volume where volume is based on the maximum dimension in each direction?

Thought this would simple but it ain't. You need to be a professor:

algorithm - How can I programmatically determine how to fit smaller boxes into a larger package? - Stack Overflow (http://stackoverflow.com/questions/140406/how-can-i-programmatically-determine-how-to-fit-smaller-boxes-into-a-larger-pack)

But actually packing something sensibly yourself requires almost no thought at all, proving computers have a long way to go before they take over the world. If they had asked The Terminator to fit various quantities of different items x, y and z in a square box, he would have gone "cannot compute, cannot compute, cannot compute, ..." in a rising pitch and his head would have exploded. Problem sorted.

Change the angle (http://www.edwdebono.com/debono/wl.htm)from which you approach the problem.

T2 would simply have rearranged the dimensions of the package before inserting it neatly into the smallest package possible.

OwlHoot
25th June 2015, 10:13
I'm sure there are no rules to say parcels must be cuboid shaped.

So maybe you could simply arrange your packages in increasing size order, then enclose them all in shrink wrap to make a flexible snake-like parcel.

OH in "trying to think outside the box (literally)" mode

xoggoth
25th June 2015, 10:35
no rules to say parcels must be cuboid shaped

Unfortunately there are for Parcel Force:


if your package is irregularly shaped, the volumetric weight is calculated based on the dimensions of the smallest cubic shape the package will fit into.

NotAllThere
25th June 2015, 11:20
Do you have a record of the charged vs actual costs? Have you checked that the under charges actually do outweigh the over charges? You might find that there's no real issue - or if there is, simply adding 10% across the board covers it. Or some kind of surcharge based on weight.

Play around with the figures and see if you can come up with a simplish formula that covers what your customers actually order, and means overall, you're ahead.

That's far better than trying to find an ideal solution. Alternatively, there are commercial APIs available that do a good job - buy one.

xoggoth
25th June 2015, 12:37
Sensible stuff. What I thought originally before deciding to see if anything could be done more rigourously. Now I am so flippin' OCD I will be obsessed with it until I find a solution.

Contreras
25th June 2015, 17:09
Sensible stuff. What I thought originally before deciding to see if anything could be done more rigourously. Now I am so flippin' OCD I will be obsessed with it until I find a solution.

Ah yes the old Knapsack Problem (https://en.wikipedia.org/wiki/Knapsack_problem), related to the Cutting Stock Problem (https://en.wikipedia.org/wiki/Cutting_stock_problem), and pondered upon since before stupid computers were invented.

Not simple in 1D and you want to do it in 3D. :laugh

Dactylion
25th June 2015, 17:49
If you do come up with a simple solution you have a perfect PlanB

You could sell it to all the ficking useless tulip courier companies, the even more ficking useless tulip mail companies and make an absolute fortune.

I know from painful personal experience that none of the aforementioned ficking useless tulip companies have anything more sophisticated than a trained chimp randomly selecting which ficking stupid algorithm will be used for any particular item.

FFS My last example of the ficking stupidity of these people was that it apparently cost twice as much to send a cylinder of x cm diameter than it cost to the same ficking thing in a long square box unless it was fairly heavy as above this weight the long square box fell into a different category but the cylinder didn't.

So if you want to send a poster cheaply you should put it in a long square box not in a poster tube but if you want to send gold ingots you should pop them into a cardboard tube first! It's ficking madness I tell you! ficking madness!

mudskipper
25th June 2015, 17:57
So if you want to send a poster cheaply you should put it in a long square box not in a poster tube but if you want to send gold ingots you should pop them into a cardboard tube first! It's ficking madness I tell you! ficking madness!

I'm not trusting my gold ingots to the vagaries of Royal Mail (or worse, Yodel!)

Dactylion
25th June 2015, 18:12
I'm not trusting my gold ingots to the vagaries of Royal Mail (or worse, Yodel!)

According to folklore it used to be done all the time in places like Hatton Garden.

Apparently the penalties for robbing or interfering with the Royal Mail were stricter than for plain nicking stuff and if it was your gold the risk of your stuff getting nicked was lower.

Obviously in those halcyon days the Royal Mail provided a service where next day delivery was...... well lets just leave it at they provided a service.

I can't say I believe the folklore completely but it's a good yarn! I certainly remember post arriving reliably a couple of times a day rather than in bulk on random days with gaps of several days with nothing.

Also strictly speaking it wasn't ingots they allegedly posted just jewellery and gems.

TheLordDave
25th June 2015, 19:22
3d array corresponding to the possible box sizes. Each element represents a unit of set fidelity(1m,1cm etc) as items are 'packed' update the bool in the array to indicate space taken. Start with the largest item and fit it in a corner then iterate through the others in decreasing size. Same as a human would do it.

xoggoth
25th June 2015, 22:11
3d array corresponding to the possible box sizes. Each element represents a unit of set fidelity(1m,1cm etc) as items are 'packed' update the bool in the array to indicate space taken. Start with the largest item and fit it in a corner then iterate through the others in decreasing size. Same as a human would do it.

Indeed. Think that's more or less what I started doing before I read this. To biggest item in dim 1, get lowest volume of alternative orientations of 2nd biggest, then 3rd etc. If only have 2nd biggest item do ditto for next biggest etc. Fortunately we only have 7 diff products. May get it sorta sorted tomorrow.

yasockie
26th June 2015, 08:04
Change the angle (http://www.edwdebono.com/debono/wl.htm)from which you approach the problem.
Must me good entertainment, as it seems people pay for this kind of doubletalk?