@yuichirominato 2019.02.21更新 156views

[optimization]optimization problem coding in a few lines.


Introduction

Blueqat is a Quantum Computing SDK for both annealing and gate model.

This time we introduce the way to programming both optimization problem on annealer and gate model QAOA.

Just one line, Opt().add([[1,0],[0,-1]]) this is the implementation of the ising QUBO equation.

and just .run() or .dw() or .qaoa()

from blueqat.opt import Opt
Opt().add([[1,0],[0,-1]]).dw()
from blueqat.opt import Opt

#QUBO
c = Opt().add([[1,0],[0,-1]])

#dwave
c.dw()

#=>
[0, 1]

#annealing
c.run()

#=>
[0, 1]

#qaoa
c.qaoa().most_common(5)

#=>
(((0, 1), 0.999991900412168),
 ((0, 0), 4.049785715177e-06),
 ((1, 1), 4.049785715176516e-06),
 ((1, 0), 1.640089717933019e-11))

Back To Top