资源简介
免疫算法代码,包括物流配送地址的案例,可以通过案例进行运行
代码片段和文件信息
function rets=bestselect(individualsmn)
% 初始化记忆库依据excellence,将群体中高适应度低相似度的overbest个个体存入记忆库
% m input 抗体数
% n input 记忆库个体数\父代群规模
% individuals input 抗体群
% bestindividuals output 记忆库\父代群
% 精英保留策略,将fitness最好的s个个体先存起来,避免因其浓度高而被淘汰
s=3;
rets=struct(‘fitness‘zeros(1n) ‘concentration‘zeros(1n)‘excellence‘zeros(1n)‘chrom‘[]);
[fitnessindex] = sort(individuals.fitness);
for i=1:s
rets.fitness(i) = individuals.fitness(index(i));
rets.concentration(i) = individuals.concentration(index(i));
rets.excellence(i) = individuals.excellence(index(i));
rets.chrom(i:) = individuals.chrom(index(i):);
end
% 剩余m-s个个体
leftindividuals=struct(‘fitness‘zeros(1m-s) ‘concentration‘zeros(1m-s)‘excellence‘zeros(1m-s)‘chrom‘[]);
for k=1:m-s
leftindividuals.fitness(k) = individuals.fitness(index(k+s));
leftindividuals.concentration(k) = individuals.concentration(index(k+s));
leftindividuals.excellence(k) = individuals.excellence(index(k+s));
leftindividuals.chrom(k:) = individuals.chrom(index(k+s):);
end
% 将剩余抗体按excellence值排序
[excellenceindex]=sort(1./leftindividuals.excellence);
% 在剩余抗体群中按excellence再选n-s个最好的个体
for i=s+1:n
rets.fitness(i) = leftindividuals.fitness(index(i-s));
rets.concentration(i) = leftindividuals.concentration(index(i-s));
rets.excellence(i) = leftindividuals.excellence(index(i-s));
rets.chrom(i:) = leftindividuals.chrom(index(i-s):);
end
end
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1669 2010-09-06 09:12 chapter12\bestselect.m
文件 7910 2010-09-07 10:22 chapter12\centre.fig
文件 479 2010-09-06 09:46 chapter12\concentration.m
文件 1294 2010-09-06 14:49 chapter12\Cross.m
文件 1046 2010-09-06 09:35 chapter12\draw.m
文件 400 2010-09-06 09:41 chapter12\excellence.m
文件 9007 2010-09-07 10:22 chapter12\figure.fig
文件 901 2010-09-07 22:59 chapter12\fitness.m
文件 4838 2010-09-07 10:24 chapter12\IAdata.mat
文件 1102 2010-09-06 09:45 chapter12\incorporate.m
文件 3676 2010-12-28 22:13 chapter12\main.m
文件 1001 2010-09-06 15:40 chapter12\Mutation.m
文件 319 2010-09-06 09:39 chapter12\popinit.m
文件 912 2010-09-06 09:18 chapter12\Select.m
文件 377 2010-09-06 09:35 chapter12\similar.m
文件 580 2010-09-06 09:36 chapter12\test.m
目录 0 2015-07-30 12:29 chapter12
----------- --------- ---------- ----- ----
35511 17
评论
共有 条评论