3

I need to pack maximum no of small cuboid cartons of different sizes (Length, breadth and height) into 8 given huge cuboid containers (Length, breadth and height given). I then need to prepare packing sheet for each container where which of the cartons to store in that container is written. Each of the carton's weight and weight it can accommodate above it is given. There is a constraint that the carton should not damage due to excess weight above it (example you cannot put 3 cartons containing sand above a carton containing cotton). How can the items be packed optimally and how can I ensure that the utilization loss is minimized.

Haris Ali Khan
  • 1,291
  • 9
  • 12
  • Possible duplicate of [Algorithm needed for packing rectangles in a fairly optimal way](http://stackoverflow.com/questions/1213394/algorithm-needed-for-packing-rectangles-in-a-fairly-optimal-way) – Mihriban Minaz May 25 '16 at 10:38
  • I just answered my own question:http://stackoverflow.com/questions/23171542/hints-with-same-rectangles-in-rectangle-packing-algorithm-with-guillotine-limita/37765402#37765402 – Haris Ali Khan Jun 11 '16 at 15:44

1 Answers1

2

Assuming length is greater than the breadth for both the rectangles (smaller and larger ones), following are the possibilities while you try to pack smaller rectangles on the larger one. Let the length of larger rectangle be L, its breadth be B and length and breadth of smaller rectangles be l and b respectively.

Case 1: Pack the smaller rectangles such that their lengths are parallel to the breadth of the larger rectangle until you fall short of space. Then try the other way round (Length of larger rectangle parallel to Lengths of smaller one) on the available space.

Case 2: Pack the smaller rectangles such that their lengths are parallel to the length of the larger rectangle until you fall short of space. Then try the other way round (Length of larger rectangle parallel to breadths of smaller one) on the available space.

Take the maximum of case 1 and case 2 to get the maximum no of smaller rectangles that can be packed on a larger one. Find the python 3 code of the implementation here: http://geekzonelive.blogspot.in/2016/06/packing-similar-small-rectangles-into.html

Haris Ali Khan
  • 1,291
  • 9
  • 12