Closed jiayu-shen closed 1 year ago
This is for the older QuantumInstance based VQE. The new VQE uses the new gradients. The older VQE is now deprecated and soon to be removed. As such I am going to close this as at this stage, even if the problem still exists, its not going to get addressed.
Environment
What is happening?
When gradient is passed into VQE, with some combinations of grad_method and the optimizer, only a single iteration is passed into the callback function of VQE.
How can we reproduce the issue?
The code is modified from https://qiskit.org/documentation/tutorials/algorithms/02_vqe_convergence.html.
The last plot on the original page does not display a point, but if we plot the callback result with the marker set explicitly, the single point shows up.
This plot is supposed to show a history in optimization, but only a single iteration is passed into the callback. This single value is probably the very first iteration. The ipynb file https://github.com/Qiskit/qiskit-tutorials/blob/master/tutorials/algorithms/02_vqe_convergence.ipynb, however, did display a plot of history.
The same issue occurs when only the optimizer is changed to ADAM
optimizer = ADAM(maxiter=60, lr=0.01)
still withgradient=Gradient(grad_method='fin_diff')
, the output is a single point withValue using Gradient: -1.07393
. With ADAMoptimizer = ADAM(maxiter=60, lr=0.01)
andgradient=Gradient(grad_method='param_shift')
in VQE, the code takes longer to run, and produces still a single point but at a lower valueValue using Gradient: -1.81570
.When using
NaturalGradient(grad_method='param_shift', qfi_method='lin_comb_full', regularization='ridge')
as the gradient in VQE andoptimizer = GradientDescent(maxiter=10)
, there is still a single point at -1.181444027905341, as is shown in the plot below Changing fromgrad_method='param_shift'
tograd_method='lin_comb'
has a similar issue.What should happen?
For the cases of the original tutorial page, "ADAM + Gradient(grad_method='param_shift')", and "GradientDescent + NaturalGradient", the callback is expected to store the history of optimization.
Any suggestions?
No response