首页 > 分享 > 【优化求解】基于新授粉方式的花授粉算法(NMFPA)求解单标目优化问题附matlab代码

【优化求解】基于新授粉方式的花授粉算法(NMFPA)求解单标目优化问题附matlab代码

1 简介

为了解决因花授粉算法搜索方程存在的不足所导致的易早熟、后期收敛速度慢和寻优精度低的问题,提出了一种新授粉方式的花授粉算法(Flower Pollination Algorithm with New pollination Methods,NMFPA)。该算法把惯性权重和两组随机个体差异矢量融入到全局搜索,组成新的全局授粉,以保持种群的差异性,提高算法的全局探索能力;利用信息共享机制与两种新的变异策略构建新局部授粉策略,增强算法的局部开发能力;为了减少个体进化的盲目性,提高算法的收敛速度和精度,采用基于高斯变异的最优个体来引导其他种群个体的进化方向,并且引入非均匀变异机制增加种群的多样性,避免算法易陷入局部极值点,提升算法的全局优化性能。在22个测试函数上进行数值仿真实验,实验结果和统计分析验证了新算法较标准FPA算法,在收敛精度和速度上有明显提升,且能够较好地解决早熟问题。此外,与已有改进的FPA算法从多角度进行对比分析,实验结果表明改进算法是一种富有竞争力的新算法。同时,运用NMFPA算法求解置换流水车间调度问题,实验结果验证了新算法用于解决实际工程问题是可行的,且具有一定的优势。

2 部分代码

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%Flower Pollination Algorithm for Multimodal Optimization (MFPA)

%Jorge G醠vez, Erik Cuevas and Omar Avalos

%%This is the line to execute the code:

%%[mem,bestSol,bestFit,optima,FunctionCalls]=FPA([50 0.25 500 2]);

%FitFunc implements the function to be optimized

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function [mem,bestSol,bestFit,optima,FunctionCalls]=FPA(para)

% Default parameters

if nargin<1,

   para=[50 0.25 500];   

end

n=para(1);           % Population size

p=para(2);           % Probabibility switch

N_iter=para (3);  % Number of iterations

phase = 1; %First state

phaseIte= [0.5,0.9,1.01]; %State vector

%Deb Function

d = 1;

Lb = 0;

Ub = 1;

optima =  [.1;.3;.5;.7;.9];

% Initialize the population

for i=1:n,

  Sol(i,:)=Lb+(Ub-Lb).*rand(1,d);

  Fitness(i)=fitFunc(Sol(i,:));  %%Evaluate fitness function

end

% Initialice the memory

[mem,bestSol,bestFit,worstF] = memUpdate(Sol,Fitness, [], zeros(1,d), 100000000, 0, phase,d,Ub,Lb);

S = Sol;

FunctionCalls = 0;

% Main Loop

for ite = 1 : N_iter,

                    %For each pollen gamete, modify each position acoording

                    %to local or global pollination

                    for i = 1 : n,

                                % Switch probability

                                if rand>p,

                                            L=Levy(d);

                                            dS=L.*(Sol(i,:)-bestSol);

                                            S(i,:)=Sol(i,:)+dS;

                                            S(i,:)=simplebounds(S(i,:),Lb,Ub);

                                else

                                            epsilon=rand;

                                            % Find random flowers in the neighbourhood

                                            JK=randperm(n);

                                            % As they are random, the first two entries also random

                                            % If the flower are the same or similar species, then

                                            % they can be pollenated, otherwise, no action.

                                            % Formula: x_i^{t+1}+epsilon*(x_j^t-x_k^t)

                                            S(i,:)=S(i,:)+epsilon*(Sol(JK(1),:)-Sol(JK(2),:));

                                            % Check if the simple limits/bounds are OK

                                            S(i,:)=simplebounds(S(i,:),Lb,Ub);

                                end

                                Fitness(i)=fitFunc(S(i,:));

                    end

                    %Update the memory

                    [mem,bestSol,bestFit,worstF] = memUpdate(S,Fitness,mem,bestSol,bestFit,worstF,phase,d,Ub,Lb);

                   Sol = get_best_nest(S, mem, p);

                   FunctionCalls = FunctionCalls + n;

                   if ite/N_iter > phaseIte(phase)

                        %Next evolutionary process stage

                        phase = phase + 1;

                        [m,~]=size(mem);

                        %Depurate the memory for each stage

                        mem = cleanMemory(mem);

                        FunctionCalls = FunctionCalls + m;

                   end

end

%Plot the solutions (mem) founded by the multimodal framework

x = 0:.01:1;

y = ((sin(5.*pi.*x)).^ 6);

plot(x,y)

hold on

plot(mem(:,1),-mem(:,2),'r*');

3 仿真结果

4 参考文献

[1]段艳明,肖辉辉,林芳.新授粉方式的花授粉算法[J].计算机工程与应用,2018,54(23):94-108.

博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。

部分理论引用网络文献,若有侵权联系博主删除。

相关知识

花授粉优化算法及代码实现
【优化求解】基于matlab遗传算法求解红绿灯管理优化问题【含Matlab源码262期】.md资源
【优化求解】基于动态全局搜索和柯西变异改进的花授粉算法matlab源码
新授粉方式的花授粉算法
整数规划的花授粉算法
【优化求解】基于萤火虫算法GSO求解最优目标matlab代码
适应性花朵授粉算法研究
【优化覆盖】基于matlab入侵杂草和花授粉混合算法无线传感器覆盖优化问题【含Matlab源码 1328期】
CMOFPA:多目标花授粉算法
基于花授粉算法优化实现SVM数据分类

网址: 【优化求解】基于新授粉方式的花授粉算法(NMFPA)求解单标目优化问题附matlab代码 https://m.huajiangbk.com/newsview1290276.html

所属分类:花卉
上一篇: 215号资源
下一篇: 常用授粉方式的优缺点