Mathematical Definition

\[f(x,y)=(x+2y-7)^2+(2x+y-5)^2\]

Plots

Booth Function

Booth Function

The contour of the function is as presented below:

Booth Function

Description and Features

  • The function is continuous.
  • The function is convex.
  • The function is defined on 2-dimensional space.
  • The function is unimodal.
  • The function is differentiable.
  • The function is .

Input Domain

The function can be defined on any input domain but it is usually evaluated on $x_i \in [-10, 10]$ for all $i = 1,2$.

Global Minima

The function has one global minimum at: $f(\textbf{x}^{\ast})=0$ at $\textbf{x}^{\ast} = (1,3)$.

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 booth

print(booth([[0, 0],
              [1, 1]]))

MATLAB

An implementation of the Booth Function with MATLAB is provided below.

% Computes the value of the Booth benchmark function.
% SCORES = BOOTHFCN(X) computes the value of the Booth's function at 
% point X. BOOTHFCN 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.
% 
% 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 = boothfcn(x)
    
    n = size(x, 2);
    assert(n == 2, 'Booth''s function is only defined on a 2D space.')
    X = x(:, 1);
    Y = x(:, 2);
    
    scores = (X + (2 * Y) - 7).^2 + ( (2 * X) + Y - 5).^2;
end

The function can be represented in Latex as follows:

f(x,y)=(x+2y-7)^2+(2x+y-5)^2

References: