1 簡介
本文針對一些 CEC 數值優化基準函數和混合可再生能源系統 (HRES) 工程問題,對稱為氣味代理優化 (SAO) 的新元啟發式算法進行了廣泛研究。 SAO 實作了氣味代理和蒸發氣味分子的對象之間的關系。這些關系被模組化為三種獨立的模式,稱為嗅探模式、尾随模式和随機模式。當氣味分子從氣味源向代理擴散時,嗅探模式模拟代理的氣味感覺能力。尾随模式模拟代理跟蹤氣味分子的一部分直到其來源被識别的能力。然而,随機模式是代理用來避免陷入局部最小值的一種政策。對 37 個常用的 CEC 基準函數和 HRES 工程問題進行了測試,并将結果與其他 6 種元啟發式方法進行了比較。實驗結果表明,SAO 可以在 76% 的基準函數中找到全局最優值。同樣,統計結果表明,與基準算法相比,SAO 也獲得了最具成本效益的 HRES 設計。
2 部分代碼
%__________________________________________
% myCost = @YourCostFunction
% dim = number of your variables
% Max_Iter = maximum number of generations
% nMole = number of search agents
% lb=[lb1,lb2,...,lbn] where lbn is the lower bound of variable n
% ub=[ub1,ub2,...,ubn] where ubn is the upper bound of variable n
% If all the variables have equal lower bound you can just
% define lb and ub as two single number numbers
% To run SAO: [Best_score,Best_mole,Convergence]=SAO(nMole,Max_Iter,lb,ub,dim,fobj);
%__________________________________________
clear all
close all
clc
format long
nMole=50; % Number of search agents
F_name='F4'; % Selecte Benchmark Function
Max_Iter=200; % Maximum numbef of iterations
run=1;
% Load Function Details
[lb,ub,dim,myCost]=Select_Function(F_name);
for k=1:run
[Best_score,Best_mole,Convergence]=SAO(nMole,Max_Iter,lb,ub,dim,myCost);
Best_score(k,:)=Best_score;
end
Best=min(Best_score)
% Worst=max(Best_score)
% Average=mean(Best_score)
% STD=std(Best_score)
figure('Position',[500 500 660 290])
%Draw objective space
subplot(1,2,2);
semilogy(Convergence,'Color','r','linewidth',2)
title('Objective space')
xlabel('Iteration');
ylabel('Best score obtained so far');
axis tight
grid on
box on
legend('SAO')
%Draw function in hyperspace
subplot(1,2,1);
func_plot(F_name);
title('Parameter space')
xlabel('x_1');
ylabel('x_2');
zlabel([F_name,'( x_i , x_j )'])