Testfunctions {adagio}R Documentation

Optimization Test Functions

Description

Simple and often used test function defined in higher dimensions and with analytical gradients, especially suited for performance tests. Analytical gradients, where existing, are provided with the gr prefix. The dimension is determined by the length of the input vector.

Usage

fnRosenbrock(x)
grRosenbrock(x)
fnRastrigin(x)
grRastrigin(x)
fnNesterov(x)
grNesterov(x)
fnNesterov1(x)
fnNesterov2(x)
fnHald(x)
grHald(x)
fnShor(x)
grShor(x)

Arguments

x

numeric vector of a certain length.

Details

Rosenbrock – Rosenbrock's famous valley function from 1960. It can also be regarded as a least-squares problem:

\sum_{i=1}^{n-1} (1-x_i)^2 + 100 (x_{i+1}-x_i^2)^2

No. of Vars.: n >= 2
Bounds: -5.12 <= xi <= 5.12
Local minima: at f(-1, 1, ..., 1) for n >= 4
Minimum: 0.0
Solution: xi = 1, i = 1:n

Nesterov – Nesterov's smooth adaptation of Rosenbrock, based on the idea of Chebyshev polynomials. This function is even more difficult to optimize than Rosenbrock's:

(1 - x_1)^2 / 4 + \sum_{i=1}^{n-1} (1 + x_{i+1} - 2 x_i^2)^2

Two nonsmooth Nesterov functions are available: Nesterov2 and Nesterov1, defined as

(1 - x_1)^2 / 4 + \sum_{i=1}^{n-1} |1 + x_{i+1} - 2 x_i^2|

|1 - x_1| / 4 + \sum_{i=1}^{n-1} (|1 + x_{i+1} - 2 |x_i||

No. of Vars.: n >= 2
Bounds: -5.12 <= xi <= 5.12
Local minima: ?
Minimum: 0.0
Solution: xi = 1, i = 1:n

Nesterov1 and Nesterov2 – Simlar to Nesterov, except the terms added are taken with absolute value, which makes this function nonsmooth and painful for gradient-based optimization routines; no gradient provided.
(Nesterov2 uses absolute instead of quadratic terms.)

Rastrigin – Rastrigin's function is a famous, non-convex example from 1989 for global optimization. It is a typical example of a multimodal function with many local minima:

10 n + \sum_1^n (x_i^2 - 10 \cos(2 \pi x_i))

No. of Vars.: n >= 2
Bounds: -5.12 <= xi <= 5.12
Local minima: many
Minimum: 0.0
Solution: xi = 0, i = 1:n

Hald – Hald's function is a typical example of a non-smooth test function, from Hald and Madsen in 1981.

\max_{1 \le i \le n} | \frac{x_1 + x_2 t_i}{1 + x_3 t_i + x_4 t_i^2 + x_5 t_i^3} - \exp(t_i)|

where n = 21 and t_i = -1 + (i - 1)/10 for 1 \le i \le 21.

No. of Vars.: n =5
Bounds: -1 <= xi <= 1
Local minima: ?
Minimum: 0.0001223713
Solution: (0.99987763, 0.25358844, -0.74660757, 0.24520150, -0.03749029)

Shor – Shor's function is another typical example of a non-smooth test function, a benchmark for Shor's R-algorithm.

Value

Returns the values of the test function resp. its gradient at that point. If an analytical gradient is not available, a function computing the gradient numerically will be provided.

References

Search the Internet.

Examples

x <- runif(5)
fnHald(x); grHald(x)

# Compare analytical and numerical gradient
shor_gr <- function(x) adagio:::ns.grad(fnShor, x)    # internal gradient
grShor(x); shor_gr(x) 

[Package adagio version 0.9.2 Index]