qiskit-documentation/docs/api/qiskit/0.26/qiskit.optimization.algorit...

92 lines
4.3 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: OptimizationAlgorithm (v0.26)
description: API reference for qiskit.optimization.algorithms.OptimizationAlgorithm in qiskit v0.26
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit.optimization.algorithms.OptimizationAlgorithm
---
<span id="qiskit-optimization-algorithms-optimizationalgorithm" />
# qiskit.optimization.algorithms.OptimizationAlgorithm
<Class id="qiskit.optimization.algorithms.OptimizationAlgorithm" isDedicatedPage={true} github="https://github.com/qiskit-community/qiskit-aqua/tree/stable/0.9/qiskit/optimization/algorithms/optimization_algorithm.py" signature="OptimizationAlgorithm" modifiers="class">
An abstract class for optimization algorithms in Qiskits optimization module.
### \_\_init\_\_
<Function id="qiskit.optimization.algorithms.OptimizationAlgorithm.__init__" signature="__init__()">
Initialize self. See help(type(self)) for accurate signature.
</Function>
## Methods
| | |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
| [`__init__`](#qiskit.optimization.algorithms.OptimizationAlgorithm.__init__ "qiskit.optimization.algorithms.OptimizationAlgorithm.__init__")() | Initialize self. |
| [`get_compatibility_msg`](#qiskit.optimization.algorithms.OptimizationAlgorithm.get_compatibility_msg "qiskit.optimization.algorithms.OptimizationAlgorithm.get_compatibility_msg")(problem) | Checks whether a given problem can be solved with the optimizer implementing this method. |
| [`is_compatible`](#qiskit.optimization.algorithms.OptimizationAlgorithm.is_compatible "qiskit.optimization.algorithms.OptimizationAlgorithm.is_compatible")(problem) | Checks whether a given problem can be solved with the optimizer implementing this method. |
| [`solve`](#qiskit.optimization.algorithms.OptimizationAlgorithm.solve "qiskit.optimization.algorithms.OptimizationAlgorithm.solve")(problem) | Tries to solves the given problem using the optimizer. |
### get\_compatibility\_msg
<Function id="qiskit.optimization.algorithms.OptimizationAlgorithm.get_compatibility_msg" signature="get_compatibility_msg(problem)" modifiers="abstract">
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.
</Function>
### is\_compatible
<Function id="qiskit.optimization.algorithms.OptimizationAlgorithm.is_compatible" signature="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.
</Function>
### solve
<Function id="qiskit.optimization.algorithms.OptimizationAlgorithm.solve" signature="solve(problem)" modifiers="abstract">
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**](qiskit.optimization.QiskitOptimizationError "qiskit.optimization.QiskitOptimizationError") If the problem is incompatible with the optimizer.
</Function>
</Class>