Skip to content

Get all boxes combinations? #266

Answered by dvdoug
CarlesRever asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @CarlesRever

The answer depends a little bit on how much you mean by "all", because as soon as you have an order than needs multiple boxes, things become interdependent, as what's best for the second box depend on what you picked for the first one...

There are 2 main classes that are relevant here VolumePacker (packs items in a box), and Packer which wraps around that and handles the the logic relating to permutations.

The first approach I'd suggest is just extending Packer and overriding the findBestBoxFromIteration method (https://github.com/dvdoug/BoxPacker/blob/3.x/src/Packer.php#L237) so that the comparison does what you need. That way you'll keep the benefit from any future enhan…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by CarlesRever
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants