dimod.generators.bin_packing#
- bin_packing(weights: list[float], capacity: float) ConstrainedQuadraticModel[source]#
Generate a bin packing problem as a constrained quadratic model.
The bin packing problem, BPP, seeks to find the smallest number of bins that will fit a set of weighted items given that each bin has a weight capacity.
- Parameters:
weights – The weights for each item.
capacity – The capacity of the bin.
- Returns:
The constrained quadratic model encoding the bin packing problem. Variables are labeled as
y_{j}wherey_{j} == 1means that binjhas been used andx_{i}_{j}wherex_{i}_{j} == 1means that itemihas been placed in binj.