Code covered by the BSD License  

Highlights from
Traditionalized Ackley

image thumbnail
from Traditionalized Ackley by George Evers
Implements the traditional benchmark formulation used in optimization literature

ackleyfcn(x)
function f = ackleyfcn(x)
% Evaluate the "Ackley" benchmark as defined in the optimization literature.
    % This fixes "ackleyfcn.m" of the global optimization toolbox and
    % genetic algorithm and direct search toolbox, which produces
    % unorthodox function values at all positions.
% f* = 0.0 at the null vector.
% Ranges employed in the literature: [-32.768, 32.768], [-32, 32], [-30, 30].

dim = size(x, 2); % Determine the problem dimensionality once instead of repeatedly.
x = max(-32.768,min(32.768,x)); % Set values outside the search space to the
        % left or right boundary value depending on the sign (i.e. clamp
        % positions to max and min values).
    % Caution: Position clamping should be commented out when employing an
        % algorithm that already accounts for stray individuals - such as
        % in conjunction with Gerhard Venter's velocity reset concept,
        % which can be implemented by the PSO Research Toolbox.

%Compute function values.
f = -20*exp(-0.2*sqrt(sum(x.^2, 2)/dim)) - exp(sum(cos(2*pi*x), 2)/dim) + exp(1) + 20;

Contact us