qrisp.qaoa.QAOAProblem.run#
- QAOAProblem.run(qarg, depth, mes_kwargs={}, max_iter=50, init_type='random', init_point=None, optimizer='COBYLA', options={})[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 or callable
The argument to which the QAOA circuit is applied, or a function returning a QuantumVariable or QuantumArray 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).- init_pointndarray, shape (n,), optional
Specifies the initial optimization parameters.
- optimizerstr, optional
Specifies the SciPy optimization routine. Available are, e.g.,
COBYLA
,COBYQA
,Nelder-Mead
. The Default isCOBYLA
. In tracing mode (i.e. Jasp) Jax-traceable optimization routines must be utilized. Available areCOBYLA
,SPSA
.- optionsdict
A dictionary of solver options.
- Returns:
- dict or jax.Array
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.