% -----------------------------------------------------------------------------------------------------------
% Dung Beetle Optimizer: (DBO) (demo)
% Programmed by Jian-kai Xue
% Updated 28 Nov. 2022.
%
% This is a simple demo version only implemented the basic
% idea of the DBO for solving the unconstrained problem.
% The details about DBO are illustratred in the following paper.
% (To cite this article):
% Jiankai Xue & Bo Shen (2022) Dung beetle optimizer: a new meta-heuristic
% algorithm for global optimization. The Journal of Supercomputing, DOI:
% 10.1007/s11227-022-04959-6
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% qq此│869592172
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [bestX, fMin , Convergence_curve ] = DBO(pop, M,c,d,dim,fobj )
P_percent = 0.2; % The population size of producers accounts for "P_percent" percent of the total population size
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
pNum = round( pop * P_percent ); % The population size of the producers
lb= c.*ones( 1,dim ); % Lower limit/bounds/ a vector
ub= d.*ones( 1,dim ); % Upper limit/bounds/ a vector
%Initialization
for i = 1 : pop
x( i, : ) = lb + (ub - lb) .* rand( 1, dim );
fit( i ) = fobj( x( i, : ) ) ;
end
pFit = fit;
pX = x;
XX=pX;
[ fMin, bestI ] = min( fit ); % fMin denotes the global optimum fitness value
bestX = x( bestI, : ); % bestX denotes the global optimum position corresponding to fMin
% Start updating the solutions.
for t = 1 : M
[fmax,B]=max(fit);
worse= x(B,:);
r2=rand(1);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for i = 1 : pNum
if(r2<0.9)
r1=rand(1);
a=rand(1,1);
if (a>0.1)
a=1;
else
a=-1;
end
x( i , : ) = pX( i , :)+0.3*abs(pX(i , : )-worse)+a*0.1*(XX( i , :)); % Equation (1)
else
aaa= randperm(180,1);
if ( aaa==0 ||aaa==90 ||aaa==180 )
x( i , : ) = pX( i , :);
end
theta= aaa*pi/180;
x( i , : ) = pX( i , :)+tan(theta).*abs(pX(i , : )-XX( i , :)); % Equation (2)
end
x( i , : ) = Bounds( x(i , : ), lb, ub );
fit( i ) = fobj( x(i , : ) );
end
[ fMMin, bestII ] = min( fit ); % fMin denotes the current optimum fitness value
bestXX = x( bestII, : ); % bestXX denotes the current optimum position
R=1-t/M; %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Xnew1 = bestXX.*(1-R);
Xnew2 =bestXX.*(1+R); %%% Equation (3)
Xnew1= Bounds( Xnew1, lb, ub );
Xnew2 = Bounds( Xnew2, lb, ub );
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Xnew11 = bestX.*(1-R);
Xnew22 =bestX.*(1+R); %%% Equation (5)
Xnew11= Bounds( Xnew11, lb, ub );
Xnew22 = Bounds( Xnew22, lb, ub );
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for i = ( pNum + 1 ) :12 % Equation (4)
x( i, : )=bestXX+((rand(1,dim)).*(pX( i , : )-Xnew1)+(rand(1,dim)).*(pX( i , : )-Xnew2));
x(i, : ) = Bounds( x(i, : ), Xnew1, Xnew2 );
fit(i ) = fobj( x(i,:) ) ;
end
for i = 13: 19 % Equation (6)
x( i, : )=pX( i , : )+((randn(1)).*(pX( i , : )-Xnew11)+((rand(1,dim)).*(pX( i , : )-Xnew22)));
x(i, : ) = Bounds( x(i, : ),lb, ub);
fit(i ) = fobj( x(i,:) ) ;
end
for j = 20 : pop % Equation (7)
x( j,: )=bestX+randn(1,dim).*((abs(( pX(j,: )-bestXX)))+(abs(( pX(j,: )-bestX))))./2;
x(j, : ) = Bounds( x(j, : ), lb, ub );
fit(j ) = fobj( x(j,:) ) ;
end
% Update the individual's best fitness vlaue and the global best fitness value
XX=pX;
for i = 1 : pop
if ( fit( i ) < pFit( i ) )
pFit( i ) = fit( i );
pX( i, : ) = x( i, : );
end
if( pFit( i ) < fMin )
% fMin= pFit( i );
fMin= pFit( i );
bestX = pX( i, : );
% a(i)=fMin;
end
end
Convergence_curve(t)=fMin;
end
% Application of simple limits/bounds
function s = Bounds( s, Lb, Ub)
% Apply the lower bound vector
temp = s;
I = temp < Lb;
temp(I) = Lb(I);
% Apply the upper bound vector
J = temp > Ub;
temp(J) = Ub(J);
% Update this new move
s = temp;
function S = Boundss( SS, LLb, UUb)
% Apply the lower bound vector
temp = SS;
I = temp < LLb;
temp(I) = LLb(I);
% Apply the upper bound vector
J = temp > UUb;
temp(J) = UUb(J);
% Update this new move
S = temp;
%---------------------------------------------------------------------------------------------------------------------------
没有合适的资源?快使用搜索试试~ 我知道了~
【UAV路径优化】基于蜣螂优化算法的无人机航迹规划-路径规划(带障碍环境)【matlab代码】
共8个文件
m:8个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
5星 · 超过95%的资源 11 下载量 17 浏览量
2023-06-02
23:05:28
上传
评论 4
收藏 8KB RAR 举报
温馨提示
- 基于DBO的无人机航迹规划,可更换其他群智能算法 - 带障碍地形 - 附带说明 - 有注释 以下是一些学习matlab的经验:1. 开始学习MATLAB之前,建议你阅读官方提供的MATLAB文档和教程,了解MATLAB的基本语法、变量和操作符等。2. MATLAB支持不同类型的数据,包括数字、字符串、矩阵和结构体等。学习如何创建、操作和处理这些数据类型是很重要的。3. MATLAB官方网站上有大量的示例和教程,可以帮助你学习各种MATLAB功能和应用。你可以按照这些示例逐步学习和实践。
资源推荐
资源详情
资源评论
收起资源包目录
基于蜣螂优化算法的无人机航迹规划(有障碍威胁环境).rar (8个子文件)
基于蜣螂优化算法的无人机航迹规划(有障碍威胁环境)
initialization.m 343B
main.m 2KB
IsPathOk.m 2KB
MapValueFunction.m 630B
fun.m 1KB
GetThePathLine.m 2KB
CreateValidPath.m 2KB
DBO.m 5KB
共 8 条
- 1
天`南
- 粉丝: 1282
- 资源: 198
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
前往页