def still_optimizing(self):
        """True unless converged or maximum iterations/time exceeded."""

        # Check if we need to give up on optimizing.
        if (self.iterations > self.max_iter) or (self.time_elapsed() > self.max_time):
            return False

        # Always optimize for at least 'min_iter' iterations.
        elif not hasattr(self, 'improvement') or (self.iterations < self.min_iter):
            return True

        # Check convergence.
        else:
            self.converged = self.improvement < self.tol
            return False if self.converged else True
def still_optimizing ( self ) : if ( self . iterations > self . max_iter ) or ( self . time_elapsed ( ) > self . max_time ) : return False elif not hasattr ( self , 'improvement' ) or ( self . iterations < self . min_iter ) : return True else : self . converged = self . improvement < self . tol return False if self . converged else True
True unless converged or maximum iterations/time exceeded.