QuantumRandomAccessOptimizer#

class QuantumRandomAccessOptimizer(min_eigen_solver, max_vars_per_qubit=3, rounding_scheme=None, *, penalty=None)[fuente]#

Bases: OptimizationAlgorithm

Quantum Random Access Optimizer class.

Parámetros:
  • min_eigen_solver (MinimumEigensolver) – The minimum eigensolver to use for solving the relaxed problem.

  • max_vars_per_qubit (int) – The maximum number of decision variables per qubit. Integer values 1, 2 and 3 are supported (default to 3).

  • rounding_scheme (RoundingScheme | None) – The rounding scheme. If None is provided, SemideterministicRounding will be used.

  • penalty (float | None) – The penalty factor to use for the QuadraticProgramToQubo converter.

Muestra:
  • ValueError – If the maximum number of variables per qubit is not 1, 2, or 3.

  • TypeError – If the provided minimum eigensolver does not support auxiliary operators.

Attributes

max_vars_per_qubit#

Return the maximum number of variables per qubit.

min_eigen_solver#

Return the minimum eigensolver.

rounding_scheme#

Return the rounding scheme.

Methods

get_compatibility_msg(problem)[fuente]#

Checks whether a given problem can be solved with this optimizer.

Checks whether the given problem is compatible, i.e., whether the problem can be converted to a QUBO, and otherwise, returns a message explaining the incompatibility.

Parámetros:

problem (QuadraticProgram) – The optimization problem to check compatibility.

Devuelve:

A message describing the incompatibility.

Tipo del valor devuelto:

str

is_compatible(problem)#

Checks whether a given problem can be solved with the optimizer implementing this method.

Parámetros:

problem (QuadraticProgram) – The optimization problem to check compatibility.

Devuelve:

Returns True if the problem is compatible, False otherwise.

Tipo del valor devuelto:

bool

process_result(problem, encoding, relaxed_result, rounding_result)[fuente]#

Process the relaxed result of the minimum eigensolver and rounding scheme.

Parámetros:
Devuelve:

The result of the quantum random access optimization.

Tipo del valor devuelto:

QuantumRandomAccessOptimizationResult

solve(problem)[fuente]#

Solve the relaxed Hamiltonian given by the encoding and round the solution by the given rounding scheme.

Parámetros:

problem (QuadraticProgram) – The QuadraticProgram to be solved.

Devuelve:

The result of the quantum random access optimization.

Muestra:

ValueError – If the encoding has not been encoded with a QuadraticProgram.

Tipo del valor devuelto:

QuantumRandomAccessOptimizationResult

solve_relaxed(encoding)[fuente]#

Solve the relaxed Hamiltonian given by the encoding.

Nota

This method uses the encoding instance given as encoding and ignores max_vars_per_qubit().

Parámetros:

encoding (QuantumRandomAccessEncoding) – An encoding instance for which encode() has already been called so it has been encoded with a QuadraticProgram.

Devuelve:

The result of the minimum eigensolver, and the rounding context.

Muestra:

ValueError – If the encoding has not been encoded with a QuadraticProgram.

Tipo del valor devuelto:

tuple[qiskit_algorithms.minimum_eigensolvers.minimum_eigensolver.MinimumEigensolverResult, qiskit_optimization.algorithms.qrao.rounding_common.RoundingContext]