Goldstein-Price Function
Mathematical Definition
\[f(x,y)=[1 + (x + y + 1)^2(19 − 14x+3x^2− 14y + 6xy + 3y^2)][30 + (2x − 3y)^2(18 − 32x + 12x^2 + 4y − 36xy + 27y^2)]\]Plots
The contour of the function is as presented below:
Description and Features
- The function is continuous.
- The function is not convex.
- The function is defined on 2-dimensional space.
- The function is multimodal.
- The function is differentiable.
- The function is .
- The function is non-scalable.
Input Domain
The function can be defined on any input domain but it is usually evaluated on $x \in [-2, 2]$ and $y \in [-2, 2]$ .
Global Minima
The function has four global minima $f(\textbf{x}^{\ast})=3$ at $\textbf{x}^{\ast} = (0, -1)$.
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 goldsteinprice
print(goldsteinprice([[0, 0],
[1, 1]]))
MATLAB
An implementation of the Goldstein-Price Function with MATLAB is provided below.
% Computes the value of GOldstein-Price benchmark function.
% SCORES = GOLDSTEINPRICEFCN(X) computes the value of the GOLDSTEINPRICEFCN
% function at point X. GOLDSTEINPRICEFCN accepts a matrix of size M-by-2
% 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 = goldsteinpricefcn(x)
n = size(x, 2);
assert(n == 2, 'The Goldstein-Price function is only defined on a 2D space.')
X = x(:, 1);
Y = x(:, 2);
scores = (1 + ((X + Y + 1).^2) * (19 - (14 * X) + (3 * (X .^2)) - 14*Y + (6 .* X.*Y) + (3 * (Y.^2)))) .* ...
(30 + ((2 * X - 3 * Y).^2) .* (18 - 32 * X + 12 * (X .^2) + 48 * Y - (36 .* X.*Y) + (27 * (Y.^2))) );
end
The function can be represented in Latex as follows:
f(x,y)=[1 + (x + y + 1)^2(19 − 14x+3x^2− 14y + 6xy + 3y^2)][30 + (2x − 3y)^2(18 − 32x + 12x^2 + 4y − 36xy + 27y^2)]
References:
- http://www.sfu.ca/~ssurjano/goldpr.html
- https://en.wikipedia.org/wiki/Test_functions_for_optimization
- 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