目录
💥1 概述
鲸鱼优化算法(Whale Optimization Algorithm)是一种新兴的智能优化算法,在2016年提出。算法灵感来源于鲸鱼围捕猎物的行为。鲸鱼在捕猎过程中采用包围猎物与环形游动喷出气泡网来驱赶猎物两种方式进行捕猎。选取Sphere函数作为测试基函数,比较鲸鱼优化算法WOA与遗传算法GA、粒子群算法PSO的寻优性能,从结果图可以看到,鲸鱼算法具有较好的全局搜索性能。
📚2 运行结果
🎉3 参考文献
[1]王镱嬴. 基于改进鲸鱼算法的神经网络预测模型的研究[D].辽宁科技大学,2020.DOI:10.26923/d.cnki.gasgc.2020.000271.
👨💻4 Matlab代码
主函数部分代码:
clear all
clc
% parameters for the WOA algorithm
SearchAgents_no = 30; % Number of search agents
Max_iter = 500; % Maximum number of iterations
% parameters for simulations
I = 4; % number of users
Pc = 0.1*1e-3; % circuit power consumption
varrho = 1; % power-amplifier inefficiency factor
n0 = 0.1*1e-6; % noise power
pMax = 1e-3*[0.7 0.8 0.9 1]; % max transmit power
pMin = zeros(1, I); % min transmit power
stopEps = 1e-3; % stopping criterion
r_req = 0.8; % minimum rate requirement
gArray = [0.4310 0.0002 0.0129 0.0011;
0.0002 0.3018 0.0005 0.0031;
0.2605 0.0008 0.4266 0.0099;
0.0039 0.0054 0.1007 0.0634];
diagGArray = reshape(diag(gArray),1,I);
% d_EV = 10*rand(1,I). Random links are created in a 10m-by-10m area
d_EV = [4.1454, 3.6180, 6.4587, 4.9546];
gArray_EV = d_EV.^-4;
% =========================================================================
% =============================== EXAMPLE 1 ===============================
% =========================================================================
% Load details of the selected benchmark function for the WOA algorithm
Function_name = 'Ex1';
p_Max = 10e-3*ones(1,I);
p_Min = 1e-10*ones(1,I);
% WOA-based Algorithm
[lb, ub, dim, fobj] = Get_Functions_details(Function_name, I, p_Max, p_Min, gArray, Pc, varrho, n0, r_req, gArray_EV);
[Best_score, Best_pos, WOA_cg_curve] = WOA(SearchAgents_no, Max_iter, lb, ub, dim, fobj);
display(['The best solution obtained by WOA is : ', num2str(Best_pos)]);
display(['The best optimal value of the objective funciton found by WOA is : ', num2str(Best_score)]);
% Path-following procedure (PFP)
[~, Phi, ~] = PFP( I, p_Max, p_Min, n0, gArray, gArray_EV, stopEps);
% ============================== plot figures =============================
i = 0;
% Plot the figure - the curve of min secrecy throughput
figure(5*i + 1)
hold on
plot(0:length(WOA_cg_curve), [0 WOA_cg_curve], 'r-p', 'linewidth', 4.0, 'markers', 16);
plot(0:length(Phi), [0 Phi'], 'b-d', 'linewidth', 4.0, 'markers', 16);
xticks = 0:2:length(WOA_cg_curve);
set(gca,'xtick',xticks);
set(gca,'FontSize',30,'XLim',[0 length(WOA_cg_curve)]);
xlabel('Iteration');
ylabel('Min secrecy throughput(bps/Hz)');
legend('WOA-based Alg','Path-Following Procedure');
box on;