Mathematical Definition

\[f(x)= (6x - 2)^{2}sin(12x - 4)\]

Plots

Forrester Function

Description and Features

  • The function is continuous.
  • The function is not convex.
  • The function is defined on 1-dimensional space.
  • The function is unimodal.

Input Domain

The function can be defined on any input domain but it is usually evaluated on $x \in [-0.5, 2.5]$.

Global Minima

The function has one local minimum at: $f(x^*)=-6.0207$ at $\textbf{x}^{\ast} = 0.757249$.

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 forrester

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

MATLAB

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

% Computes the value of the Forrester function.
% SCORES = FORRESTERFCN(X) computes the value of the Forrester
% function at point X. FORRESTERFCN accepts a matrix of size M-by-1 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 = forresterfcn(x)
     n = size(x, 1);
     assert(n == 1, 'The Forrester function is defined only on the 1-D space.')
     
     scores = (6 * x - 2).^2 .* sin(12 * x - 4);
end 

The function can be represented in Latex as follows:

f(x)= (6x - 2)^{2}sin(12x - 4)

References: