Skip to content

Commit

Permalink
allow new qvm connections to be passed into max_cut
Browse files Browse the repository at this point in the history
  • Loading branch information
Will Zeng authored and stylewarning committed Mar 22, 2017
1 parent 5b49942 commit eed6cc0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions grove/pyqaoa/maxcut_qaoa.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def print_fun(x):
print x


def maxcut_qaoa(graph, steps=1, rand_seed=None):
def maxcut_qaoa(graph, steps=1, rand_seed=None, connection=None):
"""
Max cut set up method
"""
Expand All @@ -47,7 +47,9 @@ def maxcut_qaoa(graph, steps=1, rand_seed=None):
for i in graph.nodes():
driver_operators.append(PauliSum([PauliTerm("X", i, -1.0)]))

qaoa_inst = QAOA(CXN, len(graph.nodes()), steps=steps, cost_ham=cost_operators,
if connection is None:
connection = CXN
qaoa_inst = QAOA(connection, len(graph.nodes()), steps=steps, cost_ham=cost_operators,
ref_hamiltonian=driver_operators, store_basis=True,
rand_seed=rand_seed,
minimizer=minimize,
Expand Down

0 comments on commit eed6cc0

Please sign in to comment.