EstimatorSingleLayer#

class iqm.qaoa.backends.EstimatorSingleLayer[source]#

Bases: EstimatorBackend

The estimator class for calculating the expectation value analytically (for \(p=1\) QAOA).

Methods

estimate(qaoa_object)

Calculates the expectation value of the Hamiltonian for \(p=1\) QAOA.

estimate(qaoa_object)[source]#

Calculates the expectation value of the Hamiltonian for \(p=1\) QAOA.

The function calculates the energy (exp. val. of the Hamiltonian) by adding the expectation values of its individual terms expressed through equation (12) in [2]. The calculation includes a constant term (coming from the translation of a QUBO problem to a Hamiltonian).

Parameters:

qaoa_object (QUBOQAOA) – The instance of QUBOQAOA whose expectation value is to be calculated.

Returns:

The expectation value of the energy of the QAOA state using angles.

Raises:

ValueError – If the provided QUBOQAOA object has more than 1 layer.

Return type:

float