@yuichirominato 2019.02.18更新 86views

[Factoring] Factoring on QAOA with blueqat


Introduction

By using QAOA we can easily solve factoring with optimization problem directly solve many-body interaction on ising model.

Reference

On D-Wave machine we need boolean reduction.

Let’s solve

QAOA is a universal gate model algorithm inspired by adiabatic quantum computation. Now we can solve the equation with 3-body interaction directly.

$$H = 128q_0q_1q_2 + 16q_0q_1 – 56q_0q_2 – 52q_0 – 48q_1q_2 – 96q_1 – 52q_2 + 196$$

Using specific library to convert QUBO to pauli operator.

Usually Ising model on gate model implemented as Z gate on time evolution. Now we have library to convert directly qubo to ising model and Z operator.

from blueqat.pauli import qubo_bit as q
hamiltonian = 128*q(0)*q(1)*q(2)+16*q(0)*q(1)-56*q(0)*q(2)-52*q(0)+48*q(1)*Z(2)-96*q(1)-52*q(2)

QAOA+VQE

VQE is an algorithm to find out eigenvalue of unitary operator. Blueqat has function to solve this.

from blueqat import vqe

step = 2
result = vqe.Vqe(vqe.QaoaAnsatz(hamiltonian, step)).run()
print(result.most_common(5))

(((0, 1, 1), 0.41587841359182315), ((1, 1, 1), 0.22999518869583413), ((1, 1, 0), 0.09621729455616015), ((0, 0, 1), 0.09274077321094935), ((1, 0, 1), 0.08165837751142796))

Now we have 011 and this is 5*3.

Recommend


Back To Top