Skip to main contentIBM Quantum Documentation
This page is from an old version of Qiskit SDK and does not exist in the latest version. We recommend you migrate to the latest version. See the release notes for more information.

qiskit.optimization.algorithms.OptimizationAlgorithm

class OptimizationAlgorithm

GitHub

An abstract class for optimization algorithms in Qiskit’s optimization module.

__init__

__init__()

Initialize self. See help(type(self)) for accurate signature.


Methods

__init__()Initialize self.
get_compatibility_msg(problem)Checks whether a given problem can be solved with the optimizer implementing this method.
is_compatible(problem)Checks whether a given problem can be solved with the optimizer implementing this method.
solve(problem)Tries to solves the given problem using the optimizer.

get_compatibility_msg

abstract get_compatibility_msg(problem)

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

Parameters

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

Return type

str

Returns

Returns the incompatibility message. If the message is empty no issues were found.

is_compatible

is_compatible(problem)

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

Parameters

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

Return type

bool

Returns

Returns True if the problem is compatible, False otherwise.

solve

abstract solve(problem)

Tries to solves the given problem using the optimizer.

Runs the optimizer to try to solve the optimization problem.

Parameters

problem (QuadraticProgram) – The problem to be solved.

Return type

OptimizationResult

Returns

The result of the optimizer applied to the problem.

Raises

QiskitOptimizationError – If the problem is incompatible with the optimizer.

Was this page helpful?
Report a bug or request content on GitHub.