4

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$?

Martin Vesely
  • 13,891
  • 4
  • 28
  • 65

1 Answers1

3

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.

Martin Vesely
  • 13,891
  • 4
  • 28
  • 65
  • 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? – Himera Ephemera Jun 07 '21 at 12:56
  • @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. – Martin Vesely Jun 07 '21 at 14:22
  • @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). – Martin Vesely Jun 07 '21 at 14:24