You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running a VQE algorithm with ansatz UCCSD the following error message shows up:
[...]
File "C:\Users\poc\Anaconda3\envs\qiskit\lib\site-packages\qiskit_nature\algorithms\pes_samplers\bopes_sampler.py", line 175, in sample
self._raw_results = self._run_points(points)
File "C:\Users\poc\Anaconda3\envs\qiskit\lib\site-packages\qiskit_nature\algorithms\pes_samplers\bopes_sampler.py", line 201, in _run_points
raw_result = self._run_single_point(point) # dict of results
File "C:\Users\poc\Anaconda3\envs\qiskit\lib\site-packages\qiskit_nature\algorithms\pes_samplers\bopes_sampler.py", line 259, in _run_single_point
result = self._state_solver.solve(self._problem, aux_ops_current_step)
File "C:\Users\poc\Anaconda3\envs\qiskit\lib\site-packages\qiskit_nature\algorithms\ground_state_solvers\ground_state_eigensolver.py", line 91, in solve
raw_mes_result = self._solver.compute_minimum_eigenvalue(main_operator, aux_ops) # type: ignore
File "C:\Users\poc\Anaconda3\envs\qiskit\lib\site-packages\qiskit\algorithms\minimum_eigen_solvers\vqe.py", line 530, in compute_minimum_eigenvalue
opt_result = self.optimizer.minimize(
File "C:\Users\poc\Anaconda3\envs\qiskit\lib\site-packages\qiskit\algorithms\optimizers\snobfit.py", line 96, in minimize
if abs(theta) > bounds[idx][0]:
TypeError: '>' not supported between instances of 'float' and 'NoneType'
In case of ansatz EfficientSU2 the code runs fine, only with UCCSD I get the error.
I tracked down the error to be caused by missing parameter bounds. The function signature of the optimizer's minimize function (``) suggests that None is a valid value. But the code never handles None-type input (neither `None` nor the nested list/tuple with `None` values).
So, I propose one of the following changes:
Change the signature of the minimize method (still not easy to read for a user)
Catch the Nones in the input bounds and add a more verbose error message that optimizer SNOBFIT requires parameter bounds
Artificially add bounds for the optimizer. Basically the parameter can only be varied from 0 to 2pi so one could catch the None input and change it to these bounds. Though I'm not aware of the side effects this approach might have... Here it might be useful to ask also someone from qiskit nature whether it could be resolved within the UCCSD ansatz (though it would not solve the initial problem with the misleading signature/missing error message).
Any fixes (or suggestions therefore) are highly appreciated.
The text was updated successfully, but these errors were encountered:
If SNOBFIT requires bounds then I think the optimizer should raise an error if they are not passed. The interface is dictated by the Optimizer class so we can't really change that, and adding default bounds is very restrictive (e.g. [0,2pi] is not valid as soon as the circuit contains e.g. a gate like Ry(0.0001 * theta)).
@Cryoris Based on your comment I added a more concise error message in #8638
This resolves the problem at hand in the SNOBFIT code but actually there is still an open question: When I use ansatz EfficientSU2, all parameter bounds are set to (-pi, pi) allowing proper usage of optimizer SNOBFIT. On the other hand with ansatz UCCSD all parameter bounds are set to (None, None).
So, maybe someone with more insight into the ansatzes might have a look at it and can tell why those two ansatzes treat SNOBFIT so differently.
When running a VQE algorithm with ansatz UCCSD the following error message shows up:
In case of ansatz
EfficientSU2
the code runs fine, only withUCCSD
I get the error.I tracked down the error to be caused by missing parameter bounds. The function signature of the optimizer's
minimize
function (``) suggests thatNone
is a valid value. But the code never handles None-type input (neither `None` nor the nested list/tuple with `None` values).So, I propose one of the following changes:
minimize
method (still not easy to read for a user)None
s in the input bounds and add a more verbose error message that optimizer SNOBFIT requires parameter boundsNone
input and change it to these bounds. Though I'm not aware of the side effects this approach might have... Here it might be useful to ask also someone from qiskit nature whether it could be resolved within the UCCSD ansatz (though it would not solve the initial problem with the misleading signature/missing error message).Any fixes (or suggestions therefore) are highly appreciated.
The text was updated successfully, but these errors were encountered: