Values for the termination_condition option of solve() on nonlinear
problems, as in NonlinearSolve. With f the residual and u the iterate:
AbsTerminationMode() stops when every |f_i| <= abstol;
RelTerminationMode() when every |f_i| <= reltol |u_i + f_i|;
NormTerminationMode(internalnorm) when norm(f) <= abstol or norm(f) <= reltol norm(f + u); AbsNormTerminationMode() and
RelNormTerminationMode() the norm forms of the absolute and relative
tests. The safe variants (AbsNormSafeTerminationMode(),
RelNormSafeTerminationMode()) also stop with "Unstable" when the
objective grows past protective_threshold (NULL, the default, turns
this test off) times its initial value, and
with "Stalled" when it stays within min_max_factor over
patience_steps steps near the tolerance (or the steps stay below the
tolerance for max_stalled_steps steps); the safe best variants
(AbsNormSafeBestTerminationMode(), RelNormSafeBestTerminationMode())
return the best iterate seen. The default of the solvers is
AbsNormSafeBestTerminationMode(max_stalled_steps = 32) with the maximum
norm (the 2-norm for least squares problems).
Usage
AbsTerminationMode()
RelTerminationMode()
NormTerminationMode(internalnorm = NULL)
AbsNormTerminationMode(internalnorm = NULL)
RelNormTerminationMode(internalnorm = NULL)
AbsNormSafeTerminationMode(
internalnorm = NULL,
protective_threshold = NULL,
patience_steps = 100,
patience_objective_multiplier = 3,
min_max_factor = 1.3,
max_stalled_steps = NULL
)
RelNormSafeTerminationMode(
internalnorm = NULL,
protective_threshold = NULL,
patience_steps = 100,
patience_objective_multiplier = 3,
min_max_factor = 1.3,
max_stalled_steps = NULL
)
AbsNormSafeBestTerminationMode(
internalnorm = NULL,
protective_threshold = NULL,
patience_steps = 100,
patience_objective_multiplier = 3,
min_max_factor = 1.3,
max_stalled_steps = NULL
)
RelNormSafeBestTerminationMode(
internalnorm = NULL,
protective_threshold = NULL,
patience_steps = 100,
patience_objective_multiplier = 3,
min_max_factor = 1.3,
max_stalled_steps = NULL
)Examples
prob <- NonlinearProblem(function(u, p) u^2 - 2, 1)
solve(prob, NewtonRaphson(), termination_condition = AbsTerminationMode())$u
#> [1] 1.414214