Updates the optimizer with information about convergence or termination, signaling if the optimization process should stop.
Arguments
- mize_step_info
Step info for this iteration, created by
mize_step_summary()
Details
On returning from this function, the updated value of opt will
contain:
A boolean value
is_terminatedwhich isTRUEif termination has been indicated, andFALSEotherwise.A boolean value
convergedwhich isTRUEonly if termination was caused by a convergence tolerance.A string
statusclassifying the termination as"converged","budget_exhausted","failed", or"terminated".A string
messagedescribing the termination.A list
terminateifis_terminatedisTRUE. This contains two items:what, a short string describing what caused the termination, andval, the value of the termination criterion that caused termination. This list will not be present ifis_terminatedisFALSE.
Convergence criteria are only checked here. To set these criteria, use
make_mize() or mize_init().
Examples
rb_fg <- list(
fn = function(x) {
100 * (x[2] - x[1] * x[1])^2 + (1 - x[1])^2
},
gr = function(x) {
c(
-400 * x[1] * (x[2] - x[1] * x[1]) - 2 * (1 - x[1]),
200 * (x[2] - x[1] * x[1])
)
}
)
rb0 <- c(-1.2, 1)
opt <- make_mize(method = "BFGS", par = rb0, fg = rb_fg, max_iter = 30)
mize_res <- mize_step(opt = opt, par = rb0, fg = rb_fg)
step_info <- mize_step_summary(mize_res$opt, mize_res$par, rb_fg, rb0)
# check convergence by looking at opt$is_terminated
opt <- check_mize_convergence(step_info)