fides/minimize.py
def check_continue(self) -> bool:
        """
        Checks whether minimization should continue based on convergence,
        iteration count and remaining computational budget

        :return:
            flag indicating whether minimization should continue
        """

        if self.converged:
            return False

        maxiter = self.get_option(Options.MAXITER)
        if self.iteration >= maxiter:
            self.exitflag = ExitFlag.MAXITER
            self.logger.warning(
                f'Stopping as maximum number of iterations {maxiter} was '
                f'exceeded.'
            )
            return False

        time_elapsed = time.time() - self.starttime
        maxtime = self.get_option(Options.MAXTIME)
        time_remaining = maxtime - time_elapsed
        avg_iter_time = time_elapsed/(self.iteration + (self.iteration == 0))
        if time_remaining < avg_iter_time:
            self.exitflag = ExitFlag.MAXTIME
            self.logger.warning(
                f'Stopping as maximum runtime {maxtime} is expected to be '
                f'exceeded in the next iteration.'
            )
            return False

        if self.delta < np.spacing(1):
            self.exitflag = ExitFlag.DELTA_TOO_SMALL
            self.logger.warning(
                f'Stopping as trust region radius {self.delta:.2E} is '
                f'smaller than machine precision.'
            )
            return False

        return True

        Checks whether minimization should continue based on convergence,
        iteration count and remaining computational budget

        :return:
            flag indicating whether minimization should continue
        
Checks whether minimization should continue based on convergence,
iteration count and remaining computational budget
Checks whether minimization should continue based on convergence iteration count and remaining computational budget
def check_continue(self) -> bool:
        if self.converged:
            return False
        maxiter = self.get_option(Options.MAXITER)
        if self.iteration >= maxiter:
            self.exitflag = ExitFlag.MAXITER
            self.logger.warning(
                f'Stopping as maximum number of iterations {maxiter} was '
                f'exceeded.'
            )
            return False
        time_elapsed = time.time() - self.starttime
        maxtime = self.get_option(Options.MAXTIME)
        time_remaining = maxtime - time_elapsed
        avg_iter_time = time_elapsed/(self.iteration + (self.iteration == 0))
        if time_remaining < avg_iter_time:
            self.exitflag = ExitFlag.MAXTIME
            self.logger.warning(
                f'Stopping as maximum runtime {maxtime} is expected to be '
                f'exceeded in the next iteration.'
            )
            return False
        if self.delta < np.spacing(1):
            self.exitflag = ExitFlag.DELTA_TOO_SMALL
            self.logger.warning(
                f'Stopping as trust region radius {self.delta:.2E} is '
                f'smaller than machine precision.'
            )
            return False
        return True
def check_continue ( self ) -> bool : if self . converged : return False maxiter = self . get_option ( Options . MAXITER ) if self . iteration >= maxiter : self . exitflag = ExitFlag . MAXITER self . logger . warning ( f'Stopping as maximum number of iterations {maxiter} was ' f'exceeded.' ) return False time_elapsed = time . time ( ) - self . starttime maxtime = self . get_option ( Options . MAXTIME ) time_remaining = maxtime - time_elapsed avg_iter_time = time_elapsed / ( self . iteration + ( self . iteration == 0 ) ) if time_remaining < avg_iter_time : self . exitflag = ExitFlag . MAXTIME self . logger . warning ( f'Stopping as maximum runtime {maxtime} is expected to be ' f'exceeded in the next iteration.' ) return False if self . delta < np . spacing ( 1 ) : self . exitflag = ExitFlag . DELTA_TOO_SMALL self . logger . warning ( f'Stopping as trust region radius {self.delta:.2E} is ' f'smaller than machine precision.' ) return False return True
Checks whether minimization should continue based on convergence,
iteration count and remaining computational budget
Checks whether minimization should continue based on convergence iteration count and remaining computational budget
"""
        Checks whether minimization should continue based on convergence,
        iteration count and remaining computational budget

        :return:
            flag indicating whether minimization should continue
        """
flag indicating whether minimization should continue
flag indicating whether minimization should continue
self