ga_fackley.m

来自「其中提到遺傳學的程式碼與應用提供給次淚相向的研究者參考下載」· M 代码 · 共 33 行

M
33
字号
function   PI=GA_fAckley(chro)
% function PI=GA_fAckley(chro)
% Fitness function evaluation of Ackey function
% chro is the input argument and is a vector of 2 elements
% MIN_offset, MUL_factor should be declared and values assigned
% before calling this function, such as
%   MIN_offset=100; MUL_factor=1;
% in the other program. However, if you want to use function
% alone,(both of the above varaibles are not declared
% before), this program will give you DEFAULT values as
%   MIN_offset=25; MUL_factor=1;   %<== DEFAULT
% CALLING example:
%   PI=GA_fAckley([1.3 4.5])

% PenChen Chou, 8-10-2001
% Revised on    4-10-2002

global MIN_offset MUL_factor

if isempty(MIN_offset)
    MIN_offset=25;
end

if isempty(MUL_factor)
    MUL_factor=1;
end

x=chro(1); y=chro(2);
PI=-20*exp(-0.2*sqrt(0.5*(x.*x+y.*y)))-exp(0.5*(cos(2*pi*x)+...
    cos(2*pi*y)))+20+2.71282;

attached_part;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?