Open Noodleyman opened 4 years ago
Just following up to say that I've already got a version of this working for my own use case, so don't need anything. thought I would share the idea in case it's useful.
I take the max length, width, depth of the items and add 20mm to the max value. I then set the length = max length, and do a while loop to build boxes covering iterations of 50mm for all combinations of width/depth. this builds a lot of boxes and then I let boxPacker find the most suitable sizes whilst respecting other custom constraints.
It works, but can get bogged down based on the number of boxes it needs to add, thus setting the precision to 50mm instead of 10mm, as this reduces the number of boxes significantly.
Works great, does what I need. not sure if this is a feature you would want to add at some point, but just adding it to the list for your review in case you think it's worth adding.
hello noodley can you share your code to use it, im searching exactly what you said, i will be very grateful.
I think this is related to #212. I have asked a question to find single box that can fit all the items
This would be a great feature. The only library I have come across that does this is https://github.com/Cloudstek/php-laff. It works and I have had it in production for many years (note my open issue lodged regards having to order the items) but it's old and the author admits it should be rewritten. Would be a great addition to BoxPacker, and I have the same use case as Noodleyman - the items do not fit into the specific box sizes I am testing for (USPS Flat Rate), I do not have a list of all the boxes my 3PL can use, and so I just need to know the smallest box they will fit in.
@neodisco for php-laff, the calculated width of the fake container is the width of the widest item (ignoring any rotation), and the length is the length of the longest item (again ignoring the possibility of rotation). It's "a" shape, but is it optimal for the items?
Also note e.g. #211, there is a request there for things to be packed as square-like (cube-like?) as possible i.e. into a specific shape. That's the tricky bit here, everyone's got a different idea of what an ideal box shape is 😅.
Hi Doug! Thank you so much for this great library. You're a true legend.
I believe I have seen that LAFF algo create long "skyscraper" boxes of the same product if left to its own devices (forgive me if I am mistaken in that). That will rarely be what was wanted. I think most people would have a need where there is an desired shape, and that can be defined by proportions. For me it would be "typical shipping box proportions" of 3:4:5. For others it would be 1:1:1. Perhaps the proposed function could be defined by 3 proportions. The resulting box would have to conform to at least 2 of those proportions with the third being able to be less (to save space) but not more. This could create a box that was larger than a LAFF fit though.
So perhaps LAFF-style could be attempted first (it works well if there is one large item and a few other bits and pieces), then if the resulting LAFF shape created a box that was greater than the desired ratio of proportions, LAFF would be abandoned and the smallest box to fit everything that constrained to the ratio would be used.
Please forgive my naiveté in thinking about solutions here, I don't pretend to be very good at complicated algorithms and am very thankful generous people such as yourself have contributed what you have so us mere mortals can have better lives.
Just putting it on the list in case it's of interest. Another problem to solve in the case of "virtual" boxes for the business case of drop shippers, who may not know the dimensions of a box a supplier will ship goods in.
It would be really funky to be able to supply a list of items and have it return a single box, the smallest package those items would fit into, including weight / dimensions in the returned box.
useful for getting quotes from carriers when you don't know the exact dimensions of boxes available.