gemseo / algos

# stop_criteria module¶

## Various termination criteria for drivers¶

Exceptions:

 DesvarIsNan Stops driver when the design variables are nan. FtolReached Exception raised when the f_tol_rel or f_tol_abs criteria is reached by the driver. FunctionIsNan Stops driver when a function has NaN value or NaN Jacobian. MaxIterReachedException Exception raised when the maximum number of iterations is reached by the driver. MaxTimeReached Exception raised when the maximum execution time is reached by the driver. TerminationCriterion Stop driver for some reason. XtolReached Exception raised when the x_tol_rel or x_tol_abs criteria is reached by the driver.

Functions:

 is_f_tol_reached(opt_problem[, f_tol_rel, …]) Tests if the tolerance on the objective function are reached The average function value of the last n_x points are taken Then it is checked that all points are within the distance of the center with relative and absolute tolerances specified by the user. is_x_tol_reached(opt_problem[, x_tol_rel, …]) Tests if the tolerance on the design variables are reached The coordinate wise average of the last n_x points are taken Then it is checked that all points are within the distance of the center with relative and absolute tolerances specified by the user.
exception gemseo.algos.stop_criteria.DesvarIsNan[source]

Stops driver when the design variables are nan.

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception gemseo.algos.stop_criteria.FtolReached[source]

Exception raised when the f_tol_rel or f_tol_abs criteria is reached by the driver.

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception gemseo.algos.stop_criteria.FunctionIsNan[source]

Stops driver when a function has NaN value or NaN Jacobian.

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception gemseo.algos.stop_criteria.MaxIterReachedException[source]

Exception raised when the maximum number of iterations is reached by the driver.

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception gemseo.algos.stop_criteria.MaxTimeReached[source]

Exception raised when the maximum execution time is reached by the driver.

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception gemseo.algos.stop_criteria.TerminationCriterion[source]

Bases: Exception

Stop driver for some reason.

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception gemseo.algos.stop_criteria.XtolReached[source]

Exception raised when the x_tol_rel or x_tol_abs criteria is reached by the driver.

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

gemseo.algos.stop_criteria.is_f_tol_reached(opt_problem, f_tol_rel=1e-06, f_tol_abs=1e-06, n_x=2)[source]

Tests if the tolerance on the objective function are reached The average function value of the last n_x points are taken Then it is checked that all points are within the distance of the center with relative and absolute tolerances specified by the user.

Parameters
• opt_problem (OptimizationProblem) – the optimization problem containing the iterations

• x_tol_rel (float) – relative tolerance

• x_tol_abs (float) – absolute tolerance

• n_x (int) – number of design vectors to account for

gemseo.algos.stop_criteria.is_x_tol_reached(opt_problem, x_tol_rel=1e-06, x_tol_abs=1e-06, n_x=2)[source]

Tests if the tolerance on the design variables are reached The coordinate wise average of the last n_x points are taken Then it is checked that all points are within the distance of the center with relative and absolute tolerances specified by the user.

Parameters
• opt_problem (OptimizationProblem) – the optimization problem containing the iterations

• x_tol_rel (float) – relative tolerance

• x_tol_abs (float) – absolute tolerance

• n_x (int) – number of design vectors to account for