Salomon Function
Mathematical Definition
\[f(\mathbf x)=f(x_1, ..., x_n)=1-cos(2\pi\sqrt{\sum_{i=1}^{D}x_i^2})+0.1\sqrt{\sum_{i=1}^{D}x_i^2}\]Plots
Contour of the function is presented below:
Description and Features
- The function is continuous.
- The function is not convex.
- The function is defined on n-dimensional space.
- The function is multimodal.
- The function is differentiable.
- The function is non-separable.
Input Domain
The function can be defined on any input domain but it is usually evaluated on $x_i \in [-100, 100]$ for $i=1, …, n$.
Global Minima
The function has one global minimum $f(\textbf{x}^{\ast})=0$ at $\textbf{x}^{\ast} = (0, …, 0)$.
Implementation
Python
For Python, the function is implemented in the benchmarkfcns package, which can be installed from command line with pip install benchmarkfcns
.
from benchmarkfcns import salomon
print(salomon([[0, 0, 0],
[1, 1, 1]]))
MATLAB
An implementation of the Salomon Function with MATLAB is provided below.
% Computes the value of the Salomon's benchmark function.
% SCORES = SALOMONFCN(X) computes the value of the Salomon's
% function at point X. SALOMONFCN accepts a matrix of size M-by-N
% and returns a vetor SCORES of size M-by-1 in which each row contains the
% function value for the corresponding row of X.
% For more information please visit:
% https://en.wikipedia.org/wiki/Test_functions_for_optimization
%
% Author: Mazhar Ansari Ardeh
% Please forward any comments or bug reports to mazhar.ansari.ardeh at
% Google's e-mail service or feel free to kindly modify the repository.
function scores = salomonfcn(x)
x2 = x .^ 2;
sumx2 = sum(x2, 2);
sqrtsx2 = sqrt(sumx2);
scores = 1 - cos(2 .* pi .* sqrtsx2) + (0.1 * sqrtsx2);
end
The function can be represented in Latex as follows:
f(\mathbf x)=f(x_1, ..., x_n)=1-cos(2\pi\sqrt{\sum_{i=1}^{D}x_i^2})+0.1\sqrt{\sum_{i=1}^{D}x_i^2}
References:
- Momin Jamil and Xin-She Yang, A literature survey of benchmark functions for global optimization problems, Int. Journal of Mathematical Modelling and Numerical Optimisation}, Vol. 4, No. 2, pp. 150–194 (2013), arXiv:1308.4008
- http://profesores.elo.utfsm.cl/~tarredondo/info/soft-comp/functions/node12.html
- R. Salomon, “Re-evaluating Genetic Algorithm Performance Under Corodinate Rotation of Benchmark Functions: A Survey of Some Theoretical and Practical Aspects of Genetic Algorithms,” BioSystems, vol. 39, no. 3, pp. 263-278, 1996.