qrisp.qaoa.QAOAProblem.run#
- QAOAProblem.run(qarg, depth, mes_kwargs={}, max_iter=50, init_type='random', optimizer='COBYLA')[source]#
Run the specific QAOA problem instance with given quantum arguments, depth of QAOA circuit, measurement keyword arguments (mes_kwargs) and maximum iterations for optimization (max_iter).
- Parameters:
- qargQuantumVariable or QuantumArray
The quantum argument to which the QAOA circuit is applied.
- depthint
The amount of QAOA layers.
- mes_kwargsdict, optional
The keyword arguments for the measurement function. Default is an empty dictionary.
- max_iterint, optional
The maximum number of iterations for the optimization method. Default is 50.
- init_typestring, optional
Specifies the way the initial optimization parameters are chosen. Available are
random
andtqa
. The default israndom
: The parameters are initialized uniformly at random in the interval \([0,\pi/2]\). Fortqa
, the parameters are chosen based on the Trotterized Quantum Annealing protocol. Iftqa
is chosen, and noinit_function
for the QAOAProblem is specified, the \(\ket{-}^n\) state is prepared (the ground state for the X mixer).- optimizerstr, optional
Specifies the optimization routine. Available are, e.g.,
COBYLA
,COBYQA
,Nelder-Mead
. The Default isCOBYLA
.
- Returns:
- opt_resdict
The optimal result after running QAOA problem for a specific problem instance. It contains the measurement results after applying the optimal QAOA circuit to the quantum argument.