kotarot / rectangle-packing-solver

A solver to find a solution of the 2D rectangle packing problem by simulated annealing (SA) optimization.
Apache License 2.0
86 stars 17 forks source link

Getting Wrong Result #34

Open arncode90 opened 2 years ago

arncode90 commented 2 years ago

Hello there, actually i like your packing solver because it came out with visualization.

The issue here im getting wrong placement of the result (or im just using wrong code i dont know).

problem = rps.Problem(rectangles=[
    {"width": 30, "height": 60, "rotatable": True},
    {"width": 30, "height": 50, "rotatable": True}
])
solution = rps.Solver().solve(problem=problem, width_limit=60, show_progress=True, seed=1111)
print("solution:", solution)

###
solution: Solution({'sequence_pair': SequencePair(([0, 1], [1, 0])), 'floorplan': Floorplan({'positions': [{'id': 0, 'x': 0, 'y': 50, 'width': 30, 'height': 60}, {'id': 1, 'x': 0, 'y': 0, 'width': 30, 'height': 50}], 'bounding_box': (30, 110), 'area': 3300})})

for the bounding box, it should be this right ?

'bounding_box': (60, 60)

kotarot commented 2 years ago

@catherinezera88 Hi! Thank you for reporting the issue. I reproduce the same issue in my environment, and it seems a bug in the solver. Yes, it should be (60, 60). I'll try to fix it.