资源简介
有标准布谷鸟算法,自适应布谷鸟算法,模拟退火布谷鸟算法,有注释很详细

代码片段和文件信息
function [bestnestfmin]=beita_cuckoo_search(n) %布谷鸟算法主程序
clc;clear all;
if nargin<1
% Number of nests (or different solutions)
n=50; %初始化生成25个鸟巢
end
% Discovery rate of alien eggs/solutions
pa=0.25; %设置最大发现概率
%% Change this if you want to get better results
% Tolerance %精度
%Tol=1.0e-5;
%N_IterTotal=500;
%% Simple bounds of the search domain %设置搜索范围
% Lower bounds
%nd=5;
Lb=[-100 -100]; %上限
% Upper bounds
Ub=[100 100];
% Lb=[0 0 0 0 0 0]; %上限
% % Upper bounds
% Ub=[2460 7500 1100 12000 500 1000]; %下限
% Random initial solutions
for i=1:n %随机产生25个鸟窝的初始位置初始解
nest(i:)=Lb+(Ub-Lb).*rand(size(Lb));
end
% Get the current best
fitness=zeros(n1); %计算每个鸟窝的目标函数值得到当前的最优函数值
for i=1:n
fitness(i:)=fobj(nest(i:));
end
[fminbestnestnestfitness]=get_best_nest(nestnestfitness); %计算
N_iter=0; %设置一个计数器
%% Starting iterations %开始迭代
% while (fmin>Tol)
%
% % Generate new solutions (but keep the current best)
% new_nest=get_cuckoos(nestbestnestLbUb); %更新鸟窝位置 产生新解
% [fnewbestnestfitness]=get_best_nest(nestnew_nestfitness);%找出当前最优解
% % Update the counter %更新计数器
% N_iter=N_iter+n;
% % Discovery and randomization %随机评价是否要淘汰解
% new_nest=empty_nests(nestLbUbpa) ;
%
% % Evaluate this set of solutions
% [fnewbestnestfitness]=get_best_nest(nestnew_nestfitness);
% % plot(N_iterbestnest‘ks‘‘linewidth‘2‘MarkerEdgeColor‘‘k‘‘MarkerFaceColor‘‘g‘‘MarkerSize‘10)
% % Update the counter again
% N_iter=N_iter+n;
% % Find the best objective so far %找到目前最优解
% % plot(N_iterbestnest‘ks‘‘linewidth‘2‘MarkerEdgeColor‘‘k‘‘Marker
% % FaceColor‘‘g‘‘MarkerSize‘10)
% if fnew % fmin=fnew;
% bestnest=best;
% end
% plot(N_iterbestnest‘ks‘‘linewidth‘2‘MarkerEdgeColor‘‘k‘‘MarkerFaceColor‘‘g‘‘MarkerSize‘10)
% end %% End of iterations
flj=[]; %存放结果的数组
Tend=1e-3;
mm=1;
while mm>Tend
N_iter=N_iter+1;
% Generate new solutions (but keep the current best)
new_nest=get_cuckoos(nestbestnestfitness);
% for j=1:n
% if(new_nest(j:)Ub)
% new_nest(j:) = temp;
% end
% end
[fnewbestnestfitness]=get_best_nest(nestnew_nestfitness);
% Update the counter
% Discovery and randomization
new_nest=empty_nests(nestpa) ;
% Evaluate this set of solutions
[fnewbestnestfitness]=get_best_nest(nestnew_nestfitness);
% Update the counter again
% Find the best objective so far
if fnew fmin=fnew;
bestnest=best;
end
flj(N_iter1)=N_iter;
flj(N_iter2)=log10(abs(0-fmin));
plot(flj(:1)flj(:2)‘k‘)
xlabel(‘迭代次数‘)
ylabel(‘适应度值‘)
mm=abs(0-fmin);
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 917022 2012-04-06 09:46 Adaptive Particle Swarm Optimization.pdf
文件 2884 2012-04-06 09:47 APSO.m
文件 276 2011-05-17 09:36 calfactor.m
文件 651 2011-05-18 20:58 fuzzyclassification.m
文件 121 2011-05-19 08:54 Rastrigrin.m
文件 122 2011-05-17 20:50 rosenbrock.m
文件 193 2011-05-18 21:02 s1.m
文件 193 2011-05-18 21:02 s2.m
文件 124 2011-05-18 21:02 s3.m
文件 123 2011-05-18 21:02 s4.m
----------- --------- ---------- ----- ----
921709 10
相关资源
- SVR算法程序可运行
- 计算机图形学 边填充算法实现代码
- 福建师范大学历年算法考卷
- 栈的实现及应用,六种基本算法
- Bresenham算法绘制线段并利用“橡皮筋
- 介绍几种压缩算法及《笨笨数据压缩
- 改进的BP神经网络算法
- A星算法_原理讲解_例子
- 云模型的相关算法cloud
- 旋转矩阵求欧拉角的简单算法
- 栅栏填充算法源码(VC)
- RSA算法源码
- 关联分析Apriori算法实现
- [免费]relax算法成像
- 操作系统 LRU算法 实验报告 及 程序代
- 分治法快速排序算法QuickSort C
- 现代谱估计算法 music ESPRIT 谐波分解
- MUSIC算法c 实现
- 007出纳管理系统 v7[1].5.94 算法注册机
- 克鲁斯卡尔算法C和C 实现代码
- capon波束形成算法-VC实现
- QGA 量子遗传算法
- 利用OpenGL写毛笔字算法
- 带头结点的单链表的c算法实现
- 自适应隐写算法wow
- 协同过滤算法源码
- RSA AES DES ECC加密算法源码
- 密码学课程设计:DES加密解密算法的
- 北航人工智能原理课大作业源代码,
- A*算法的2D演示(带源码)
评论
共有 条评论