MinimumEigenOptimizer#

class MinimumEigenOptimizer(min_eigen_solver, penalty=None, converters=None)[ソース]#

ベースクラス: OptimizationAlgorithm

A wrapper for minimum eigen solvers.

This class provides a wrapper for minimum eigen solvers from Qiskit to be used within the optimization module. It assumes a problem consisting only of binary or integer variables as well as linear equality constraints thereof. It converts such a problem into a Quadratic Unconstrained Binary Optimization (QUBO) problem by expanding integer variables into binary variables and by adding the linear equality constraints as weighted penalty terms to the objective function. The resulting QUBO is then translated into an Ising Hamiltonian whose minimal eigen vector and corresponding eigenstate correspond to the optimal solution of the original optimization problem. The provided minimum eigen solver is then used to approximate the ground state of the Hamiltonian to find a good solution for the optimization problem.

サンプル

Outline of how to use this class:

from qiskit_algorithms import QAOA
from qiskit_optimization.problems import QuadraticProgram
from qiskit_optimization.algorithms import MinimumEigenOptimizer
problem = QuadraticProgram()
# specify problem here
# specify minimum eigen solver to be used, e.g., QAOA
qaoa = QAOA(...)
optimizer = MinimumEigenOptimizer(qaoa)
result = optimizer.solve(problem)

This initializer takes the minimum eigen solver to be used to approximate the ground state of the resulting Hamiltonian as well as a optional penalty factor to scale penalty terms representing linear equality constraints. If no penalty factor is provided, a default is computed during the algorithm (TODO).

パラメータ:
例外:
  • TypeError – If minimum eigensolver has an invalid type.

  • TypeError – When one of converters has an invalid type.

  • QiskitOptimizationError – When the minimum eigensolver does not return an eigenstate.

Attributes

min_eigen_solver#

Returns the minimum eigensolver.

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.

戻り値の型:

str

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.

戻り値の型:

bool

solve(problem)[ソース]#

Tries to solves the given problem using the 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 – If problem not compatible.

戻り値の型:

MinimumEigenOptimizationResult