Happy Cat Function
Mathematical Definition
\[f(\textbf{x})=\left[\left(||\textbf{x}||^2 - n\right)^2\right]^\alpha + \frac{1}{n}\left(\frac{1}{2}||\textbf{x}||^2+\sum_{i=1}^{n}x_i\right)+\frac{1}{2}\]In the above definition, \(\alpha\) is a real-valued parameter. For the value of \(\alpha=\frac{1}{8}\), the contour of the function resembles a smiling cat, leading to the naming of the function.
Plots
For the value of \(\alpha=1/8\), the function looks as:
A contour of the function is presented below:
Description and Features
- The function is not convex.
- The function is defined on n-dimensional space.
- The function is non-separable.
- The function is differentiable.
Input Domain
The function can be defined on any input domain but it is usually evaluated on $x_i \in [-2, 2]$ for $i=1, …, n$.
Global Minima
The function has one global minimum at $f(\textbf{x}^{\ast}) = 0$ located at $\mathbf{x^\ast}=(-1, …, -1)$.
Implementation
Python
For Python, the function is implemented in the benchmarkfcns package, which can be installed from command line with pip install benchmarkfcns
.
MATLAB
An implementation of the Happy Cat Function with MATLAB
is provided below.
The function can be represented in Latex as follows:
Acknowledgement:
- Prof Hans-Georg Beyer kindly contributed the source code and literature for this function.
References:
- Hans-Georg Beyer and Steffen Finck, HappyCat – A Simple Function Class Where Well-Known Direct Search Algorithms Do Fail, Parallel Problem Solving from Nature - PPSN XII, pp. 367–376 (2012), https://doi.org/10.1007/978-3-642-32937-1_37