This package implemented alternating optimization, which is an iterative procedure for optimizing some function jointly over all parameters by alternating restricted optimization over individual parameter subsets.
See the vignette for more details on the method.
You can install the released version of ao from CRAN with:
And the development version from GitHub with:
This example is explained in detail in the vignette.
library(ao)
#> Thanks for using ao version 0.2.0, happy alternating optimization!
#> See https://loelschlaeger.github.io/ao for help.
#> Type 'citation("ao")' for citing this R package.
himmelblau <- function(x) (x[1]^2+x[2]-11)^2 + (x[1]+x[2]^2-7)^2
f <- set_f(f = himmelblau, npar = 2, lower = -5, upper = 5)
ao(f = f, partition = list(1, 2), progress = FALSE, plot = FALSE)
#> Optimum value: 1.743666
#> Optimum at: 3.395691 -1.803183
#> Optimization time: 0.1 seconds