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

Bin orientation makes difference in finding a solution #16

Open
thomas-v2 opened this issue Nov 18, 2020 · 1 comment
Open

Bin orientation makes difference in finding a solution #16

thomas-v2 opened this issue Nov 18, 2020 · 1 comment

Comments

@thomas-v2
Copy link

I've a very simple test case, where the algorithm can't fit all items. But when I change the orientation of the bin, it can fit all. Is this a bug or is the algorithm very limited and can't solve such a simple combination?

from py3dbp import Packer, Bin, Item

packer = Packer()

packer.add_bin(Bin('Bin-1', 6, 1, 5, 100))
packer.add_bin(Bin('Bin-2', 5, 1, 6, 100))
packer.add_item(Item('Box-1', 3, 1, 2, 1))
packer.add_item(Item('Box-2', 3, 1, 2, 1))
packer.add_item(Item('Box-3', 3, 1, 2, 1))
packer.add_item(Item('Box-4', 3, 1, 2, 1))
packer.add_item(Item('Box-5', 3, 1, 2, 1))

packer.pack()

for b in packer.bins:
    print(":::::::::::", b.string())

    print("FITTED ITEMS:")
    for item in b.items:
        print("====> ", item.string())

    print("UNFITTED ITEMS:")
    for item in b.unfitted_items:
        print("====> ", item.string())

    print("***************************************************")
    print("***************************************************")

Result:

::::::::::: Bin-1(6.000x1.000x5.000, max_weight:100.000) vol(30.000)
FITTED ITEMS:
====>  Box-1(3.000x1.000x2.000, weight: 1.000) pos([0, 0, 0]) rt(0) vol(6.000)
====>  Box-2(3.000x1.000x2.000, weight: 1.000) pos([Decimal('3.000'), 0, 0]) rt(3) vol(6.000)
====>  Box-3(3.000x1.000x2.000, weight: 1.000) pos([0, 0, Decimal('2.000')]) rt(0) vol(6.000)
====>  Box-4(3.000x1.000x2.000, weight: 1.000) pos([Decimal('3.000'), 0, Decimal('3.000')]) rt(3) vol(6.000)
UNFITTED ITEMS:
====>  Box-5(3.000x1.000x2.000, weight: 1.000) pos([0, 0, Decimal('4.000')]) rt(0) vol(6.000)
***************************************************
***************************************************
::::::::::: Bin-2(5.000x1.000x6.000, max_weight:100.000) vol(30.000)
FITTED ITEMS:
====>  Box-1(3.000x1.000x2.000, weight: 1.000) pos([0, 0, 0]) rt(0) vol(6.000)
====>  Box-2(3.000x1.000x2.000, weight: 1.000) pos([Decimal('3.000'), 0, 0]) rt(3) vol(6.000)
====>  Box-3(3.000x1.000x2.000, weight: 1.000) pos([0, 0, Decimal('2.000')]) rt(0) vol(6.000)
====>  Box-4(3.000x1.000x2.000, weight: 1.000) pos([Decimal('3.000'), 0, Decimal('3.000')]) rt(3) vol(6.000)
====>  Box-5(3.000x1.000x2.000, weight: 1.000) pos([0, 0, Decimal('4.000')]) rt(0) vol(6.000)
UNFITTED ITEMS:
***************************************************
***************************************************
@thomas-v2
Copy link
Author

thomas-v2 commented Nov 20, 2020

Ok, the so called "algorithm" is very basic.

But what at least is wrong, is the check if the item fits in the bin, as it doesn't takes the rotation of the item into account.

From example above, rotation of one of the items on X or Z axis will let the item stick out of the bin.

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