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

157 lines
7.4 KiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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: MultiStartOptimizer
description: API reference for qiskit.optimization.algorithms.MultiStartOptimizer
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit.optimization.algorithms.MultiStartOptimizer
---
# qiskit.optimization.algorithms.MultiStartOptimizer
<Class id="qiskit.optimization.algorithms.MultiStartOptimizer" isDedicatedPage={true} github="https://github.com/qiskit-community/qiskit-aqua/tree/stable/0.9/qiskit/optimization/algorithms/multistart_optimizer.py" signature="MultiStartOptimizer(trials=1, clip=100.0)" modifiers="class">
An abstract class that implements multi start optimization and should be sub-classed by other optimizers.
Constructs an instance of this optimizer.
**Parameters**
* **trials** (`int`) The number of trials for multi-start method. The first trial is solved with the initial guess of zero. If more than one trial is specified then initial guesses are uniformly drawn from `[lowerbound, upperbound]` with potential clipping.
* **clip** (`float`) Clipping parameter for the initial guesses in the multi-start method. If a variable is unbounded then the lower bound and/or upper bound are replaced with the `-clip` or `clip` values correspondingly for the initial guesses.
### \_\_init\_\_
<Function id="qiskit.optimization.algorithms.MultiStartOptimizer.__init__" signature="__init__(trials=1, clip=100.0)">
Constructs an instance of this optimizer.
**Parameters**
* **trials** (`int`) The number of trials for multi-start method. The first trial is solved with the initial guess of zero. If more than one trial is specified then initial guesses are uniformly drawn from `[lowerbound, upperbound]` with potential clipping.
* **clip** (`float`) Clipping parameter for the initial guesses in the multi-start method. If a variable is unbounded then the lower bound and/or upper bound are replaced with the `-clip` or `clip` values correspondingly for the initial guesses.
</Function>
## Methods
| | |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
| [`__init__`](#qiskit.optimization.algorithms.MultiStartOptimizer.__init__ "qiskit.optimization.algorithms.MultiStartOptimizer.__init__")(\[trials, clip]) | Constructs an instance of this optimizer. |
| [`get_compatibility_msg`](#qiskit.optimization.algorithms.MultiStartOptimizer.get_compatibility_msg "qiskit.optimization.algorithms.MultiStartOptimizer.get_compatibility_msg")(problem) | Checks whether a given problem can be solved with the optimizer implementing this method. |
| [`is_compatible`](#qiskit.optimization.algorithms.MultiStartOptimizer.is_compatible "qiskit.optimization.algorithms.MultiStartOptimizer.is_compatible")(problem) | Checks whether a given problem can be solved with the optimizer implementing this method. |
| [`multi_start_solve`](#qiskit.optimization.algorithms.MultiStartOptimizer.multi_start_solve "qiskit.optimization.algorithms.MultiStartOptimizer.multi_start_solve")(minimize, problem) | Applies a multi start method given a local optimizer. |
| [`solve`](#qiskit.optimization.algorithms.MultiStartOptimizer.solve "qiskit.optimization.algorithms.MultiStartOptimizer.solve")(problem) | Tries to solves the given problem using the optimizer. |
## Attributes
| | |
| ---------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------ |
| [`clip`](#qiskit.optimization.algorithms.MultiStartOptimizer.clip "qiskit.optimization.algorithms.MultiStartOptimizer.clip") | Returns the clip value for this optimizer. |
| [`trials`](#qiskit.optimization.algorithms.MultiStartOptimizer.trials "qiskit.optimization.algorithms.MultiStartOptimizer.trials") | Returns the number of trials for this optimizer. |
### clip
<Attribute id="qiskit.optimization.algorithms.MultiStartOptimizer.clip">
Returns the clip value for this optimizer.
**Return type**
`float`
**Returns**
The clip value.
</Attribute>
### get\_compatibility\_msg
<Function id="qiskit.optimization.algorithms.MultiStartOptimizer.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.MultiStartOptimizer.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>
### multi\_start\_solve
<Function id="qiskit.optimization.algorithms.MultiStartOptimizer.multi_start_solve" signature="multi_start_solve(minimize, problem)">
Applies a multi start method given a local optimizer.
**Parameters**
* **minimize** (`Callable`\[\[`ndarray`], `Tuple`\[`ndarray`, `Any`]]) A callable object that minimizes the problem specified
* **problem** (`QuadraticProgram`) A problem to solve
**Return type**
`OptimizationResult`
**Returns**
The result of the multi start algorithm applied to the problem.
</Function>
### solve
<Function id="qiskit.optimization.algorithms.MultiStartOptimizer.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>
### trials
<Attribute id="qiskit.optimization.algorithms.MultiStartOptimizer.trials">
Returns the number of trials for this optimizer.
**Return type**
`int`
**Returns**
The number of trials.
</Attribute>
</Class>