【智能優(yōu)化算法】基于混沌權重和精英引導的鯨魚優(yōu)化算法(AWOA)求解單目標優(yōu)化問題附matlab代碼

1 簡介

針對鯨魚優(yōu)化算法(WOA)存在收斂精度低和收斂速度慢的問題,提出基于混沌權重和精英引導的先進鯨魚優(yōu)化算法(AWOA).考慮算法前期搜索的隨機性對收斂速度的影響,引入精英個體引導機制,利用精英個體的進化反饋信息及時調(diào)整種群的搜索方向,加強算法的全局搜索能力.在算法后期引入混沌動態(tài)權重因子加強算法的局部搜索能力,提高算法的收斂精度,對多個基準測試函數(shù)進行對比仿真實驗,結果表明:改進的鯨魚算法具有更高的尋優(yōu)性能.

WOA 是受鯨魚獨特的泡泡網(wǎng)覓食行為啟發(fā)而提出的,在自然界中,鯨魚通過隨機游走尋找獵物,當定位到獵物后,通過收縮螺旋包圍形成泡泡網(wǎng)攻擊獵物。通過模擬這種行為,基本的 WOA 包括三個階段: 游走搜索獵物、收縮包圍機制、螺旋包圍機制。

2 部分代碼

%_________________________________________________________________________%

% 鯨魚優(yōu)化算法? ? ? ? ? ? ?%

%_________________________________________________________________________%

% The Whale Optimization Algorithm

function [Leader_score,Leader_pos,Convergence_curve]=WOA(SearchAgents_no,Max_iter,lb,ub,dim,fobj)

% initialize position vector and score for the leader?

Leader_pos=zeros(1,dim);

Leader_score=inf; %change this to -inf for maximization problems

%Initialize the positions of search agents

Positions=initialization(SearchAgents_no,dim,ub,lb);

Convergence_curve=zeros(1,Max_iter);

t=0;% Loop counter

% Main loop

while t<Max_iter

? ? for i=1:size(Positions,1)


? ? ? ? % Return back the search agents that go beyond the boundaries of the search space

? ? ? ? Flag4ub=Positions(i,:)>ub;

? ? ? ? Flag4lb=Positions(i,:)<lb;

? ? ? ? Positions(i,:)=(Positions(i,:).*(~(Flag4ub+Flag4lb)))+ub.*Flag4ub+lb.*Flag4lb;


? ? ? ? % Calculate objective function for each search agent

? ? ? ? fitness=fobj(Positions(i,:));


? ? ? ? % Update the leader

? ? ? ? if fitness<Leader_score % Change this to > for maximization problem

? ? ? ? ? ? Leader_score=fitness; % Update alpha

? ? ? ? ? ? Leader_pos=Positions(i,:);

? ? ? ? end


? ? end


? ? a=2-t*((2)/Max_iter); % a decreases linearly fron 2 to 0 in Eq. (2.3)


? ? % a2 linearly dicreases from -1 to -2 to calculate t in Eq. (3.12)

? ? a2=-1+t*((-1)/Max_iter);


? ? % Update the Position of search agents?

? ? for i=1:size(Positions,1)

? ? ? ? r1=rand(); % r1 is a random number in [0,1]

? ? ? ? r2=rand(); % r2 is a random number in [0,1]


? ? ? ? A=2*a*r1-a;? % Eq. (2.3) in the paper

? ? ? ? C=2*r2;? ? ? % Eq. (2.4) in the paper



? ? ? ? b=1;? ? ? ? ? ? ? ?%? parameters in Eq. (2.5)

? ? ? ? l=(a2-1)*rand+1;? ?%? parameters in Eq. (2.5)


? ? ? ? p = rand();? ? ? ? % p in Eq. (2.6)


? ? ? ? for j=1:size(Positions,2)


? ? ? ? ? ? if p<0.5? ?

? ? ? ? ? ? ? ? if abs(A)>=1

? ? ? ? ? ? ? ? ? ? rand_leader_index = floor(SearchAgents_no*rand()+1);

? ? ? ? ? ? ? ? ? ? X_rand = Positions(rand_leader_index, :);

? ? ? ? ? ? ? ? ? ? D_X_rand=abs(C*X_rand(j)-Positions(i,j)); % Eq. (2.7)

? ? ? ? ? ? ? ? ? ? Positions(i,j)=X_rand(j)-A*D_X_rand;? ? ? % Eq. (2.8)


? ? ? ? ? ? ? ? elseif abs(A)<1

? ? ? ? ? ? ? ? ? ? D_Leader=abs(C*Leader_pos(j)-Positions(i,j)); % Eq. (2.1)

? ? ? ? ? ? ? ? ? ? Positions(i,j)=Leader_pos(j)-A*D_Leader;? ? ? % Eq. (2.2)

? ? ? ? ? ? ? ? end


? ? ? ? ? ? elseif p>=0.5


? ? ? ? ? ? ? ? distance2Leader=abs(Leader_pos(j)-Positions(i,j));

? ? ? ? ? ? ? ? % Eq. (2.5)

? ? ? ? ? ? ? ? Positions(i,j)=distance2Leader*exp(b.*l).*cos(l.*2*pi)+Leader_pos(j);


? ? ? ? ? ? end


? ? ? ? end

? ? end

? ? t=t+1;

? ? Convergence_curve(t)=Leader_score;

end

3 仿真結果

4 參考文獻

[1]黃輝先, 張廣炎, 陳思溢,等. 基于混沌權重和精英引導的鯨魚優(yōu)化算法[J]. 傳感器與微系統(tǒng), 2020, 39(5):4.

博主簡介:擅長智能優(yōu)化算法、神經(jīng)網(wǎng)絡預測、信號處理、元胞自動機、圖像處理、路徑規(guī)劃、無人機等多種領域的Matlab仿真,相關matlab代碼問題可私信交流。

部分理論引用網(wǎng)絡文獻,若有侵權聯(lián)系博主刪除。完整代碼獲取關注微信公眾號天天matlab

?著作權歸作者所有,轉載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容