BinPacking#
- class BinPacking(weights, max_weight, max_number_of_bins=None)[source]#
Bases:
OptimizationApplication
Optimization application for the "bin packing" [1] problem.
References
[1]: "Bin packing", https://en.wikipedia.org/wiki/Bin_packing_problem
- প্যারামিটার:
Methods
- get_figure(result)[source]#
Get plot of the solution of the Bin Packing Problem.
- প্যারামিটার:
result (OptimizationResult | ndarray) -- The calculated result of the problem
- রিটার্নস:
A plot of the solution, where x and y represent the bins and sum of the weights respectively.
- রিটার্ন টাইপ:
fig
- interpret(result)[source]#
Interpret a result as item indices
- প্যারামিটার:
result (OptimizationResult | ndarray) -- The calculated result of the problem
- রিটার্নস:
A list of lists with the items in each bin
- রিটার্ন টাইপ:
items_in_bins
- static sample_most_likely(state_vector)#
Compute the most likely binary string from state vector.
- প্যারামিটার:
state_vector (QuasiDistribution | Statevector | ndarray | Dict) -- state vector or counts or quasi-probabilities.
- রিটার্নস:
binary string as numpy.ndarray of ints.
- রেইজেস:
ValueError -- if state_vector is not QuasiDistribution, Statevector, np.ndarray, or dict.
- রিটার্ন টাইপ: