---
title: ApproximatingObjective (v1.2)
description: API reference for qiskit.synthesis.unitary.aqc.ApproximatingObjective in qiskit v1.2
source: https://quantum.cloud.ibm.com/docs/en/api/qiskit/1.2/qiskit.synthesis.unitary.aqc.ApproximatingObjective
---

# ApproximatingObjective

*class* `qiskit.synthesis.unitary.aqc.ApproximatingObjective`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/1.2/qiskit/synthesis/unitary/aqc/approximate.py#L55-L116)

Bases: [`ABC`](https://docs.python.org/3/library/abc.html#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.

## Attributes

### num\_thetas

Returns: the number of parameters in this optimization problem.

### target\_matrix

Returns: a matrix being approximated

## Methods

### gradient

*abstract* `gradient(param_values)`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/1.2/qiskit/synthesis/unitary/aqc/approximate.py#L79-L90)

Computes a gradient with respect to parameters given a vector of parameter values.

**Parameters**

**param\_values** ([*ndarray*](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray)) – a vector of parameter values for the optimization problem.

**Returns**

an array of gradient values.

**Return type**

[*ndarray*](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray)

### objective

*abstract* `objective(param_values)`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/1.2/qiskit/synthesis/unitary/aqc/approximate.py#L66-L77)

Computes a value of the objective function given a vector of parameter values.

**Parameters**

**param\_values** ([*ndarray*](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray)) – a vector of parameter values for the optimization problem.

**Returns**

a float value of the objective function.

**Return type**

[*SupportsFloat*](https://docs.python.org/3/library/typing.html#typing.SupportsFloat)
