-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* fix settings in optimizers * add reno * don't duplicate args Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> (cherry picked from commit d9af1d1) Co-authored-by: Julien Gacon <[email protected]>
- Loading branch information
1 parent
b5aa322
commit d54380f
Showing
3 changed files
with
57 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
releasenotes/notes/fix-optimizer-settings-881585bfa8130cb7.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
fixes: | ||
- | | ||
Fix a bug in the :class:`~.Optimizer` classes where re-constructing a new optimizer instance | ||
from a previously exisiting :attr:`~.Optimizer.settings` reset both the new and previous | ||
optimizer settings to the defaults. This notably led to a bug if :class:`~.Optimizer` objects | ||
were send as input to Qiskit Runtime programs. | ||
Now optimizer objects are correctly reconstructed:: | ||
>>> from qiskit.algorithms.optimizers import COBYLA | ||
>>> original = COBYLA(maxiter=1) | ||
>>> reconstructed = COBYLA(**original.settings) | ||
>>> reconstructed._options["maxiter"] | ||
1 # used to be 1000! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters