I'm using SPSA as an optimizer in VQE algorithm.
The code runs on ibmq-qasm-simulator.
I've set SPSA max_trials parameter to 500, but, when I run the code, it makes 1000 iterations.
I've tried with COBYLA optimizer too, and it makes correctly 500 iterations.
Does someone know why?


1 Answer 1


For each trial SPSA evaluations the objective function twice for + and - some small delta. Hence its total calls to the objective function are twice the max trials number. COBYA makes one evaluation for each iteration, that is what it's behavior is. Other optimizers, that are gradient based, where it's using finite difference method, will make many calls, depending on the number of params, to compute the gradient at each iteration. Oh, and SPSA, when it does calibration up front, will do a few more calls for this purpose.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.