QuantumRandomAccessOptimizer#
- class QuantumRandomAccessOptimizer(min_eigen_solver, max_vars_per_qubit=3, rounding_scheme=None, *, penalty=None)[source]#
Bases:
OptimizationAlgorithm
Quantum Random Access Optimizer class.
- প্যারামিটার:
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.
- রেইজেস:
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)[source]#
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.
- প্যারামিটার:
problem (QuadraticProgram) -- The optimization problem to check compatibility.
- রিটার্নস:
A message describing the incompatibility.
- রিটার্ন টাইপ:
- is_compatible(problem)#
Checks whether a given problem can be solved with the optimizer implementing this method.
- প্যারামিটার:
problem (QuadraticProgram) -- The optimization problem to check compatibility.
- রিটার্নস:
Returns True if the problem is compatible, False otherwise.
- রিটার্ন টাইপ:
- process_result(problem, encoding, relaxed_result, rounding_result)[source]#
Process the relaxed result of the minimum eigensolver and rounding scheme.
- প্যারামিটার:
problem (QuadraticProgram) -- The
QuadraticProgram
to be solved.encoding (QuantumRandomAccessEncoding) -- An encoding instance for which
encode()
has already been called so it has been encoded with aQuadraticProgram
.relaxed_result (MinimumEigensolverResult) -- The relaxed result of the minimum eigensolver.
rounding_result (RoundingResult) -- The result of the rounding scheme.
- রিটার্নস:
The result of the quantum random access optimization.
- রিটার্ন টাইপ:
- solve(problem)[source]#
Solve the relaxed Hamiltonian given by the encoding and round the solution by the given rounding scheme.
- প্যারামিটার:
problem (QuadraticProgram) -- The
QuadraticProgram
to be solved.- রিটার্নস:
The result of the quantum random access optimization.
- রেইজেস:
ValueError -- If the encoding has not been encoded with a
QuadraticProgram
.- রিটার্ন টাইপ:
- solve_relaxed(encoding)[source]#
Solve the relaxed Hamiltonian given by the encoding.
নোট
This method uses the encoding instance given as
encoding
and ignoresmax_vars_per_qubit()
.- প্যারামিটার:
encoding (QuantumRandomAccessEncoding) -- An encoding instance for which
encode()
has already been called so it has been encoded with aQuadraticProgram
.- রিটার্নস:
The result of the minimum eigensolver, and the rounding context.
- রেইজেস:
ValueError -- If the encoding has not been encoded with a
QuadraticProgram
.- রিটার্ন টাইপ:
tuple[qiskit_algorithms.minimum_eigensolvers.minimum_eigensolver.MinimumEigensolverResult, qiskit_optimization.algorithms.qrao.rounding_common.RoundingContext]