DE.m

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% MATLAB主函数程序

% 以求Ackley函数的全局最优解为例

% x的取值范围为[−5, 5]

% 多峰函数

% 环境:MATLAB R2018a

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

NP = 50; % 种群数量

D = 20; % 变量的维数

G = 1000; % 最大进化代数

F = 0.6; % 变异算子

CR = 0.9; % 交叉算子

Xs = 5; % 变量上限

Xx = -5; % 变量下限

k=20;

x = zeros(D,NP); % 初始种群

v = zeros(D,NP); % 变异种群

u = zeros(D,NP); % 选择种群