Confusion about the objective function of VQEs and QAOAs

I am a bit puzzled on how the objective function of the VQEs and QAOAs. Of course, the parametrised state is constructed differently in these two algorithms but they do share a common objective to be minimised, specifically:

$$\mathrm{min}_{\phi} ~ \langle \psi_\phi | H |\psi_\phi\rangle$$ where $$H$$ is the Hamiltonian and $$|\psi_\phi\rangle$$ the state that the quantum circuit prepares. One then, usually makes $$N$$ measurements and obtains a set $$\{ h_1, h_2, \ldots,h_N \}$$ which correspond to the empirical estimates of the expectation value $$\langle \psi_\phi | H |\psi_\phi\rangle$$. I read in the literarue that one can use these to formulate the sample mean $$\frac{1}{N} \sum_{i=1}^N h_i(\phi)$$ and feed this to the classical minimiser.

Confusion: although I do agree that the sample mean above indeed samples the expectation value of the Hamiltonian, I cannot see how one practically implements this into the classical optimiser!

Specifically, the set of measurements $$\{ h_1, h_2, \ldots,h_N \}$$ is the output of some quantum process tomography procedure and they must correspond to real numbers and not functions of the parameters $$\phi$$.

How one can convert the sample mean, which is the average of real numbers $$\{ h_1, h_2, \ldots,h_N \}$$ to a function of the parameters $$\phi$$?

• The cost function is actually a function of $|\psi(\phi)\rangle$, which is generated by some unitary operator $U(\theta)$ (a parametrized quantum circuit). Explicitly,we can write it down as: $C(|\psi(\vec{\phi})\rangle) = \langle \psi(\vec{\phi})|H|\psi(\vec{\phi})\rangle$. It is bounded. So we want to varies $|\psi(\phi)\rangle$ (by changing the parameter $\phi$ in the quantum circuit) such that the value of the cost function tends toward its minimum. Commented Nov 1, 2021 at 0:06
• Given a specific $|\psi(\vec{\phi})\rangle$, you can't calculate $\langle \psi(\vec{\phi})|H|\psi(\vec{\phi})\rangle$ directly on a quantum computer. What we need to do is to decompose $H$ into linear combinations of Pauli strings, $H = \sum \alpha_i P_i$ then calculate $\langle \psi(\vec{\phi})|H|\psi(\vec{\phi})\rangle$ as $\sum \alpha_i \langle \psi(\vec{\phi})|P_i|\psi(\vec{\phi})\rangle$. Note that each $P_i$ is a Hermitian and Unitary operator, hence it has eigenvalue of $\pm 1$. So you can use sample mean to determine its expectation easily. So these $h_i$ are just $\pm 1$. Commented Nov 1, 2021 at 0:10
• The frequency that you observe $+1$ or $-1$ is of course depending on $|\psi(\vec{\phi}) \rangle$, and this frequency is tie back to the expectation $\langle H \rangle$. So yes, the measurements $h_i$ is indeed related directly to the parameter $\vec{\phi}$ since $\vec{\phi}$ determines what the wavefunction $|\psi(\vec{\phi}) \rangle$ is. Commented Nov 1, 2021 at 0:14
• This is clearly written in the preliminary part of the question. I basically ask, given a value for the sample mean, sums of the $h_i$ over $N$, what is the precise classical optimization problem? Commented Nov 1, 2021 at 0:15
• Make that value as low as possible. Commented Nov 1, 2021 at 0:21