Test Functions

10 Test Functions for benchmarking optimisation algorithms
434 Downloads
Updated 17 Oct 2016

View License

In computational and applied mathematics, test functions also known as artificial landscapes, are useful to evaluate characteristics of optimization algorithms in terms of i.e. the convergence rate, precision, performance and robustness.
The included test functions are:
1. Easom 2D
f(x) = -cos(x1) cos(x2) * exp ( – ( x1 – π )² – ( x2 – π )² )
2. Becker and Lago
f(x) = ( |x1| − 5 )² + ( |x2| − 5 )²

3. Bohachevsky
f(x) = x1 ² + 2*x2² – 0.3 * cos(3πx1) – 0.4*cos(4πx2) + 0.7

4. Eggerate
f(x) = x1² + x2² + 25*( (sin(x1))² + (sin(x2))² )

5. Periodic
f(x) = 1 + (sin(x1))² + (sin(x2))² – 0.1*exp ( -x1² – x2² )

and several other functions i.e. the commonly used Sphere, Rosenbrock, Rastrigin, Schwefel, and Griewank functions.

Important note:
Since these functions are looking for minimum of f(x) by optimizing both x1 and x2, a minus sign is added in each expression.

More details can be found at this page: https://kyleongmachinelearning.wordpress.com/2016/09/25/test-functions-for-optimization/

Cite As

Kuan Yew Leong (2025). Test Functions (https://www.mathworks.com/matlabcentral/fileexchange/59737-test-functions), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2015a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Optimization Toolbox in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.1.0.0

- More details are updated in the description.
- Minor update on the comments in several files.

1.0.0.0

Description is updated.