基于改进人工蜂群算法的K均值聚类算法(Matlab代码实现)

  🍒🍒🍒欢迎关注🌈🌈🌈

📝个人主页:我爱Matlab


👍点赞➕评论➕收藏 == 养成习惯(一键三连)🌻🌻🌻

🍌希望大家多多支持🍓~一起加油 🤗

💬语录:将来的我一定会感谢现在奋斗的自己!

🍁🥬🕒摘要🕒🥬🍁

人工蜂群(Artificial Bee Colony, ABC)算法作为一种新型的群智能优化算法,近十年发展十分迅速。算法的生物模型是受到蜜蜂在采蜜过程中,蜂群所表现出来的相互协作的智能行为的启发。通过对整个采蜜过程的抽象,提炼出人工蜂群算法,用来解决现实生活中的实际问题。由于人工蜂群算法具有算法实现简单、搜索精度高、鲁棒性较强等特点,且与经典的优化算法相比求解质量较好等,2005年由土耳其学者Karaboga提出,很快引起了众多学者的广泛关注,人工蜂群算法已经应用于旅行商问题、人工神经网络、无线传感器网络节点部署、调度问题等众多领域,并且取得了较好的成果,研究者们还在试图将算法应用到更多新的领域。人工蜂群算法作为一种新型的算法,算法还处于初级阶段,算法模型还不是很完善,在应用时也会表现出许多不足之处,在面对比较复杂的优化问题的时,算法容易“早熟”和陷入局部最优等问题。因此,研究者们开始探究如何在理论上对基本人工蜂群算法改进,在应用领域方面拓展其适用范围等问题。

✨🔎⚡运行结果⚡🔎✨

 ​

 

💂♨️👨‍🎓Matlab代码👨‍🎓♨️💂

a=3;
figure;
GlobalMins=runABC(a);
semilogy(GlobalMins,'k:');
%semilogy(mean(GlobalMins))
title('griewank函数的适应度值收敛趋势');
xlabel('迭代次数(cycles)');
ylabel('适应度(fitness)');
b=3;
GlobalMins=runABCimprove(b);
GlobalMins1=GlobalMins;
hold on;
semilogy(GlobalMins1,'k-');
legend('原始蜂群算法','本文算法');

%%%%%ARTIFICIAL BEE COLONY ALGORITHM%%%%

%Artificial Bee Colony Algorithm was developed by Dervis Karaboga in 2005 
%by simulating the foraging behaviour of bees.

%Copyright ?2008 Erciyes University, Intelligent Systems Research Group, The Dept. of Computer Engineering

%Contact:
%Dervis Karaboga (karaboga@erciyes.edu.tr )
%Bahriye Basturk Akay (bahriye@erciyes.edu.tr)
function GlobalMins=runABC(a)


% Set ABC Control Parameters
ABCOpts = struct( 'ColonySize',  20, ...   % Number of Employed Bees+ Number of Onlooker Bees 
    'MaxCycles', 2000,...   % Maximum cycle number in order to terminate the algorithm
    'ErrGoal',     1e-20, ...  % Error goal in order to terminate the algorithm (not used in the code in current version)
    'Dim',       2 , ... % Number of parameters of the objective function   
    'Limit',   100, ... % Control paramter in order to abandone the food source 
    'lb',  -3, ... % Lower bound of the parameters to be optimized
    'ub',  3, ... %Upper bound of the parameters to be optimized
    'ObjFun' , 'griewank', ... %Write the name of the objective function you want to minimize
    'RunTime',1); % Number of the runs 

GlobalMins=zeros(ABCOpts.RunTime,ABCOpts.MaxCycles);

for r=1:ABCOpts.RunTime
    
% Initialise population
Range = repmat((ABCOpts.ub-ABCOpts.lb),[ABCOpts.ColonySize ABCOpts.Dim]);
Lower = repmat(ABCOpts.lb, [ABCOpts.ColonySize ABCOpts.Dim]);
Colony = rand(ABCOpts.ColonySize,ABCOpts.Dim) .* Range + Lower;%生成初始Colony,其中ColonySize行,Dim列,10*5
%zj先初始化种群规模。。。这个就是算法中式子:x(j)i=x(j)min+rand(0,1)(x(j)max-x(j)min)

Employed=Colony(1:(ABCOpts.ColonySize/2),:);%前一半为引领蜂或食物源,5*5
%zj再将种群的前一半作为引领蜂规模
 

📜📢🌈参考文献🌈📢📜

[1]黄媛媛. 一种改进的人工蜂群算法及其在k均值聚类中的应用[D].安徽大学,2015.

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值