knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

Initialization of numerical optimization

CRAN status CRAN downloads R-CMD-check Codecov test coverage

The {ino} package provides tools for the analysis of the initialization for numerical optimization in R. For detailed examples and usage instructions, please refer to the vignettes accompanying the package.

Installation

You can install the released version from CRAN with:

install.packages("ino")

And the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("loelschlaeger/ino")

Example

The Ackley function has multiple local minima and one global minimum in the origin.

f_ackley <- function(x) {
  stopifnot(is.numeric(x), length(x) == 2)
  -20 * exp(-0.2 * sqrt(0.5 * (x[1]^2 + x[2]^2))) -
    exp(0.5 * (cos(2 * pi * x[1]) + cos(2 * pi * x[2]))) + exp(1) + 20
}
f_ackley(c(0, 0))

The optimization result depends on the initial value:

library("ino")
Nop$new(f = f_ackley, npar = 2)$
  set_optimizer(optimizer_nlm())$
  optimize(initial = "random", runs = 100, verbose = FALSE)$
  optima()

Contact

Have a question, found a bug, request a feature, want to contribute? Please file an issue.



loelschlaeger/ino documentation built on Sept. 29, 2023, 2:53 p.m.