Optimisation test functions#

Common test functions for parameter estimation and optimisation algorithms.

Current functions are:
ackley - >=2 params

Ackley function, global optimum: 0.0 at origin

goldstein_price - 2 params

Goldstein-Price function, global optimum: 3.0 at (0.0,-1.0)

griewank - 2 or 10 params

Griewank function, global optimum: 0 at origin

rastrigin - 2 params

Rastrigin function, global optimum: -2 at (0,0)

rosenbrock - 2 params

Rosenbrock function, global optimum: 0 at (1,1)

six_hump_camelback - 2 params

Six-hump Camelback function

True Optima: -1.031628453489877 at (-0.08983, 0.7126) and (0.08983, -0.7126)

This module was written by Matthias Cuntz while at Department of Computational Hydrosystems, Helmholtz Centre for Environmental Research - UFZ, Leipzig, Germany, and continued while at Institut National de Recherche pour l’Agriculture, l’Alimentation et l’Environnement (INRAE), Nancy, France.

copyright:

Copyright 2013-2022 Matthias Cuntz, see AUTHORS.rst for details.

license:

MIT License, see LICENSE for details.

Functions:

ackley(x)

Ackley function (>= 2-D).

griewank(x)

Griewank function (2-D or 10-D).

goldstein_price(x)

Goldstein-Price function (2-D).

rastrigin(x)

Rastrigin function (2-D).

rosenbrock(x)

Rosenbrock function (2-D).

six_hump_camelback(x)

Six-hump Camelback function (2-D).

History
  • Written Oct 2013 by Matthias Cuntz (mc (at) macu (dot) de)

  • Rearrange function library, Mar 2015, Matthias Cuntz

  • Changed to Sphinx docstring and numpydoc, May 2020, Matthias Cuntz

  • More consistent docstrings, Jan 2022, Matthias Cuntz

ackley(x)[source]#

Ackley function (>= 2-D).

Global Optimum: 0.0 at origin.

Parameters:

x (array) – multi-dimensional x-values (len(x) >= 2)

Returns:

Value of Ackley function.

Return type:

float

goldstein_price(x)[source]#

Goldstein-Price function (2-D).

Global Optimum: 3.0 at (0.0, -1.0).

Parameters:

x (array) – 2 x-values. len(x)=2. x[i] bound to [-2, 2] for i=1 and 2.

Returns:

Value of Goldstein-Price function.

Return type:

float

griewank(x)[source]#

Griewank function (2-D or 10-D).

Global Optimum: 0.0 at origin.

Parameters:

x (array) – multi-dimensional x-values. len(x)=2 or len(x)=10. x[i] bound to [-600, 600] for all i.

Returns:

Value of Griewank function.

Return type:

float

rastrigin(x)[source]#

Rastrigin function (2-D).

Global Optimum: -2.0 at origin.

Parameters:

x (array) – 2 x-values. len(x)=2. x[i] bound to [-1, 1] for i=1 and 2.

Returns:

Value of Rastrigin function.

Return type:

float

rosenbrock(x)[source]#

Rosenbrock function (2-D).

Global Optimum: 0.0 at (1.0, 1.0).

Parameters:

x (array) – 2 x-values. len(x)=2. x[1] bound to [-5, 5]. x[2] bound to [-2, 8].

Returns:

Value of Rosenbrock function.

Return type:

float

six_hump_camelback(x)[source]#

Six-hump Camelback function (2-D).

Global Optima: -1.031628453489877 at (-0.08983, 0.7126) and (0.08983, -0.7126).

Parameters:

x (array) – 2 x-values. len(x)=2. x[i] bound to [-5, 5] for i=1 and 2.

Returns:

Value of Six-hump Camelback function.

Return type:

float