Skip to main contentIBM Quantum Documentation
This page is from an old version of Qiskit SDK and does not exist in the latest version. We recommend you migrate to the latest version. See the release notes for more information.

qiskit.optimization.applications.ising.partition

Generate Number Partitioning (Partition) instances, and convert them into a Hamiltonian given as a Pauli list.

Functions

get_operator(values)Construct the Hamiltonian for a given Partition instance.
partition_value(x, number_list)Compute the value of a partition.

get_operator

get_operator(values)

GitHub

Construct the Hamiltonian for a given Partition instance.

Given a list of numbers for the Number Partitioning problem, we construct the Hamiltonian described as a list of Pauli gates.

Parameters

values (numpy.ndarray) – array of values.

Returns

operator for the Hamiltonian and a constant shift for the obj function.

Return type

tuple(WeightedPauliOperator, float)

partition_value

partition_value(x, number_list)

GitHub

Compute the value of a partition.

Parameters

  • x (numpy.ndarray) – binary string as numpy array.
  • number_list (numpy.ndarray) – list of numbers in the instance.

Returns

difference squared between the two sides of the number

partition.

Return type

float

Was this page helpful?
Report a bug or request content on GitHub.