Skip to content
This repository has been archived by the owner on Dec 7, 2021. It is now read-only.

Fix NLOpt optimizers trying to iterate NoneType #1414

Merged
merged 1 commit into from
Nov 6, 2020

Conversation

woodsp-ibm
Copy link
Member

Bounds were assumed to be a an array of tuples. No bound being (None, None) tuple for each param. Passing None as the bounds array (default when not explicitly set) always iterated through bounds to set thing up and failed trying to iterate NoneType. This was reported in external Slack workspace https://qiskit.slack.com/archives/C7SJ0PJ5A/p1602918563027800 (if you cannot access the link and want to there is a link here to join the community https://github.com/Qiskit/qiskit-aqua#contribution-guidelines ). Here is a summary though

Hi: Has someone tried global optimizers from Aqua? I followed the instruction from https://qiskit.org/documentation/apidoc/qiskit.aqua.components.optimizers.html#global-optimizers and installed NLopt but got this error during running: op = optimizer.optimize(num_vars=num_params, objective_function=init_cost0, initial_point=params)
File "/p/home/liux3790/anaconda3/envs/name_of_my_env/lib/python3.8/site-packages/qiskit/aqua/components/optimizers/nlopts/nloptimizer.py", line 96, in optimize
return self._minimize(self._optimizer_names[self.get_nlopt_optimizer()],
File "/p/home/liux3790/anaconda3/envs/name_of_my_env/lib/python3.8/site-packages/qiskit/aqua/components/optimizers/nlopts/nloptimizer.py", line 124, in _minimize
low = [(l if l is not None else -threshold) for (l, u) in variable_bounds]
TypeError: 'NoneType' object is not iterable.

@woodsp-ibm woodsp-ibm added the Changelog: Bugfix Include in the Fixed section of the changelog label Nov 5, 2020
@woodsp-ibm woodsp-ibm added this to the 0.9 milestone Nov 5, 2020
@woodsp-ibm woodsp-ibm merged commit 2121df4 into qiskit-community:master Nov 6, 2020
@woodsp-ibm woodsp-ibm deleted the nlopt_fix branch November 6, 2020 13:53
@manoelmarques manoelmarques added the stable backport potential The bug might be minimal and/or import enough to be port to stable label Nov 9, 2020
manoelmarques pushed a commit to manoelmarques/qiskit-aqua that referenced this pull request Nov 9, 2020
mtreinish pushed a commit to mtreinish/qiskit-core that referenced this pull request Nov 20, 2020
manoelmarques pushed a commit to manoelmarques/qiskit-terra that referenced this pull request Dec 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Changelog: Bugfix Include in the Fixed section of the changelog stable backport potential The bug might be minimal and/or import enough to be port to stable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants