Optimizer¶
This section is about setting up an optimization method for the variational algorithm.
Type¶
optimizer has the following options
BFGS [Details]: Supports
gtol,max_iteroptionsBFGS_FTOL: Supports
ftol,max_iteroptionsL_BFGS_B: Supports
ftol,gtol,max_iter,max_fevoptionsNFT [Nak20][Details]: Supports
ftol,max_iter,max_fevoptionsNELDER_MEAD:Supports
max_iter,max_fevoptionsPOWELL [Details]: Supports
ftol,max_iter,max_fevoptionsCG: Supports
gtol,max_iteroptionsTNC: Supports
ftol,gtol,max_iteroptionsSLSQP: Supports
ftol,max_iteroptions
Each optimizer other than BFGS_FTOL and NFT is the same as
one in scipy.optimize.minimize.
For BFGS the cost function gradient difference gtol is used for
convergence condition. For BFGS_FTOL the cost function difference
ftol is used for convergence condition.
References:¶
[Nak20] “Sequential minimal optimization for quantum-classical hybrid algorithms.”, K. M. Nakanishi, K. Fujii, and S. Todo, Phys. Rev. Research 2, 043158 (2020).
Options¶
The following options allow you to specify the condition to stop the optimization.
ftol: stop the optimization when the increase or decrease from the previous iteration of the cost function is less than or equal to this value. (default: \(10^{-6}\))gtol: Stops optimization when the slope of the cost function becomes less than or equal to this value. (default: \(10^{-6}\))max_iter: Maximum number of iterations. (default: \(10^3\))max_fev: Maximum number of times the cost function is evaluated. (default: \(10^4\))max_run: maximum number of times to run the quantum circuit (default: \(10^4\))
Input example¶
"optimizer": {
"type": "BFGS",
"ftol": 1e-06,
"gtol": 1e-06,
"max_iter": 100000,
"max_fev": 100000,
"max_run": 100000
}
Differential type¶
The following options allow you to specify the differential type of gradient in optimization calculation. Note there are some optimizers that do not require gradients.
differential_type: Choice of the numerical derivative NUMERICAL or the analytical derivative ANALYTICAL [Mit18]. By default, NUMERICAL or ANALYTICAL is chosen automatically whenQuantumDeviceis set to EXACT_SIMULATOR or SAMPLING_SIMULATOR, respectively.
References:¶
[Mit18] “Quantum circuit learning”, K. Mitarai, M. Negoro, M. Kitagawa, and K. Fujii, Phys. Rev. A 98, 032309.