Reverse playback of QAOA using blueqat quantum computing SDK 0.3.14

The new release of blueqat now support QAOA mixer, RXX,RYY,RZZ ising coupling gate and the reverse playback of quantum circuit. Now I do some trial on Quantum Adiabatic process with variational QAOA algorithm on gate model quantum computing.

Install Blueqat

Install blueqat from pip,

!pip install -U blueqat

The hamiltonian is like below and the initial state is |+> corresponding to the initial mixer X.

from blueqat import Circuit
from blueqat import vqe
from blueqat.pauli import X,Y,Z
h = 5*Z[0]-2*Z[0]*Z[1]
step = 2
result = vqe.Vqe(vqe.QaoaAnsatz(h,step)).run()
print(result.most_common())
print(result.circuit)

The result is,

(((1, 1), 0.8144445064787001),)Circuit(2).h[:].cx[0, 1].rz(49.460289478707516)[1].cx[0, 1].rz(-123.6507236967688)[0].rx(4.758485377427176)[:].cx[0, 1].rz(64.56773083408335)[1].cx[0, 1].rz(-161.41932708520838)[0].rx(0.7862442700373741)[:]

This circuit include CX-RZ-CX which is the time evolution of ZZ hamiltonian.

As CX-RZ-CX = RZZ, the quantum circuit is,

Circuit(2).h[:].rzz(49.460289478707516)[0,1].rz(-123.6507236967688)[0].rx(4.758485377427176)[:].rzz(64.56773083408335)[0,1].rz(-161.41932708520838)[0].rx(0.7862442700373741)[:].m[:].run(shots=1000)

And we get the similar result.

Counter({'11': 829, '00': 56, '10': 115})

The relation between the hamiltonian and time evolution operator is clear using RZZ.

Reverse Playback of the circuit

QAOA is using quantum adiabatic process to exchange two hamiltonian. The initial hamiltonian is usually chosen by the constraint of the problem. Here XYmixer of (XX+YY)/2 is chosen.

Usually the process is from easy problem to difficult problem.

Here we try the reversed process from difficult problem to easy problem.

Problem

The hamiltonian is the simple shape with Z and ZZ operator.

from blueqat import Circuit
from blueqat import vqe
from blueqat.pauli import X,Y,Z
h = 5*Z[0]-2*Z[0]*Z[1]
step = 2
init = Circuit().h[0].cx[0,1].x[0]
mixer = 0.5*X[0]*X[1] + 0.5*Y[0]*Y[1]
result = vqe.Vqe(vqe.QaoaAnsatz(h,step,init,mixer)).run()
print(result.most_common())
print(result.circuit)

The result and the circuit is,

(((1, 0), 0.9970150121543512),)Circuit(2).h[0].cx[0, 1].x[0].cx[0, 1].rz(39.00633185153547)[1].cx[0, 1].rz(-97.51582962883867)[0].h[0].h[1].cx[0, 1].rz(-8.988636280080764)[1].cx[0, 1].h[0].h[1].rx(-1.5707963267948966)[0].rx(-1.5707963267948966)[1].cx[0, 1].rz(-8.988636280080764)[1].cx[0, 1].rx(1.5707963267948966)[0].rx(1.5707963267948966)[1].cx[0, 1].rz(34.522866650015565)[1].cx[0, 1].rz(-86.30716662503892)[0].h[0].h[1].cx[0, 1].rz(-8.64561683891384)[1].cx[0, 1].h[0].h[1].rx(-1.5707963267948966)[0].rx(-1.5707963267948966)[1].cx[0, 1].rz(-8.64561683891384)[1].cx[0, 1].rx(1.5707963267948966)[0].rx(1.5707963267948966)[1]

Playback

The adiabatic process should be reversible. Now prepare the |10> state first and apply the reverse circuit of QAOA, the result would be |00> which is the initial state of the qubit.

#prepare the |10> state and apply dagger() to get the reversed circuitresult2 = (Circuit().x[0] + result.circuit.dagger()).m[:].run(shots=100)
print(result2)
Counter({'00': 100})

The result successfully playback to |00> !

--

--