qrisp.vqe.VQEProblem.run#
- VQEProblem.run(qarg, depth, mes_kwargs={}, max_iter=50, init_type='random', init_point=None, optimizer='COBYLA')[source]#
Run the specific VQE problem instance with given quantum arguments, depth of VQE circuit, measurement keyword arguments (mes_kwargs) and maximum iterations for optimization (max_iter).
- Parameters:
- qargQuantumVariable or QuantumArray
The argument to which the VQE circuit is applied.
- depthint
The amount of VQE layers.
- mes_kwargsdict, optional
The keyword arguments for the
get_measurement
function. Default is an empty dictionary. By default, the targetprecision
is set to 0.01. Precision refers to how accurately the Hamiltonian is evaluated. The number of shots the backend performs per iteration scales quadratically with the inverse precision.- 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 is
random
. The default israndom
: Parameters are initialized uniformly at random in the interval \([0,\pi/2)]\).- init_pointlist[float], optional
Specifies the initial optimization parameters.
- optimizerstr, optional
Specifies the optimization routine. Available are, e.g.,
COBYLA
,COBYQA
,Nelder-Mead
. The Default isCOBYLA
.
- Returns:
- energyfloat
The expected value of the Hamiltonian after applying the optimal VQE circuit to the quantum argument.