布谷鸟搜索算法的改进及其在优化问题中的应用(Matlab代码实现)

  欢迎关注

个人主页:我爱Matlab


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

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

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

摘要

人类社会生活多个领域中的问题可以描述为优化问题(optimizationproblem),而求解优化问题一直是学术研究领域的热点。随着计算智能的飞速发展,越来越多的群智能算法如粒子群算法、萤火虫算法、蚁群算法、蜂群算法等在复杂优化问题中得到应用,目前应用的结果充分显现了群智能算法解决复杂优化问题的明显优势及巨大潜力。 布谷鸟搜索算法(Cuckoo Search,CS)是在2009年由学者Xin-she Yang等模仿布谷鸟寻窝产卵的行为提出的。由于其模型简单、参数少、易于实现等优点已经被成功应用到工程优化、设计优化等领域的优化问题中。但该算法在算法性能及应用领域等方面有进一步提升的空间,如求解精度、收敛速度的提高,局部寻优能力的提升,应用领域的拓展等。针对以上各方面,本论文从提升CS算法的性能出发,拓展了算法的应用领域。

✨⚡运行结果⚡✨

 第一次运行结果:布谷鸟搜索算法的改进及其在优化问题中的应用(Matlab代码实现)_第1张图片

 第二次:布谷鸟搜索算法的改进及其在优化问题中的应用(Matlab代码实现)_第2张图片

第三次:

布谷鸟搜索算法的改进及其在优化问题中的应用(Matlab代码实现)_第3张图片 

 

♨️‍Matlab代码‍♨️

clear all
    %% Initialization
    
Max_Num_Of_Population = 6000 ;
Initial_Num_Of_Population = 100 ;
Dynamic_Num_Of_Population = Initial_Num_Of_Population ;
Num_Of_Genes = 3 ;
Num_Of_Iteration = 200 ;
Lower_Band_Of_Genes = -5 ;
Upper_Band_Of_Genes =  5 ;
Lower_Num_Of_Egg = 1 ;
Upper_Num_Of_Egg =  5 ;
Alpha = 5;
Initial_Num_Of_Cluster = 40 ;
Dynamic_Num_Of_Cluster = Initial_Num_Of_Cluster;
Max = -10000000000;
Remove_Percent = 0;

Centroids = zeros ( 1 , Initial_Num_Of_Cluster ) ;
Generation_Of_Chromosome = (Upper_Band_Of_Genes - Lower_Band_Of_Genes)*rand ( Max_Num_Of_Population , Num_Of_Genes ) + Lower_Band_Of_Genes;
Generation_Of_Chromosome_Fitness = zeros ( 1 , Max_Num_Of_Population );
Number_Of_Egg = zeros ( 1 , Max_Num_Of_Population );
Range_Of_Egg = zeros ( Max_Num_Of_Population , Num_Of_Genes );
History_Of_Fitness_Improvement = zeros ( 1 , Num_Of_Iteration);
cnt = 10;
miangin = 0;
%%

for i = 1 : Num_Of_Iteration
    % Egg_Assignment_And_Placement
[ Generation_Of_Chromosome , Dynamic_Num_Of_Population ] = Egg_Assignment_And_Placement ( Alpha , Lower_Num_Of_Egg , Upper_Num_Of_Egg , Generation_Of_Chromosome , Dynamic_Num_Of_Population , Max_Num_Of_Population , Num_Of_Genes , Lower_Band_Of_Genes , Upper_Band_Of_Genes );

    % Fitness evaluation
[ Generation_Of_Chromosome_Fitness ] = Fitness_Evaluation( Generation_Of_Chromosome , Dynamic_Num_Of_Population , Generation_Of_Chromosome_Fitness );

    % remove 10 percent
[ Generation_Of_Chromosome , Dynamic_Num_Of_Population ] = Remove_Ten_Percent( Remove_Percent , Generation_Of_Chromosome , Dynamic_Num_Of_Population , Generation_Of_Chromosome_Fitness );

    % Clustering_Best_Finder
[ Max , Centroids , Dynamic_Num_Of_Cluster , Overall_Fitness , Membership_Function ] = Clustering_Best_Finder( Max , Generation_Of_Chromosome_Fitness , Generation_Of_Chromosome , Dynamic_Num_Of_Population , Dynamic_Num_Of_Cluster );
History_Of_Fitness_Improvement ( 1 , i ) = Max;

    % Moving_Toward_Best
[Generation_Of_Chromosome] = Moving_Toward_Best ( Centroids , Dynamic_Num_Of_Cluster , Overall_Fitness , Membership_Function , Generation_Of_Chromosome  , Num_Of_Genes );
     
    % Dynamic_Num_Of_Cluster  Update
 Dynamic_Num_Of_Cluster = 1 + round(Dynamic_Num_Of_Cluster * ( 1 - (i/Num_Of_Iteration) ));
    
end
plot ( 1:Num_Of_Iteration , History_Of_Fitness_Improvement);
miangin = miangin + History_Of_Fitness_Improvement ( Num_Of_Iteration );
cnt = cnt -1;

完整代码:布谷鸟搜索算法的改进及其在优化问题中的应用

参考文献

[1]苏芙华,刘云连,伍铁斌.求解无约束优化问题的改进布谷鸟搜索算法[J].计算机工程,2014,40(05):224-227+233.

你可能感兴趣的:(优化算法,matlab,算法,开发语言)