Skip to content

Commit

Permalink
updated if condition for previous_loss in converged
Browse files Browse the repository at this point in the history
this for fixing issue qiskit-community/qiskit-aqua#768 that breaks the while loop because of the if condition of the loss value
  • Loading branch information
kareem1925 authored Jan 12, 2020
1 parent 8e349ed commit 49f7eb2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion qiskit/aqua/components/optimizers/aqgd.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def converged(self, objval, n=2):
Returns:
bool: Whether or not the optimization has converged.
"""
if not hasattr(self, '_previous_loss'):
if self._previous_loss is None:
self._previous_loss = [objval + 2 * self._tol] * n

if all([absolute(objval - prev) < self._tol for prev in self._previous_loss]):
Expand Down

0 comments on commit 49f7eb2

Please sign in to comment.