ao {ao}R Documentation

Alternating Optimization.

Description

This function performs alternating optimization on the function f.

Usage

ao(
  f,
  partition,
  initial = 0,
  iterations = 10,
  tolerance = 1e-06,
  minimize = TRUE,
  progress = FALSE,
  plot = TRUE
)

Arguments

f

An object of class ao_f, i.e. the output of set_f.

partition

A list of vectors of parameter indices 1,...,n of the function. For example, choosing partition = list(1, 2) as in the example optimizes each parameter separately, while choosing partition = list(1:2) leads to joint optimization. Parameter indices can be members of multiple subsets.

initial

A vector of length f$npar of initial parameter values. Per default, the algorithm is initialized at the origin.

iterations

The number of iterations through all subsets.

tolerance

A non-negative numeric value. The function terminates prematurely if the euclidean distance between the current solution and the one from the last iteration is smaller than tolerance.

minimize

If TRUE, minimization, if FALSE, maximization.

progress

If TRUE, progress is printed.

plot

If TRUE, the parameter updates are plotted.

Details

This function depends on optimx.

Value

An object of class ao, which is a list of

Examples

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))

[Package ao version 0.2.1 Index]