Skip to main contentIBM Quantum Documentation
You are viewing the API reference for an old version of Qiskit SDK. Switch to latest version

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(opens in a new tab)

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(opens in a new tab)

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.