RecursiveMinimumEigenOptimizer#
- class RecursiveMinimumEigenOptimizer(optimizer, min_num_vars=1, min_num_vars_optimizer=None, penalty=None, history=IntermediateResult.LAST_ITERATION, converters=None)[ソース]#
ベースクラス:
OptimizationAlgorithm
A meta-algorithm that applies a recursive optimization.
The recursive minimum eigen optimizer applies a recursive optimization on top of
OptimizationAlgorithm
. This optimizer can useMinimumEigenOptimizer
as an optimizer that is called at each iteration. The algorithm is introduced in [1].サンプル
Outline of how to use this class:
from qiskit_algorithms import QAOA from qiskit_optimization.problems import QuadraticProgram from qiskit_optimization.algorithms import ( MinimumEigenOptimizer, RecursiveMinimumEigenOptimizer ) problem = QuadraticProgram() # specify problem here # specify minimum eigen solver to be used, e.g., QAOA qaoa = QAOA(...) internal_optimizer = MinimumEigenOptimizer(qaoa) optimizer = RecursiveMinimumEigenOptimizer(internal_optimizer) result = optimizer.solve(problem)
参照
[1] Bravyi et al. (2019), Obstacles to State Preparation and Variational Optimization from Symmetry Protection. arXiv:1910.08980
Initializes the recursive minimum eigen optimizer.
This initializer takes an
OptimizationAlgorithm
, the parameters to specify until when to to apply the iterative scheme, and the optimizer to be applied once the threshold number of variables is reached.- パラメータ:
optimizer (OptimizationAlgorithm) – The optimizer to use in every iteration.
min_num_vars (int) – The minimum number of variables to apply the recursive scheme. If this threshold is reached, the min_num_vars_optimizer is used.
min_num_vars_optimizer (OptimizationAlgorithm | None) – This optimizer is used after the recursive scheme for the problem with the remaining variables. Default value is
MinimumEigenOptimizer
created on top ofNumPyMinimumEigensolver
.penalty (float | None) – The factor that is used to scale the penalty terms corresponding to linear equality constraints.
history (IntermediateResult | None) – Whether the intermediate results are stored. Default value is
LAST_ITERATION
.converters (QuadraticProgramConverter | List[QuadraticProgramConverter] | None) – The converters to use for converting a problem into a different form. By default, when None is specified, an internally created instance of
QuadraticProgramToQubo
will be used.
- 例外:
QiskitOptimizationError – In case of invalid parameters (num_min_vars < 1).
TypeError – When there one of converters is an invalid type.
Methods
- get_compatibility_msg(problem)[ソース]#
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.
- 戻り値の型:
- solve(problem)[ソース]#
Tries to solve the given problem using the recursive optimizer.
Runs the optimizer to try to solve the optimization problem.
- パラメータ:
problem (QuadraticProgram) – The problem to be solved.
- 戻り値:
The result of the optimizer applied to the problem.
- 例外:
QiskitOptimizationError – Incompatible problem.
QiskitOptimizationError – Infeasible due to variable substitution
- 戻り値の型: