@@ -111,7 +111,7 @@ def QUBO_problem(Q):
111
111
return QAOAProblem (create_QUBO_cost_operator (Q ), RX_mixer , create_QUBO_cl_cost_function (Q ))
112
112
113
113
114
- def solve_QUBO (Q , depth , backend = None , n_solutions = 1 , print_res = True ):
114
+ def solve_QUBO (Q , depth , max_iter = 50 , backend = None , n_solutions = 1 , print_res = False ):
115
115
"""
116
116
Solves a Quadratic Unconstrained Binary Optimization (QUBO) problem using the Quantum Approximate Optimization Algorithm (QAOA).
117
117
The function imports the default backend from the 'qrisp.default_backend' module.
@@ -126,6 +126,8 @@ def solve_QUBO(Q, depth, backend = None, n_solutions = 1, print_res = True):
126
126
QUBO matrix to solve.
127
127
depth : int
128
128
The depth (amount of layers) of the QAOA circuit.
129
+ max_iter : int
130
+ The maximal amount of iterations of the COBYLA optimizer in the QAOA algorithm.
129
131
backend : str
130
132
The backend to be used for the quantum/annealing simulation.
131
133
n_solutions : int
@@ -151,7 +153,7 @@ def solve_QUBO(Q, depth, backend = None, n_solutions = 1, print_res = True):
151
153
backend = backend
152
154
153
155
# Run QAOA with given quantum arguments, depth, measurement keyword arguments and maximum iterations for optimization
154
- res = QUBO_instance .run (qarg , depth , mes_kwargs = {"backend" : backend }, max_iter = 50 ) # runs the simulation
156
+ res = QUBO_instance .run (qarg , depth , mes_kwargs = {"backend" : backend }, max_iter = max_iter ) # runs the simulation
155
157
res = dict (list (res .items ())[:n_solutions ])
156
158
157
159
# Calculate the cost for each solution
0 commit comments