Periodic Function
Mathematical Definition
\[f(\mathbf{x})=f(x_1 ... x_n)=1 + \sum_{i=1}^{n}{sin^2(x_i)}-0.1e^{(\sum_{i=1}^{n}x_i^2)}\]Plots
Two contours of the function are 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 [-10 10]$ for $i=1 … n$.
Global Minima
The function has on global minimum $f(\mathbf{x}^{\ast})=0.9$ at $\mathbf{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 periodic
print(periodic([[0, 0, 0],
[1, 1, 1]]))
MATLAB
An implementation of the Periodic Function with MATLAB
is provided below. The function can be implemented with a for
loop
that iterates over the input components but MATLAB
and Octave
have built-in facilities that allow a more brief implementation.
% Computes the value of the Periodic function.
% SCORES = PERIODICFCN(X) computes the value of the Periodic
% function at point X. PERIODICFCN 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.
%
% 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 = periodicfcn(x)
sin2x = sin(x) .^ 2;
sumx2 = sum(x .^2, 2);
scores = 1 + sum(sin2x, 2) -0.1 * exp(-sumx2);
end
The function can be represented in Latex as follows:
f(\mathbf{x})=f(x_1 ... x_n)=1 + \sum_{i=1}^{n}{sin^2(x_i)}-0.1e^{(\sum_{i=1}^{n}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
- M. M. Ali C. Khompatraporn Z. B. Zabinsky “A Numerical Evaluation of Several Stochastic Algorithms on Selected Continuous Global Optimization Test Problems,” Journal of Global Optimization vol. 31 pp. 635-672 2005.