qiskit-documentation/docs/api/qiskit/0.33/qiskit.transpiler.synthesis...

77 lines
2.2 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: ApproximatingObjective
description: API reference for qiskit.transpiler.synthesis.aqc.ApproximatingObjective
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit.transpiler.synthesis.aqc.ApproximatingObjective
---
# ApproximatingObjective
<Class id="qiskit.transpiler.synthesis.aqc.ApproximatingObjective" isDedicatedPage={true} github="https://github.com/qiskit/qiskit/tree/stable/0.19/qiskit/transpiler/synthesis/aqc/approximate.py" signature="ApproximatingObjective" modifiers="class">
Bases: `abc.ABC`
A base class for an optimization problem definition. An implementing class must provide at least an implementation of the `objective` method. In such case only gradient free optimizers can be used. Both method, `objective` and `gradient`, preferable to have in an implementation.
## Methods Defined Here
### gradient
<Function id="qiskit.transpiler.synthesis.aqc.ApproximatingObjective.gradient" signature="ApproximatingObjective.gradient(param_values)" modifiers="abstract">
Computes a gradient with respect to parameters given a vector of parameter values.
**Parameters**
**param\_values** (`ndarray`) a vector of parameter values for the optimization problem.
**Return type**
`ndarray`
**Returns**
an array of gradient values.
</Function>
### objective
<Function id="qiskit.transpiler.synthesis.aqc.ApproximatingObjective.objective" signature="ApproximatingObjective.objective(param_values)" modifiers="abstract">
Computes a value of the objective function given a vector of parameter values.
**Parameters**
**param\_values** (`ndarray`) a vector of parameter values for the optimization problem.
**Return type**
`float`
**Returns**
a float value of the objective function.
</Function>
## Attributes
### num\_thetas
<Attribute id="qiskit.transpiler.synthesis.aqc.ApproximatingObjective.num_thetas">
Returns: the number of parameters in this optimization problem.
**Return type**
`int`
</Attribute>
### target\_matrix
<Attribute id="qiskit.transpiler.synthesis.aqc.ApproximatingObjective.target_matrix">
Returns: a matrix being approximated
**Return type**
`ndarray`
</Attribute>
</Class>