资讯动态

【自私羊群优化算法】基于自私羊群优化算法求解单目标优化问题-附Matlab代码

发布时间:2026/8/19 12:27:38 来源:尧图企业网站定制
1 简介自私羊群优化SHO算法是由Fausto于2017年提出的元启发式算法[16]它主要基于汉密尔顿[17]提出的自私群理论来模拟猎物与捕食者之间的狩猎关系。当群体中的个体受到捕食者的攻击时为了增加生存机会群体中的个体产生聚集行为个体更有可能移动到相对安全的位置群体的中心位置并且群体的边缘个体更容易受到攻击这也导致群体的边缘个体逃离群体以增加他们被捕食者攻击时的生存机会。该方法假设整个平原是一个解空间该算法包含两个不同的搜索因子被狩猎群和狩猎群。每个搜索因子通过一组不同的进化算子指导算法的计算以便更好地模拟猎物与捕食者关系之间的关系。2 部分代码function [Best_hyena_score,Best_hyena_pos,Convergence_curve]sho(N,Max_iterations,lowerbound,upperbound,dimension,fitness) hyena_posinit(N,dimension,upperbound,lowerbound); Convergence_curvezeros(1,Max_iterations); Iteration1; while IterationMax_iterations for i1:size(hyena_pos,1) H_ubhyena_pos(i,:)upperbound; H_lbhyena_pos(i,:)lowerbound; hyena_pos(i,:)(hyena_pos(i,:).*(~(H_ubH_lb)))upperbound.*H_ublowerbound.*H_lb; hyena_fitness(1,i)fitness(hyena_pos(i,:)); end if Iteration1 [fitness_sorted FS]sort(hyena_fitness); sorted_populationhyena_pos(FS,:); best_hyenassorted_population; best_hyena_fitnessfitness_sorted; else double_population[pre_population;best_hyenas]; double_fitness[pre_fitness best_hyena_fitness]; [double_fitness_sorted FS]sort(double_fitness); double_sorted_populationdouble_population(FS,:); fitness_sorteddouble_fitness_sorted(1:N); sorted_populationdouble_sorted_population(1:N,:); best_hyenassorted_population; best_hyena_fitnessfitness_sorted; end NOHnoh(best_hyena_fitness); Best_hyena_scorefitness_sorted(1); Best_hyena_possorted_population(1,:); pre_populationhyena_pos; pre_fitnesshyena_fitness; a5-Iteration*((5)/Max_iterations); HYE0; CV0; for i1:size(hyena_pos,1) for j1:size(hyena_pos,2) for k1:NOH HYE0; r1rand(); r2rand(); Var12*a*r1-a; Var22*r2; distance_to_hyenaabs(Var2*sorted_population(k)-hyena_pos(i,j)); HYEsorted_population(k)-Var1*distance_to_hyena; CVCVHYE; distance_to_hyena0; end hyena_pos(i,j)(CV/(NOH1)); CV0; end end Convergence_curve(Iteration)Best_hyena_score; IterationIteration1; end3 仿真结果4 参考文献[1]朱惠娟, 王永利, 陈琳琳. 面向三维模型轻量化的自私羊群优化算法研究[J]. 计算机工程与应用, 2020, 56(3):7.博主简介擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真相关matlab代码问题可私信交流。

读完文章,也想定制专属网站?

尧图设计师 24 小时内与您沟通定制方案

免费获取报价