BinPacking#
- class BinPacking(weights, max_weight, max_number_of_bins=None)[fuente]#
Bases:
OptimizationApplication
Optimization application for the «bin packing» [1] problem.
Referencias
[1]: «Bin packing», https://en.wikipedia.org/wiki/Bin_packing_problem
- Parámetros:
Methods
- get_figure(result)[fuente]#
Get plot of the solution of the Bin Packing Problem.
- Parámetros:
result (OptimizationResult | ndarray) – The calculated result of the problem
- Devuelve:
A plot of the solution, where x and y represent the bins and sum of the weights respectively.
- Tipo del valor devuelto:
fig
- interpret(result)[fuente]#
Interpret a result as item indices
- Parámetros:
result (OptimizationResult | ndarray) – The calculated result of the problem
- Devuelve:
A list of lists with the items in each bin
- Tipo del valor devuelto:
items_in_bins
- static sample_most_likely(state_vector)#
Compute the most likely binary string from state vector.
- Parámetros:
state_vector (QuasiDistribution | Statevector | ndarray | Dict) – state vector or counts or quasi-probabilities.
- Devuelve:
binary string as numpy.ndarray of ints.
- Muestra:
ValueError – if state_vector is not QuasiDistribution, Statevector, np.ndarray, or dict.
- Tipo del valor devuelto: