Skip to content

Commit

Permalink
update qaoa
Browse files Browse the repository at this point in the history
  • Loading branch information
minatoyuichiro committed May 14, 2022
1 parent 8269c83 commit 5bb36c5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion blueqat/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@

"""The version of blueqat."""

__version__ = "1.0.3"
__version__ = "1.0.4"
#__version__ = "0.5.0-dev"
8 changes: 4 additions & 4 deletions blueqat/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def qaoa(hamiltonian, step, init = None, mixer = None):
from .pauli import qubo_bit as q

hamiltonian = hamiltonian.to_expr().simplify()

N = hamiltonian.max_n()

time_evolutions_cost = [
Expand All @@ -39,16 +40,15 @@ def qaoa(hamiltonian, step, init = None, mixer = None):
time_evolutions_mixer = [
term.get_time_evolution() for term in mixer
] if mixer else []

def f(params):
params = params%(np.pi*2)
params = params
betas = params[:step]
gammas = params[step:]

if init is None:
c = Circuit(N).h[:]
else:
c = init
c = init.copy()

for beta, gamma in zip(betas, gammas):
for evo in time_evolutions_cost:
Expand Down

0 comments on commit 5bb36c5

Please sign in to comment.