I'm dealing with a problem that is a slight twist on the 3-d bin packing problem.
I have a finite set of bins (on the order of 100's), and a finite set of items (one the order of 10's). Below is an simplified example.
bins = [
Bin(10, 10, 10, 50),
Bin(20, 20, 20, 100),
Bin(30, 30, 30, 200),
]
items = [
Item(5, 5, 5, 10),
Item(8, 8, 8, 20),
Item(12, 12, 12, 30),
Item(15, 15, 15, 40),
Item(18, 18, 18, 50),
]
Lets assume the bin and item objects are as follows
class Bin:
def __init__(self, length, width, height, max_weight):
self.length = length
self.width = width
self.height = height
self.max_weight = max_weight
self.volume = length * width * height
class Item:
def __init__(self, length, width, height, weight):
self.length = length
self.width = width
self.height = height
self.weight = weight
self.volume = length * width * height
I need the system, given a set of bins and items to assign every item to a box given the following constraints.
- If any of the dimensions of the item are more than the dimension of the box, the item cannot be boxed.
- The summed weight of the items cannot exceed the boxes max_weight.
The variable we are optimizing for is volumetric weight of the boxes.
Volumetric weight = (length * width * height) * multiplier
We want to minimize the summed volumetric weight of all the assigned boxes. (Same as minimizing the summed volume).
The output should look like: (The following is not correct, just for demo)
Box A: [Item_A,Item_B]
Box B: [Item_C]
No Box: [Item_D]
Ideally, I would prefer if there is a python package that does this. I'm aware the solution is NP-hard, I need some output though.