qubo_to_ising

qubo_to_ising(qubo, *, hamiltonian_builder='native', quadratization_strength=None)[source]

Convert a QUBO/HUBO to a cleaned Ising Hamiltonian.

Normalizes the input, converts via the selected Ising converter, cleans constant terms, and validates the result.

Parameters:
  • qubo – QUBO dict, HUBO dict, numpy matrix, BQM, or BinaryPolynomial.

  • hamiltonian_builder (Literal['native', 'quadratized']) – "native" or "quadratized".

  • quadratization_strength (float | None) – Penalty for quadratization. None (default) picks an adaptive strength 2 * max(|hubo coeff|) so the penalty dominates the objective for arbitrary problem scales — see QuadratizedIsingConverter. Ignored when hamiltonian_builder="native".

Return type:

IsingResult

Returns:

IsingResult with cost Hamiltonian, loss constant, qubit count, and full Ising encoding.

Raises:

ValueError – If the Hamiltonian contains only constant terms.