dvdoug / BoxPacker

4D bin packing / knapsack problem solver
MIT License
602 stars 156 forks source link

Satchel / Bag Option #141

Open cseufert opened 6 years ago

cseufert commented 6 years ago

It would be great to have a way to pack into satchels as well as boxes, or really small items. Australia Post sells small, medium and large prepaid satchels. (https://auspost.com.au/sending/satchels-and-packaging/send-in-satchel-or-envelope/flat-rate-satchels)

I can see this being fairly tricky, as the length and width get smaller depending on the height of the item placed inside.

Do you have any tips if I were to have a go at implementing this myself?

dvdoug commented 6 years ago

Yeah, to do this properly will be quite difficult - unpicking the assumptions in the code that width/height/depth are fixed would be doable, but care would need to be taken not to regress performance too much.

The main problem though would actually modelling the shape of the satchel - I'm not sure I even know what words to search for to find the appropriate formula 🤔

spectravp commented 5 years ago

Howdy,

Since envelopes, satchels, etc have become common in shipping, I thought I would chime in and support the addition of this functionality. This is known as the Tea Bag problem and the math is actually pretty straightforward: https://en.wikipedia.org/wiki/Paper_bag_problem

dvdoug commented 5 years ago

@spectravp knowing the formal name for this problem is very helpful, thank you! Unfortunately I don't think that formula is quite sufficient for what's needed here, as a simple volume comparison isn't enough - we need to do something along the lines of calculating the (dynamic) depth of the open satchel at points along it's length so it's possible to make a decision about fit.

I see some reading ahead of me

spectravp commented 5 years ago

Understood and I agree. Knowing the total volume is only half the equation. I’m pretty sure I saw a formula for determining dimensions at any given point within the tea bag. Let me see if I can find that for you.

colinmollenhour commented 5 years ago

As a simple workaround you could probably introduce two or more "boxes" for each envelope using predetermined dimensions based on how full it is height-wise. E.g. a 10x14 envelope might have the following rough sizes:

noknokcody commented 3 years ago

Any update on this? I'm looking for a way of calculating how many items fit in a satchel-like container for shipping. Perhaps interested in sponsoring the development of this feature and a couple others if possible.

dvdoug commented 3 years ago

Hi @noknokcody - I saw you reached out on LinkedIn, have replied to you there.

erikkvarnbranna commented 3 years ago

The (simple) way I solved this was.

Simple and far from perfect but seems to work reasonably well.