%_________________________________________________________________________%
% Whale Optimization Algorithm (WOA) source codes demo 1.0 %
% %
% Developed in MATLAB R2011b(7.13) %
% %
% Author and programmer: Seyedali Mirjalili %
% %
% e-Mail: ali.mirjalili@gmail.com %
% seyedali.mirjalili@griffithuni.edu.au %
% %
% Homepage: http://www.alimirjalili.com %
% %
% Main paper: S. Mirjalili, A. Lewis %
% The Whale Optimization Algorithm, %
% Advances in Engineering Software , in press, %
% DOI: http://dx.doi.org/10.1016/j.advengsoft.2016.01.008 %
% %
%_________________________________________________________________________%
% The Whale Optimization Algorithm
function [Best_Cost,Best_pos,curve]=WOA(pop,Max_iter,lb,ub,dim,fobj)
% initialize position vector and score for the leader
Best_pos=zeros(1,dim);
Best_Cost=inf; %change this to -inf for maximization problems
%Initialize the positions of search agents
Positions=initialization(pop,dim,ub,lb);
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<Best_Cost % Change this to > for maximization problem
Best_Cost=fitness; % Update alpha
Best_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(pop*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*Best_pos(j)-Positions(i,j)); % Eq. (2.1)
Positions(i,j)=Best_pos(j)-A*D_Leader; % Eq. (2.2)
end
elseif p>=0.5
distance2Leader=abs(Best_pos(j)-Positions(i,j));
% Eq. (2.5)
Positions(i,j)=distance2Leader*exp(b.*l).*cos(l.*2*pi)+Best_pos(j);
end
end
end
t=t+1;
curve(t)=Best_Cost;
[t Best_Cost]
end
鲸鱼算法(WOA)优化极限学习机(ELM)的分类预测,多特征输入模型 WOA-ELM分类预测模型 多特征输入单输出的二分类及
需积分: 0 86 浏览量
更新于2023-09-24
收藏 75KB ZIP 举报
鲸鱼算法(WOA)优化极限学习机(ELM)的分类预测,多特征输入模型。WOA-ELM分类预测模型。
多特征输入单输出的二分类及多分类模型。程序内注释详细,直接替换数据就可以用。
程序语言为matlab,程序可出分类效果图,迭代优化图,混淆矩阵图。
智能算法及其模型预测
- 粉丝: 2535
- 资源: 871
最新资源
- Labview仪器开发,2路模拟量采集,8路IO口输入输出,标准信号源,带详细Labview示例程序,可以快速开发仪器
- MATLAB代码:基于滚动优化的大规模电动汽车随机充放电策略优化 关键词:电动汽车充放电优化 电动汽车 滚动优化 充放电策略 参考文档:Optimal Scheduling for Chargi
- 流水线全套仿真方案,包含PLC、HMI程序和工厂仿真界面 完美仿真流水线电气和机械动作,物料流转,信息传递
- 14、只需一部手机就能月入过万的影视剪辑项目,操作简单,搬运即可.pdf
- 12、今日头条的问答有收入吗?教你操作问答月入过万!.pdf
- 恒功率负载下Buck变器的建模与控制simulink仿真文件 现代控制理论 附赠参考文献 另有一份word或PDF报告
- 基于C#语言的FreeSql设计源码,支持多种数据库ORM解决方案
- 35、无人直播项目详细操作步骤分解,能赚多少你进来看看.pdf
- 38、爱奇艺联盟无脑搬砖项目,可配合操作CPS.pdf
- 41、如何利用youtube躺赚美元,奇葩玩法也能年赚百万元.pdf
- 47、互联网月入3万的细分领域玩法,学会后立马突破瓶颈.pdf
- 49、做网站实现一单利润数十万的玩法.pdf
- 西门子PLC动态密码程序,1200PLC和1500PLC通用,催款程序,动态密保,底层使用SCL写的,并且录制了视频讲解,详细介绍了程序编写的思路和画面操作步骤,非常值得拥有
- 58、录制软件类安装视频教程,月入万元.pdf
- 61、电脑重装系统,被我们忽视的零成本创业项目项目.pdf
- 60、卖电脑怎么赚钱?组装电脑信息差年赚50W+.pdf