NumberPartition#

class NumberPartition(number_set)[ソース]#

ベースクラス: OptimizationApplication

Optimization application for the 「number partition」 [1] problem.

参照

[1]: 「Partition problem」, https://en.wikipedia.org/wiki/Partition_problem

パラメータ:

number_set (List[int]) – A list of integers

Methods

interpret(result)[ソース]#

Interpret a result as a list of subsets

パラメータ:

result (OptimizationResult | ndarray) – The calculated result of the problem

戻り値:

A list of subsets whose sum is the half of the total.

戻り値の型:

List[List[int]]

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.

戻り値の型:

ndarray

to_quadratic_program()[ソース]#

Convert a number partitioning problem instance into a QuadraticProgram

戻り値:

The QuadraticProgram created from the number partitioning problem instance.

戻り値の型:

QuadraticProgram