Expand description
A collection of two- and multidimensional test functions (and their derivatives and Hessians)
for optimization algorithms. For two-dimensional test functions, the derivate and Hessian
calculation does not allocate. For multi-dimensional tes functions, the derivative and Hessian
calculation comes in two variants. One variant returns Vec
s and hence does allocate. This is
needed for cases, where the number of parameters is only known at run time. In case the number
of parameters are known at compile-time, the _const
variants can be used, which return fixed
size arrays and hence do not allocate.
The derivative and Hessian calculation is always named <test function name>_derivative
and
<test function name>_hessian
, respectively. The const generics variants are defined as
<test function name>_derivative_const
and <test function name>_hessian_const
.
Some functions, such as ackley
, rosenbrock
and rastrigin
come with additional optional
parameters which change the shape of the functions. These additional parameters are exposed in
ackley_abc
, rosenbrock_ab
and rastrigin_a
.
All functions are generic over their inputs and work with [f64]
and [f32]
.
§Python wrapper
Thanks to the python module
argmin-testfunctions-py
, it is possible
to use the functions in Python as well. Note that the derivative and Hessian calculation used
in the wrapper will always allocate.
§Running the tests and benchmarks
The tests can be run with
cargo test
The test functions derivatives and Hessians are tested against finitediff using proptest to sample the functions at various points.
All functions are benchmarked using criterion.rs. Run the benchmarks with
cargo bench
The report is available in target/criterion/report/index.html
.
§Contributing
This library is the most useful the more test functions it contains, therefore any contributions are highly welcome. For inspiration on what to implement and how to proceed, feel free to have a look at this issue.
While most of the implemented functions are probably already quite efficient, there are probably a few which may profit from performance improvements.
§License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT License (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
§Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Functions§
- ackley
- Ackley test function
- ackley_
abc - Ackley test function
- ackley_
abc_ derivative - Derivative of Ackley test function
- ackley_
abc_ derivative_ const - Derivative of Ackley test function
- ackley_
abc_ hessian - Hessian of Ackley test function
- ackley_
abc_ hessian_ const - Hessian of Ackley test function
- ackley_
derivative - Derivative of Ackley test function
- ackley_
derivative_ const - Derivative of Ackley test function
- ackley_
hessian - Hessian of Ackley test function
- ackley_
hessian_ const - Hessian of Ackley test function
- beale
- Beale test function
- beale_
derivative - Derivative of Beale test function
- beale_
hessian - Derivative of Beale test function
- booth
- Booth test function
- booth_
derivative - Derivative of Booth test function
- booth_
hessian - Hessian of Booth test function
- bukin_
n6 - Bukin test function No. 6
- bukin_
n6_ derivative - Derivative of Bukin test function No. 6
- bukin_
n6_ hessian - Hessian of Bukin test function No. 6
- cross_
in_ tray - Cross-in-tray test function
- cross_
in_ tray_ derivative - Derivative of Cross-in-tray test function
- cross_
in_ tray_ hessian - Hessian of Cross-in-tray test function
- easom
- Easom test function
- easom_
derivative - Derivative of Easom test function
- easom_
hessian - Hessian of Easom test function
- eggholder
- Eggholder test function
- eggholder_
derivative - Derivative of Eggholder test function
- eggholder_
hessian - Hessian of Eggholder test function
- goldsteinprice
- Goldstein-Price test function
- goldsteinprice_
derivative - Derivative of Goldstein-Price test function
- goldsteinprice_
hessian - Hessian of Goldstein-Price test function
- himmelblau
- Himmelblau test function
- himmelblau_
derivative - Derivative of Himmelblau test function
- himmelblau_
hessian - Hessian of Himmelblau test function
- holder_
table - Holder table test function
- holder_
table_ derivative - Derivative of the Holder table test function
- holder_
table_ hessian - Hessian of the Holder table test function
- levy
- Levy test function
- levy_
derivative - Derivative of Levy test function
- levy_
derivative_ const - Derivative of Levy test function
- levy_
hessian - Hessian of Levy test function
- levy_
hessian_ const - Hessian of Levy test function
- levy_
n13 - Levy test function No. 13
- levy_
n13_ derivative - Derivative of Levy test function No. 13
- levy_
n13_ hessian - Hessian of Levy test function No. 13
- matyas
- Matyas test function
- matyas_
derivative - Derivative of Matyas test function
- matyas_
hessian - Hessian of Matyas test function
- mccorminck
- McCorminck test function
- mccorminck_
derivative - Derivative of McCorminck test function
- mccorminck_
hessian - Hessian of McCorminck test function
- picheny
- Picheny test function
- picheny_
derivative - Derivative of Picheny test function
- picheny_
hessian - Hessian of Picheny test function
- rastrigin
- Rastrigin test function
- rastrigin_
a - Rastrigin test function
- rastrigin_
a_ derivative - Derivative of Rastrigin test function where
a
can be chosen freely - rastrigin_
a_ derivative_ const - Derivative of Rastrigin test function where
a
can be chosen freely - rastrigin_
a_ hessian - Hessian of Rastrigin test function where
a
can be chosen freely - rastrigin_
a_ hessian_ const - Hessian of Rastrigin test function where
a
can be chosen freely - rastrigin_
derivative - Derivative of Rastrigin test function
- rastrigin_
derivative_ const - Derivative of Rastrigin test function
- rastrigin_
hessian - Hessian of Rastrigin test function
- rastrigin_
hessian_ const - Hessian of Rastrigin test function
- rosenbrock
- Multidimensional Rosenbrock test function
- rosenbrock_
ab - Multidimensional Rosenbrock test function
- rosenbrock_
ab_ derivative - Derivative of the multidimensional Rosenbrock test function
- rosenbrock_
ab_ derivative_ const - Derivative of the multidimensional Rosenbrock test function
- rosenbrock_
ab_ hessian - Hessian of the multidimensional Rosenbrock test function
- rosenbrock_
ab_ hessian_ const - Hessian of the multidimensional Rosenbrock test function
- rosenbrock_
derivative - Derivative of the multidimensional Rosenbrock test function
- rosenbrock_
derivative_ const - Derivative of the multidimensional Rosenbrock test function
- rosenbrock_
hessian - Hessian of the multidimensional Rosenbrock test function
- rosenbrock_
hessian_ const - Hessian of the multidimensional Rosenbrock test function
- schaffer_
n2 - Schaffer test function No. 2
- schaffer_
n4 - Schaffer test function No. 4
- schaffer_
n2_ derivative - Derivative of Schaffer test function No. 2
- schaffer_
n2_ hessian - Hessian of Schaffer test function No. 2
- schaffer_
n4_ derivative - Derivative of Schaffer test function No. 4
- schaffer_
n4_ hessian - Hessian of Schaffer test function No. 4
- sphere
- Sphere test function
- sphere_
derivative - Derivative of sphere test function
- sphere_
derivative_ const - Derivative of sphere test function
- sphere_
hessian - Hessian of sphere test function
- sphere_
hessian_ const - Hessian of sphere test function
- styblinski_
tang - Styblinski-Tang test function
- styblinski_
tang_ derivative - Derivative of Styblinski-Tang test function
- styblinski_
tang_ derivative_ const - Derivative of Styblinski-Tang test function
- styblinski_
tang_ hessian - Hessian of Styblinski-Tang test function
- styblinski_
tang_ hessian_ const - Hessian of Styblinski-Tang test function
- threehumpcamel
- Three-hump camel test function
- threehumpcamel_
derivative - Derivative of Three-hump camel test function
- threehumpcamel_
hessian - Hessian of Three-hump camel test function
- zero
- Zero test function
- zero_
derivative - Derivative of zero test function
- zero_
derivative_ const - Derivative of zero test function (const version)
- zero_
hessian - Hessian of zero test function
- zero_
hessian_ const - Hessian of zero test function (const version)