一、人工旅鼠優化算法
人工旅鼠算法(Artificial Lemming Algorithm, ALA)是2025年提出的一種新型生物啟發式優化算法,受旅鼠的四種典型行為啟發:長距離遷徙、挖洞、覓食和躲避捕食者。該算法通過模擬這些行為來解決復雜的優化問題,具有較強的探索和開發能力。人工旅鼠優化算法(ALA )是2025年發表于SCITop期刊《Artificial Intelligence Review》的一種新型元啟發式算法(智能優化算法) 。其靈感來源于旅鼠在自然界中的四種行為:長途遷徙、挖洞、覓食和躲避捕食者。該算法通過對這四種行為進行數學建模,實現對問題的優化求解,在保持計算效率的同時更好地平衡勘探和開發,能有效應對過早收斂、探索不足以及在高維、非凸搜索空間中缺乏穩健性等挑戰。
旅鼠是一種小型嚙齒動物,主要分布在北極地區。當旅鼠數量過多導致食物短缺時,會進行長距離遷徙;它們會在棲息地挖洞,形成隧道用于儲存食物和躲避威脅;在洞穴內,旅鼠會憑借敏銳感官覓食;遇到危險時,旅鼠會逃回洞穴并做出欺騙性動作躲避捕食者。ALA算法分別對這四種行為建模,長距離遷移和挖洞行為用于搜索空間的勘探,覓食和躲避捕食者行為用于開發利用已搜索的空間 。并且采用能量降低機制,動態調整勘探和開發之間的平衡,增強算法逃避局部最優值并收斂到全局解決方案的能力。
算法原理
ALA 主要模擬旅鼠的以下四種行為:
- 長距離遷徙 (Exploration):模擬旅鼠在食物短缺時進行的長距離遷徙,用于探索新的搜索空間。
- 挖洞 (Exploration):模擬旅鼠挖掘洞穴的行為,用于在當前區域進行局部探索。
- 覓食 (Exploitation):模擬旅鼠在洞穴附近覓食的行為,用于開發當前已知的優質區域。
- 躲避捕食者 (Exploitation):模擬旅鼠在遇到捕食者時的逃避行為,用于進一步開發當前最優解附近的區域。
算法數學模型
初始化
初始化種群位置:
Z ? = [ z 1 , 1 z 1 , 2 … z 1 , D i m z 2 , 1 z 2 , 2 … z 2 , D i m ? ? ? ? z N , 1 z N , 2 … z N , D i m ] \vec{Z} = \begin{bmatrix} z_{1,1} & z_{1,2} & \dots & z_{1,Dim} \\ z_{2,1} & z_{2,2} & \dots & z_{2,Dim} \\ \vdots & \vdots & \ddots & \vdots \\ z_{N,1} & z_{N,2} & \dots & z_{N,Dim} \end{bmatrix} Z= ?z1,1?z2,1??zN,1??z1,2?z2,2??zN,2??……?…?z1,Dim?z2,Dim??zN,Dim?? ?
其中,每個維度的初始位置計算為:
z i , j = L B j + rand × ( U B j ? L B j ) z_{i,j} = LB_j + \text{rand} \times (UB_j - LB_j) zi,j?=LBj?+rand×(UBj??LBj?)
長距離遷徙
長距離遷徙模型:
Z ? i ( t + 1 ) = Z ? best ( t ) + F × B M → × ( R ? × ( Z ? best ( t ) ? Z ? i ( t ) ) + ( 1 ? R ? ) × ( Z ? i ( t ) ? Z ? a ( t ) ) ) \vec{Z}_i(t+1) = \vec{Z}_{\text{best}}(t) + F \times \overrightarrow{BM} \times \left( \vec{R} \times (\vec{Z}_{\text{best}}(t) - \vec{Z}_i(t)) + (1 - \vec{R}) \times (\vec{Z}_i(t) - \vec{Z}_a(t)) \right) Zi?(t+1)=Zbest?(t)+F×BM×(R×(Zbest?(t)?Zi?(t))+(1?R)×(Zi?(t)?Za?(t)))
其中:
- F F F 是方向標志,計算為:
F = { 1 if? ? 2 × rand + 1 ? = 1 ? 1 if? ? 2 × rand + 1 ? = 2 F = \begin{cases} 1 & \text{if } \lfloor 2 \times \text{rand} + 1 \rfloor = 1 \\ -1 & \text{if } \lfloor 2 \times \text{rand} + 1 \rfloor = 2 \end{cases} F={1?1?if??2×rand+1?=1if??2×rand+1?=2? - B M → \overrightarrow{BM} BM 是布朗運動向量,服從標準正態分布:
f B M ( x ; 0 , 1 ) = 1 2 π × exp ? ( ? x 2 2 ) f_{BM}(x; 0, 1) = \frac{1}{\sqrt{2\pi}} \times \exp\left(-\frac{x^2}{2}\right) fBM?(x;0,1)=2π?1?×exp(?2x2?) - R ? \vec{R} R 是一個隨機向量,計算為:
R ? = 2 × rand ( 1 , Dim ) ? 1 \vec{R} = 2 \times \text{rand}(1, \text{Dim}) - 1 R=2×rand(1,Dim)?1
挖洞
挖洞模型:
Z ? i ( t + 1 ) = Z ? i ( t ) + F × L × ( Z ? best ( t ) ? Z ? b ( t ) ) \vec{Z}_i(t+1) = \vec{Z}_i(t) + F \times L \times (\vec{Z}_{\text{best}}(t) - \vec{Z}_b(t)) Zi?(t+1)=Zi?(t)+F×L×(Zbest?(t)?Zb?(t))
其中, L L L 是一個與當前迭代次數相關的隨機數,計算為:
L = rand × ( 1 + sin ? ( t 2 ) ) L = \text{rand} \times \left(1 + \sin\left(\frac{t}{2}\right)\right) L=rand×(1+sin(2t?))
覓食
覓食模型:
Z ? i ( t + 1 ) = Z ? best ( t ) + F × spiral × rand × Z ? i ( t ) \vec{Z}_i(t+1) = \vec{Z}_{\text{best}}(t) + F \times \text{spiral} \times \text{rand} \times \vec{Z}_i(t) Zi?(t+1)=Zbest?(t)+F×spiral×rand×Zi?(t)
其中, spiral \text{spiral} spiral 是螺旋形狀因子,計算為:
spiral = radius × ( sin ? ( 2 π × rand ) + cos ? ( 2 π × rand ) ) \text{spiral} = \text{radius} \times \left(\sin(2\pi \times \text{rand}) + \cos(2\pi \times \text{rand})\right) spiral=radius×(sin(2π×rand)+cos(2π×rand))
radius \text{radius} radius 是覓食范圍的半徑,計算為:
radius = ∑ j = 1 Dim ( z best , j ( t ) ? z i , j ( t ) ) 2 \text{radius} = \sqrt{\sum_{j=1}^{\text{Dim}} \left(z_{\text{best},j}(t) - z_{i,j}(t)\right)^2} radius=j=1∑Dim?(zbest,j?(t)?zi,j?(t))2?
躲避捕食者
躲避捕食者模型:
Z ? i ( t + 1 ) = Z ? best ( t ) + F × G × Levy ( Dim ) × ( Z ? best ( t ) ? Z ? i ( t ) ) \vec{Z}_i(t+1) = \vec{Z}_{\text{best}}(t) + F \times G \times \text{Levy}(\text{Dim}) \times (\vec{Z}_{\text{best}}(t) - \vec{Z}_i(t)) Zi?(t+1)=Zbest?(t)+F×G×Levy(Dim)×(Zbest?(t)?Zi?(t))
其中, G G G 是逃避系數,計算為:
G = 2 × ( 1 ? t T max ) G = 2 \times \left(1 - \frac{t}{T_{\text{max}}}\right) G=2×(1?Tmax?t?)
Levy ( ? ) \text{Levy}(\cdot) Levy(?) 是萊維飛行函數,計算為:
Levy ( x ) = 0.01 × u × σ ∥ ν ∥ 1 β \text{Levy}(x) = 0.01 \times \frac{u \times \sigma}{\|\nu\|^{\frac{1}{\beta}}} Levy(x)=0.01×∥ν∥β1?u×σ?
其中, u u u 和 ν \nu ν 是隨機數, β = 1.5 \beta = 1.5 β=1.5。
能量因子
能量因子 E ( t ) E(t) E(t) 用于平衡探索和開發:
E ( t ) = 4 × arctan ? ( 1 ? t T max ) × ln ? ( 1 rand ) E(t) = 4 \times \arctan\left(1 - \frac{t}{T_{\text{max}}}\right) \times \ln\left(\frac{1}{\text{rand}}\right) E(t)=4×arctan(1?Tmax?t?)×ln(rand1?)
算法流程
- 初始化:設置種群大小 N N N,最大迭代次數 T max T_{\text{max}} Tmax?,問題維度 Dim \text{Dim} Dim,并隨機初始化種群位置。
- 迭代:在每次迭代中,根據能量因子 E ( t ) E(t) E(t) 判斷當前是探索階段還是開發階段。
- 如果 E ( t ) > 1 E(t) > 1 E(t)>1,執行長距離遷徙或挖洞行為。
- 如果 E ( t ) ≤ 1 E(t) \leq 1 E(t)≤1,執行覓食或躲避捕食者行為。
- 更新位置:根據上述模型更新每個搜索代理的位置。
- 評估適應度:計算每個搜索代理的適應度值,并更新當前最優解。
- 終止條件:如果達到最大迭代次數或滿足其他終止條件,輸出最優解。
算法優缺點
- 優點:ALA 具有較強的探索和開發能力,能夠有效避免局部最優,適用于高維和復雜的優化問題。
- 缺點:對參數設置較為敏感,理論保證不足,處理某些復雜函數時仍有提升空間。
參考文獻:
[1]Xiao, Y., Cui, H., Khurma, R.A. et al. Artificial lemming algorithm: a novel bionic meta-heuristic technique for solving real-world engineering optimization problems. Artif Intell Rev 58, 84 (2025). https://doi.org/10.1007/s10462-024-11023-7
二、23個函數介紹
參考文獻:
[1] Yao X, Liu Y, Lin G M. Evolutionary programming made faster[J]. IEEE transactions on evolutionary computation, 1999, 3(2):82-102.
三、部分代碼及結果
clear;
clc;
close all;
warning off all;SearchAgents_no=50; %Number of search solutions
Max_iteration=500; %Maximum number of iterationsFunc_name='F1'; % Name of the test function% Load details of the selected benchmark function
[lb,ub,dim,fobj]=Get_F(Func_name); tic;
[Best_score,Best_pos,cg_curve]=SGA(SearchAgents_no,Max_iteration,lb,ub,dim,fobj);
tend=toc;% figure('Position',[500 500 901 345])
%Draw search space
subplot(1,2,1);
func_plot(Func_name);
title('Parameter space')
xlabel('x_1');
ylabel('x_2');
zlabel([Func_name,'( x_1 , x_2 )'])%Draw objective space
subplot(1,2,2);
semilogy(cg_curve,'Color','m',LineWidth=2.5)
title(Func_name)% title('Objective space')
xlabel('Iteration');
ylabel('Best score obtained so far');axis tight
grid on
box on
legend('SGA')display(['The running time is:', num2str(tend)]);
display(['The best fitness is:', num2str(Best_score)]);
display(['The best position is: ', num2str(Best_pos)]);