zl程序教程

您现在的位置是:首页 >  后端

当前栏目

智能优化算法:白冠鸡优化算法-附代码

2023-09-14 09:06:12 时间

智能优化算法:白冠鸡优化算法


摘要:白冠鸡优化算法(Coot optimization algorithm,COOT),是2021年提出的一种新型智能优化算法,算法主要模拟了白冠鸡在水中的两种不同运动模式,因在测试中试验结果良好,故在未来具有广泛的应用前景。

1.算法原理

在算法中,白冠鸡的行为主要包含以下四种:(1).个体随机移动;(2).链式运动;(3).根据组长调整位置;(4) 由组长带领种群走向最佳区域

1.1 个体随机移动

在种群初始化后,考虑到随机移动这一行为,作者首先选定了一个随机位置作为参照:
Q = r a n d ( 1 , d ) ∗ ( u b − l b ) + l b (1) Q=rand(1,d)*(ub-lb)+lb \tag{1} Q=rand(1,d)(ublb)+lb(1)
式中ub、lb分别为搜索空间的上、下限。随机运动使得算法能够对搜索空间进行充分的探索,因此如果算法陷入局部最优,这种行为将帮助算法及时跳出。个体的新位置更新方式为:
C o o t P o s ( i ) = C o o t P o s ( i ) + A ∗ R 2 ∗ ( Q − C o o t P o s ( i ) ) (2) CootPos(i)=CootPos(i)+A*R2*(Q-CootPos(i))\tag{2} CootPos(i)=CootPos(i)+AR2(QCootPos(i))(2)
这里R2为[0,1]内一随机值,A的更新方式为:
A = 1 − L 1 I t e r (3) A=1-L\frac{1}{Iter} \tag{3} A=1LIter1(3)
其中L为当前迭代次数,Iter为最大迭代次数。

1.2 链式运动

使用两个体的平均位置来执行链运动:
C o o t P o s ( i ) = 0.5 ∗ ( C o o t P o s ( i − 1 ) + C o o t P o s ( i ) ) (4) CootPos(i)=0.5*(CootPos(i-1)+CootPos(i)) \tag{4} CootPos(i)=0.5(CootPos(i1)+CootPos(i))(4)

1.3 根据组长调整位置

通常情况下,种群由种群前面的几个白冠鸡领导,其他白冠鸡必须根据小组领导调整位置并向他们移动。

文中,利用机制K来控制位置引导作用:
K = 1 + ( i M O D   N L ) (5) K=1+(iMOD\,NL) \tag{5} K=1+(iMODNL)(5)
式中i 为当前个体的序号,NL为白冠鸡的数量,K 就是与个体i 对应的鸡的序号。于是个体的位置更新如下:
C o o t P o s ( i ) = L e a d e r P o s ( k ) + 2 ∗ R 1 ∗ c o s ( 2 R π ) ∗ ( L e a d e r P o s ( k ) − C o o t P o s ( i ) ) (6) CootPos(i)=LeaderPos(k)+2*R1*cos(2R\pi)*(LeaderPos(k)-CootPos(i))\tag{6} CootPos(i)=LeaderPos(k)+2R1cos(2Rπ)(LeaderPos(k)CootPos(i))(6)
其中, L e a d e r P o s ( k ) LeaderPos(k) LeaderPos(k)即为领导鸡 k k k位置,R1为[0,1]内一随机数,R为[-1,1]内一随机数。

1.4 由组长带领种群走向最佳区域

团队必须朝着一个目标(最佳区域)前进,因此领导者需要更新他们对目标的位置。具体更新方式如下:
L e a d e r P o s ( i ) = { B ∗ R 3 ∗ c o s ( 2 R π ) ∗ ( g B e s t − L e a d e r P o s ( i ) ) + g B e s t , R 4 < 0.5 B ∗ R 3 ∗ c o s ( 2 R π ) ∗ ( g B e s t − L e a d e r P o s ( i ) ) − g B e s t , e l s e (7) LeaderPos(i)=\begin{cases} B*R3*cos(2R\pi)*(gBest-LeaderPos(i))+gBest,R4<0.5\\ B*R3*cos(2R\pi)*(gBest-LeaderPos(i))-gBest,else \end{cases}\tag{7} LeaderPos(i)={BR3cos(2Rπ)(gBestLeaderPos(i))+gBest,R4<0.5BR3cos(2Rπ)(gBestLeaderPos(i))gBest,else(7)
式中gBest为种群内最优个体的位置,谓之鸡王之王;R3、R4均为[0,1]内的随机数,R为[-1,1]内的随机数。B的计算方式为:
B = 2 − L 1 I t e r (8) B=2-L\frac{1}{Iter} \tag{8} B=2LIter1(8)
算法伪代码

Initialize the first population of coots randomly ,Initialize the prameters of P=0.5,NL(number of leaders),Ncoot(number of coots)
Random selection of leaders from the coots
calulate the fitness of coots and leaders
Find the best coot or leader as the Global optimum(gBest)
While the end criterion is not satisfied
Calculate A,B parameters by Eq(3) ,(8)
If rand<p
	R,R1,and R3 are random vectors along the dimensions of the problem
else
	R,R1,and R3 are random number
end
for i = 1 to the number of the coots
	calculate the parameter of K by Eq(5)
	if rand>0.5
		update the positon of coot by Eq(6)
	else
			if rand<0.5 i~=1
				update the postion of the coot by Eq(4)
			else
				update the postion of the coot by Eq(2)
			end
	end
	Calculate the fitness of coot
	if the fitness of coot< the fitness of leader(k)
		Temp = leader(k);leader(k)=coot;coot=Temp;
	end
end
for number of Leaders
		update the positon of the Leader by Eq(7)
end
if the fitness of leader <gBest
	Temp = gBest;gBest = leader;leader=Temp;
end
end
Iter =Iter+1
end

2.实验结果

请添加图片描述

3.参考文献

[1] Naruei I , Keynia F . A New Optimization Method Based on Coot Bird Natural Life Model[J]. Expert Systems with Applications, 2021, 183(2):115352.

4.Matlab代码