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

217 lines
5.5 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: GroverOptimizationResult
description: API reference for qiskit.optimization.algorithms.GroverOptimizationResult
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit.optimization.algorithms.GroverOptimizationResult
---
# GroverOptimizationResult
<Class id="qiskit.optimization.algorithms.GroverOptimizationResult" isDedicatedPage={true} github="https://github.com/qiskit-community/qiskit-aqua/tree/stable/0.9/qiskit/optimization/algorithms/grover_optimizer.py" signature="GroverOptimizationResult(x, fval, variables, operation_counts, n_input_qubits, n_output_qubits, intermediate_fval, threshold, status)" modifiers="class">
Bases: `qiskit.optimization.algorithms.optimization_algorithm.OptimizationResult`
A result object for Grover Optimization methods.
Constructs a result object with the specific Grover properties.
**Parameters**
* **x** (`Union`\[`List`\[`float`], `ndarray`]) The solution of the problem
* **fval** (`float`) The value of the objective function of the solution
* **variables** (`List`\[`Variable`]) A list of variables defined in the problem
* **operation\_counts** (`Dict`\[`int`, `Dict`\[`str`, `int`]]) The counts of each operation performed per iteration.
* **n\_input\_qubits** (`int`) The number of qubits used to represent the input.
* **n\_output\_qubits** (`int`) The number of qubits used to represent the output.
* **intermediate\_fval** (`float`) The intermediate value of the objective function of the solution, that is expected to be identical with `fval`.
* **threshold** (`float`) The threshold of Grover algorithm.
* **status** (`OptimizationResultStatus`) the termination status of the optimization algorithm.
## Attributes
### fval
<Attribute id="qiskit.optimization.algorithms.GroverOptimizationResult.fval">
Returns the optimal function value.
**Return type**
`float`
**Returns**
The function value corresponding to the optimal value found in the optimization.
</Attribute>
### intermediate\_fval
<Attribute id="qiskit.optimization.algorithms.GroverOptimizationResult.intermediate_fval">
Getter of the intermediate fval
**Return type**
`float`
**Returns**
The intermediate value of fval before interpret.
</Attribute>
### n\_input\_qubits
<Attribute id="qiskit.optimization.algorithms.GroverOptimizationResult.n_input_qubits">
Getter of n\_input\_qubits
**Return type**
`int`
**Returns**
The number of qubits used to represent the input.
</Attribute>
### n\_output\_qubits
<Attribute id="qiskit.optimization.algorithms.GroverOptimizationResult.n_output_qubits">
Getter of n\_output\_qubits
**Return type**
`int`
**Returns**
The number of qubits used to represent the output.
</Attribute>
### operation\_counts
<Attribute id="qiskit.optimization.algorithms.GroverOptimizationResult.operation_counts">
Get the operation counts.
**Return type**
`Dict`\[`int`, `Dict`\[`str`, `int`]]
**Returns**
The counts of each operation performed per iteration.
</Attribute>
### raw\_results
<Attribute id="qiskit.optimization.algorithms.GroverOptimizationResult.raw_results">
Return the original results object from the optimization algorithm.
Currently a dump for any leftovers.
**Return type**
`Any`
**Returns**
Additional result information of the optimization algorithm.
</Attribute>
### samples
<Attribute id="qiskit.optimization.algorithms.GroverOptimizationResult.samples">
Returns the list of solution samples
**Return type**
`List`\[`SolutionSample`]
**Returns**
The list of solution samples.
</Attribute>
### status
<Attribute id="qiskit.optimization.algorithms.GroverOptimizationResult.status">
Returns the termination status of the optimization algorithm.
**Return type**
`OptimizationResultStatus`
**Returns**
The termination status of the algorithm.
</Attribute>
### threshold
<Attribute id="qiskit.optimization.algorithms.GroverOptimizationResult.threshold">
Getter of the threshold of Grover algorithm.
**Return type**
`float`
**Returns**
The threshold of Grover algorithm.
</Attribute>
### variable\_names
<Attribute id="qiskit.optimization.algorithms.GroverOptimizationResult.variable_names">
Returns the list of variable names of the optimization problem.
**Return type**
`List`\[`str`]
**Returns**
The list of variable names of the optimization problem.
</Attribute>
### variables
<Attribute id="qiskit.optimization.algorithms.GroverOptimizationResult.variables">
Returns the list of variables of the optimization problem.
**Return type**
`List`\[`Variable`]
**Returns**
The list of variables.
</Attribute>
### variables\_dict
<Attribute id="qiskit.optimization.algorithms.GroverOptimizationResult.variables_dict">
Returns the optimal value as a dictionary of the variable name and corresponding value.
**Return type**
`Dict`\[`str`, `float`]
**Returns**
The optimal value as a dictionary of the variable name and corresponding value.
</Attribute>
### x
<Attribute id="qiskit.optimization.algorithms.GroverOptimizationResult.x">
Returns the optimal value found in the optimization or None in case of FAILURE.
**Return type**
`Optional`\[`ndarray`]
**Returns**
The optimal value found in the optimization.
</Attribute>
</Class>