Skip to contents

SpeedMappingOpt() minimizes with the alternating cyclic extrapolation (ACX) method of SpeedMapping.jl: cycles of two or three gradient descent steps followed by a squared or cubic extrapolation, with an adaptive learning rate and box constraints (lb, ub). It stops when the norm of the gradient (of its components that do not push against a bound) is below 1e-8. maxiters limits the number of gradient evaluations and maxtime the time in seconds; abstol and reltol are not used.

Usage

SpeedMappingOpt()

Value

An optimization algorithm.

Details

The return code is "Success" when the gradient is small, "MaxIters" when a limit was reached, "MaxTime" and otherwise "Failure". As in Julia the statistics only carry the time; sol$original has the counts (maps, the gradient evaluations, f_calls, iterations), status, residual_norm and last_learning_rate. The gradient of the problem is used, finite differences when it has none.

Examples

f <- function(u, p) (1 - u[1])^2 + 100 * (u[2] - u[1]^2)^2
g <- function(u, p) c(-2 * (1 - u[1]) - 400 * u[1] * (u[2] - u[1]^2), 200 * (u[2] - u[1]^2))
sol <- solve(OptimizationProblem(f, c(-1.2, 1), grad = g), SpeedMappingOpt())
sol$u
#> [1] 1 1
sol$original$maps
#> [1] 88