I am trying to implement QAOA and there are things I don't understand at all.

The expansion of $H$ into Pauli $Z$ operators can be obtained from the canonical expansion of the cost-function $C$ by substituting for every binary variable $x_i ∈ {0,1}$ the operator $x_i \rightarrow (1−Z_i)/2$. (according to Qiskit tutorial).

But this operator looks like $[[1, 0], [0, 0]]$ which is not unitary.

I am optimizing a complicated QUBO function and the mapped Hamiltonian does not to seem unitary either.

How do I apply $H$ to $|\beta, \gamma\rangle$ to get $\langle\beta, \gamma| H |\beta, \gamma\rangle$?

  • 2
    $\begingroup$ Hamiltonian should be Hermitian operator. The time evolution operator, that is $e^{-iHt/\hbar }$, is the unitary. $\endgroup$ – Egretta.Thula Jun 5 at 19:44

In QAOA you do not implement Hamiltonian $H$ itself but gate defined as $U = \mathrm{e}^{iHt}$. Since Hamiltonian $H$ is always Hermitian, operator $U$ is always unitary. You can see proof of this here. Concerning implementation of QAOA circuits, I would recommed this article. It contains discussion how to convert QUBO to Hamiltonian and in the appendix, there is a implementation of a circuit for the Hamiltonian simulation.

You can also find many useful advise for Hamiltonian simulation in this thread.

  • $\begingroup$ Thank you. Year, the U is unitary, I see. But how then we evaluate ⟨β,γ|H|β,γ⟩ without implementing hamiltonian and without computing cost function for all possible binary strings? $\endgroup$ – Himera Ephemera Jun 7 at 12:56
  • $\begingroup$ @HimeraEphemera: Actually, we implement the Hamiltonian, it is hidden in matrix $U$. The resulting binary string should be the ground state of the Hamiltonian for given $\beta$ and $\gamma$. Once you have the string (or rather the ground state), you put it into $\langle x|H|x\rangle$. Then you change parameters $\beta$ and $\gamma$ and run the simulation again and again until you find actual ground state of the Hamiltonian. Note that finding new values of $\beta$ and $\gamma$ is done classically. $\endgroup$ – Martin Vesely Jun 7 at 14:22
  • $\begingroup$ @HimeraEphemera: Also note that calculation of $\langle x|H|x\rangle$ is rather complex but in case of Ising Hamiltonians you can exploit its special structure (only two-body interactions) and use a sampling advised in the paper (I did not dive into details of the sampling, so I cannot provide more in this regard). $\endgroup$ – Martin Vesely Jun 7 at 14:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.