2023年最新智能优化算法之——能量谷优化器 Energy valley optimizer(EVO),附MATLAB代码和文献

能量谷优化器(EVO)是一种新的元启发式算法,它的算法是受到了关于稳定性和不同粒子衰变模式的先进物理原理的启发。在文献中,作者与CEC函数中最先进的算法进行了比较,并且证明该算法确实很强劲。算法原理大家请参考文献。

[1] Azizi M ,  Aickelin U ,  Khorshidi H A , et al. Energy valley optimizer: a novel metaheuristic algorithm for global and engineering optimization[J]. Scientific Reports.

evo算法与其他算法的对比结果图:

 更多对比结果与数据请参考本文献,文献与代码作者打包在一起了,请大家查收。

直接上结果图:

算法核心代码:

function [Best_score,Best_Pos,Conv_History]=EVO(nParticles,MaxFes,lb,ub,VarNumber,fobj)

%% Problem Information
CostFunction = fobj;          % @ Cost Function
VarMin = lb *ones(1,VarNumber);        % Lower bound of variable;
VarMax = ub *ones(1,VarNumber);         % Upper bound of variable;

%% Counters
Iter=0;   % Iterations
FEs=0;    % Function Evaluations

%% Initialization
Particles=[]; NELs=[];
for i=1:nParticles
    Particles(i,:)=unifrnd(VarMin,VarMax,[1 VarNumber]);
    NELs(i,1)=CostFunction(Particles(i,:));
    FEs=FEs+1;
end

% Sort Particles
[NELs, SortOrder]=sort(NELs);
Particles=Particles(SortOrder,:);
BS=Particles(1,:); 
BS_NEL=NELs(1);
WS_NEL=NELs(end);

%% Main Loop
while FEs<MaxFes
    Iter=Iter+1;
    NewParticles=[];
    NewNELs=[];   
   for i=1:nParticles
       Dist=[];
       for j=1:nParticles
           Dist(j,1)=distance(Particles(i,:), Particles(j,:));
       end
       [ ~, a]=sort(Dist);
       CnPtIndex=randi(nParticles);
       if CnPtIndex<3
           CnPtIndex=CnPtIndex+2;
       end
       CnPtA=Particles(a(2:CnPtIndex),:);
       CnPtB=NELs(a(2:CnPtIndex),:);
       X_NG=mean(CnPtA);
       X_CP=mean(Particles);
       EB=mean(NELs);            
       SL=(NELs(i)-BS_NEL)/(WS_NEL-BS_NEL); SB=rand;
       if NELs(i)>EB   
           if SB>SL         
               AlphaIndex1=randi(VarNumber);
               AlphaIndex2=randi([1 VarNumber], AlphaIndex1 , 1);
               NewParticle(1,:)=Particles(i,:);
               NewParticle(1,AlphaIndex2)=BS(AlphaIndex2);               
               GamaIndex1=randi(VarNumber);
               GamaIndex2=randi([1 VarNumber], GamaIndex1 , 1);
               NewParticle(2,:)=Particles(i,:);
               NewParticle(2,GamaIndex2)=X_NG(GamaIndex2);           
               NewParticle = max(NewParticle,VarMin);
               NewParticle = min(NewParticle,VarMax);  
               NewNEL(1,1)=CostFunction(NewParticle(1,:));
               NewNEL(2,1)=CostFunction(NewParticle(2,:));               
               FEs=FEs+2;    
           else               
               Ir=unifrnd(0,1,1,2); Jr=unifrnd(0,1,1,VarNumber);
               NewParticle(1,:)=Particles(i,:)+(Jr.*(Ir(1)*BS-Ir(2)*X_CP)/SL);
               Ir=unifrnd(0,1,1,2); Jr=unifrnd(0,1,1,VarNumber);
               NewParticle(2,:)=Particles(i,:)+(Jr.*(Ir(1)*BS-Ir(2)*X_NG));  
               NewParticle = max(NewParticle,VarMin);
               NewParticle = min(NewParticle,VarMax);
               NewNEL(1,1)=CostFunction(NewParticle(1,:));
               NewNEL(2,1)=CostFunction(NewParticle(2,:)); 
               FEs=FEs+2;   
           end    
       else 
           NewParticle(1,:)=Particles(i,:)+randn*SL*unifrnd(VarMin,VarMax,[1 VarNumber]);         
           NewParticle = max(NewParticle,VarMin);
           NewParticle = min(NewParticle,VarMax);
           NewNEL(1,1)=CostFunction(NewParticle(1,:));   
           FEs=FEs+1;
       end
   NewParticles=[NewParticles ; NewParticle];    
   NewNELs=[NewNELs ; NewNEL];
   end
   NewParticles=[NewParticles ; Particles];    
   NewNELs=[NewNELs ; NELs]; 
   
   % Sort Particles
   [NewNELs, SortOrder]=sort(NewNELs);
   NewParticles=NewParticles(SortOrder,:);
   BS=NewParticles(1,:); 
   BS_NEL=NewNELs(1); 
   WS_NEL=NewNELs(end);
   Particles=NewParticles(1:nParticles,:);
   NELs=NewNELs(1:nParticles,:);

   % Store Best Cost Ever Found
   BestCosts(Iter)=BS_NEL;
   
   % Show Iteration Information
   disp(['Iteration ' num2str(Iter) ': Best Cost = ' num2str(BestCosts(Iter))]);
end

Eval_Number=FEs;
Conv_History=BestCosts;
Best_Pos=BS;
Best_score=BestCosts(end);
end
%% Calculate the Euclidean Distance
function o = distance(a,b)
for i=1:size(a,1)
    o(1,i)=sqrt((a(i)-b(i))^2);
end
end

 下方小卡片回复关键词:2023,免费获取2023年智能优化算法合集matlab代码。

后续会继续发布2023年其他最新优化算法,敬请关注。

  • 0
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 8
    评论
SQL优化器是数据库管理系统中的一个重要组件,它负责解析和执行SQL语句,并选择最优的执行计划来提高查询性能。以下是一些常见的SQL优化技巧: 1. 索引优化:创建适当的索引可以大大提高查询性能。根据查询的列和条件,选择合适的索引类型(如B树索引、哈希索引等),并确保数据库表的统计信息是最新的。 2. 查询重写:有时候,一个复杂查询可以被重写为多个简单查询,从而减少查询的复杂度和执行时间。 3. 表分区:对于大型表,可以将其分成多个分区,使查询只针对特定的分区进行,从而提高查询效率。 4. 避免全表扫描:尽量避免使用不带索引的列进行过滤,这样会导致全表扫描。使用合适的索引可以避免这种情况。 5. 优化查询语句:仔细检查查询语句,确保没有多余的表连接、子查询或不必要的列。 6. 避免大事务:长时间运行的事务会占用数据库资源,并可能导致锁竞争。尽量将大事务拆分成小事务,以减少对数据库的负载。 7. 查询缓存:对于经常执行的查询,可以启用查询缓存,将查询结果缓存起来,避免重复执行相同的查询。 8. 硬件优化:通过增加内存、优化磁盘配置等方式,提高数据库服务器的硬件性能,从而加快查询执行速度。 需要注意的是,SQL优化是一个复杂的过程,需要结合具体的数据库环境和查询需求进行分析和调优。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

今天吃饺子

不想刀我的可以选择爱我

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值