Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Something is wrong with the initialisation? #15

Open
juhoharme opened this issue Oct 20, 2020 · 0 comments
Open

Something is wrong with the initialisation? #15

juhoharme opened this issue Oct 20, 2020 · 0 comments

Comments

@juhoharme
Copy link

I have a use case where I try to fit a set of items that stays constant to a varying set of bins (or actually one bin at a time). Which means I would like to try different bins one at a time, starting with the cheapest package and then moving to more expensive ones if the items don't fit.

However, I am running into problems since it seems to me that the initialisation call of Packer() does not work properly. It would seem it maintains some history of the items I've tried to pack but clears the initialisation of bins, which leads to a situation where two subsequent packing attempts generate different results - the latter requiring a larger bin than on the previous run, and failing to pack in the bin it had found a solution for on the previous run. The only way to get stable results is if the kernel is restarted in between. I think one would expect the call to initialise Packer() to be equivalent to getting a fresh start, but that does not seem to be the case.

The problem is not visible in the results, which shows just the items I've tried to pack both times, but the fact that the 2nd attempt requires a larger bin makes the library where hard to use in practice.

First run:
Found solution:
::::::::::: 790713(800.000x270.000x330.000, max_weight:999.000) vol(71280000.000)
FITTED ITEMS:
====> 226(130.000x200.000x100.000, weight: 0.000) pos([0, 0, 0]) rt(0) vol(2600000.000)
====> 330(330.000x120.000x220.000, weight: 4.800) pos([Decimal('130.000'), 0, 0]) rt(0) vol(8712000.000)
====> 330(330.000x120.000x220.000, weight: 4.800) pos([Decimal('460.000'), 0, 0]) rt(0) vol(8712000.000)
====> 206(300.000x650.000x150.000, weight: 10.000) pos([Decimal('130.000'), Decimal('120.000'), 0]) rt(2) vol(29250000.000)
UNFITTED ITEMS:

Second run:
Found solution:
::::::::::: 790079(790.000x300.000x580.000, max_weight:999.000) vol(137460000.000)
FITTED ITEMS:
====> 226(130.000x200.000x100.000, weight: 0.000) pos([0, 0, 0]) rt(0) vol(2600000.000)
====> 330(330.000x120.000x220.000, weight: 4.800) pos([Decimal('130.000'), 0, 0]) rt(0) vol(8712000.000)
====> 330(330.000x120.000x220.000, weight: 4.800) pos([Decimal('460.000'), 0, 0]) rt(0) vol(8712000.000)
====> 206(300.000x650.000x150.000, weight: 10.000) pos([Decimal('130.000'), Decimal('120.000'), 0]) rt(2) vol(29250000.000)
UNFITTED ITEMS:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant