dimod.generators.random_bin_packing#
- random_bin_packing(num_items: int, seed: int | None = None, weight_range: Tuple[int, int] = (10, 30)) ConstrainedQuadraticModel [source]#
Generate a bin packing problem as a constrained quadratic model.
The weights for each item are integers uniformly drawn from in the
weight_range
. The bin capacity is set tonum_items * mean(weights) / 5
.- Parameters:
num_items – Number of items to choose from.
seed – Seed for NumPy random number generator.
weight_range – The range of the randomly generated weights for each item.
- Returns:
The constrained quadratic model encoding the bin packing problem. Variables are labeled as
y_{j}
wherey_{j} == 1
means that binj
has been used andx_{i}_{j}
wherex_{i}_{j} == 1
means that itemi
has been placed in binj
.