Gointerface接口声明实现及作用详解
231
2022-09-05
【优化选址】基于帝国企鹅算法求解工厂-中心-需求点三级选址问题附matlab代码
1 简介
2 部分代码
function [bestY,bestX,recording]=AFO2(x,y,option,data)%% Input% x----positions of initialized populaiton% y----fitnesses of initialized populaiton% option-----parameters set of the algorithm% data------Pre-defined parameters% This parameter is used for solving complex problems is passing case data%% outPut% bestY ----fitness of best individual% bestX ----position of best individual% recording ---- somme data was recorded in this variable%% initializationpe=option.pe;L=option.L;gap0=option.gap0;gap=gap0;dim=option.dim;maxIteration=option.maxIteration;recording.bestFit=zeros(maxIteration+1,1);recording.meanFit=zeros(maxIteration+1,1);numAgent=option.numAgent;At=randn(numAgent,dim);w2=option.w2; %weight of Moving strategy IIIw4=option.w4;%weight of Moving strategy IIIw5=option.w5;%weight of Moving strategy IIIpe=option.pe; % rate to judge Premature convergencegapMin=option.gapMin;dec=option.dec;ub=option.ub;lb=option.lb;v_lb=option.v_lb;v_ub=option.v_ub;fobj=option.fobj;count=1;%% center of population[y_c,position]=min(y);x_c=x(position(1),:);At_c=At(position(1),:);%% memory of populationy_m=y;x_m=x;%% update recordingrecording.bestFit=y_c;recording.meanFit=mean(y_m);%% main loopiter=1;while iter<=maxIteration %Dmp(['AFO,iter:',num2str(iter),',minFit:',num2str(y_c)]) %% Moving Strategy I for center of population if rem(iter, gap)==0 c0=exp(-30*(iter-gap0)/maxIteration); % EQ.2-11 Dx=ones(1,dim); Dx=c0*Dx/norm(Dx)*norm(v_ub-v_lb)/2; %EQ.2-12 %+¡÷x Dx1=-Dx; %-¡÷x % +¡÷x for j=1:dim tempX(j,:)=x_c; tempX(j,j)=x_c(1,j)+Dx(j); if tempX(j,j)>ub(j) tempX(j,j)=ub(j); Dx(1,j)=tempX(j,j)-x_c(1,j); end if tempX(j,j) ub)=ub(x(i,:)>ub); tempY(i,:)=y(i); y(i)=fobj(x(i,:)); if tempY(i,:) 3 仿真结果 4 参考文献 [1]李卫江, 郭晓汾, 张毅,等. 基于Matlab优化算法的物流中心选址[J]. 长安大学学报(自然科学版), 2006, 026(003):76-79. 博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。 部分理论引用网络文献,若有侵权联系博主删除。
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
v_ub)=G0(1,G0(1,:)>v_ub)/max(G0(1,G0(1,:)>v_ub))*max(v_ub(G0(1,:)>v_ub)); G0(1,G0(1,:)
v_ub)=G0(1,G0(1,:)>v_ub)/max(G0(1,G0(1,:)>v_ub))*max(v_ub(G0(1,:)>v_ub)); G0(1,G0(1,:)
ub)=ub(tempX(j,:)>ub); tempY(j,:)=fobj(tempX(j,:)); end end [minY,no]=min(tempY); if minY
发表评论
暂时没有评论,来抢沙发吧~