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

Wrong result for self-defined inputs #1

Open
Magic-Fang opened this issue Mar 20, 2018 · 6 comments
Open

Wrong result for self-defined inputs #1

Magic-Fang opened this issue Mar 20, 2018 · 6 comments

Comments

@Magic-Fang
Copy link

System: ubuntu 14.04 LTS
Environment: Python 3.6.4
Description: I set my own test case to run the palletier but the solver.print_solution() function print the wrong answer, in which two object are overlapped. My test case is as follow:
6.text
1
120, 100, 120
40, 26, 22, 4
35, 21, 29, 4
30, 44, 24, 4

Is it the problem of my setting of pallet dims?

@Magic-Fang
Copy link
Author

The result of my test case is:
Box #0 with dims (40, 22, 26) located at (0, 0, 0)
Box #1 with dims (40, 22, 26) located at (40, 0, 0)
Box #2 with dims (40, 22, 26) located at (80, 0, 0)
Box #3 with dims (40, 22, 26) located at (0, 0, 26)
Box #4 with dims (35, 21, 29) located at (40, 0, 26)
Box #5 with dims (35, 21, 29) located at (75, 0, 26)
Box #6 with dims (35, 21, 29) located at (5, 0, 52)
Box #7 with dims (35, 21, 29) located at (5, 0, 55)
Box #8 with dims (44, 30, 24) located at (0, 22, 0)
Box #9 with dims (44, 30, 24) located at (44, 22, 0)
Box #10 with dims (24, 30, 44) located at (88, 22, 0)
Box #11 with dims (44, 30, 24) located at (44, 22, 24)

It can be found that box 6 and box 7 are overlapped.

@alanbato
Copy link
Contributor

Hey @Magic-Fang. is the problem still present? I see the overlap but I'm not sure what might be causing it.

@prituja
Copy link

prituja commented Jul 17, 2019

Hi @Magic-Fang were you able to fix the overlap error? I have the same issue when I use my own data sets. Also, I would like to add different dimensions of the pallet in a single run. Is it possible to do that?

@lucabonno
Copy link

Hi @alanbato, and thank you very much for this library. I found the problem that causes the overlapping of boxes. Basically when the algorithm goes from right to left (situation 2) at a certain point the coordinates are updated considering the highest x of the last box placed, while there are previous boxes already packed which are occupying space.
In the example attached (plot as 2d for the sake of simplicity) you see the sequence used by the code for packing. 1,2,3,4 then the algo starts moving on the left packing 5 and 6. At box 7, the edges to evaluates are [Corner(x=32, z=44), Corner(x=80, z=36)] while they should be [Corner(x=64, z=44), Corner(x=80, z=36)] because of box 5.
I've not the overall picture of the algo so I've not found a solution yet. May you help?
Thanks
2021-10-03_21h45_34

@lucabonno
Copy link

Hi @alanbato, and thank you very much for this library. I found the problem that causes the overlapping of boxes. Basically when the algorithm goes from right to left (situation 2) at a certain point the coordinates are updated considering the highest x of the last box placed, while there are previous boxes already packed which are occupying space. In the example attached (plot as 2d for the sake of simplicity) you see the sequence used by the code for packing. 1,2,3,4 then the algo starts moving on the left packing 5 and 6. At box 7, the edges to evaluates are [Corner(x=32, z=44), Corner(x=80, z=36)] while they should be [Corner(x=64, z=44), Corner(x=80, z=36)] because of box 5. I've not the overall picture of the algo so I've not found a solution yet. May you help? Thanks 2021-10-03_21h45_34

error solved:
line 71 of topology.py

x_coord = self.smallest.x - dims.dim1
python is assigning to x_coord value self.smallest.x - dims.dim1 but it is at the same time removing dims.dim1 to self.smallest.x.
solution, save the variable and use it later on (line 76) when a new corner is created. Hope this helps.

@alanbato
Copy link
Contributor

alanbato commented Oct 6, 2021

Hi @lucabonno

Thank you for your interest in the project and for finding a solution for this long-lasting problem.
I have not been involved in this project for a while, but I'm happy to look at a PR with the changes you proposed :)

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

4 participants