Further Numerical Optimization Algorithms.
optimizr
The optimizr R package currently contains two numerical optimization algorithms. One is a simple implementation of the primitive grid search algorithm, the other is an extension of the simulated annealing algorithm that can take custom boundaries into account. The methodology for this bounded simulated annealing algorithm is due to Haario and Saksman 1991.
Installation
You can install the development version of optimizr from GitHub with:
# install.packages("pak")
pak::pak("LukasDSauer/optimizr")
Example
In the following basic example, we optimize the “wild function” from the stats::optim() examples, global minimum at about -15.81515.
library(optimizr)
# "wild" function from the
fw <- function (x)
(10*sin(0.3*x)*sin(1.3*x^2) + 0.00001*x^4 + 0.2*x+80)
simann(par = 50,
fn = fw,
control = list(maxit = 20000,
temp = 10,
parscale = 20,
REPORT = NA_real_))
#> $par
#> [1] -15.8151
#>
#> $value
#> [1] 67.46775
Reference
Haario H, Saksman E. Simulated Annealing Process in General State Space. Advances in Applied Probability, Vol. 23, No. 4 (Dec., 1991), pp. 866-893, doi:10.2307/1427681.