function[Best_score,Best_pos,POA_curve]=POA(SearchAgents,Max_iterations,lowerbound,upperbound,dimension,fitness)
lowerbound=ones(1,dimension).*(lowerbound); % Lower limit for variables
upperbound=ones(1,dimension).*(upperbound); % Upper limit for variables
%% INITIALIZATION
for i=1:dimension
X(:,i) = lowerbound(i)+rand(SearchAgents,1).*(upperbound(i) - lowerbound(i)); % Initial population
end
for i =1:SearchAgents
L=X(i,:);
fit(i)=fitness(L);
end
%%
for t=1:Max_iterations
t
%% update the best condidate solution
[best , location]=min(fit);
if t==1
Xbest=X(location,:); % Optimal location
fbest=best; % The optimization objective function
elseif best<fbest
fbest=best;
Xbest=X(location,:);
end
%% UPDATE location of food
X_FOOD=[];
k=randperm(SearchAgents,1);
X_FOOD=X(k,:);
F_FOOD=fit(k);
%%
for i=1:SearchAgents
%% PHASE 1: Moving towards prey (exploration phase)
I=round(1+rand(1,1));
if fit(i)> F_FOOD
X_new=X(i,:)+ rand(1,1).*(X_FOOD-I.* X(i,:)); %Eq(4)
else
X_new=X(i,:)+ rand(1,1).*(X(i,:)-1.*X_FOOD); %Eq(4)
end
X_new= max(X_new,lowerbound);X_new = min(X_new,upperbound);
% Updating X_i using (5)
f_new = fitness(X_new);
if f_new <= fit (i)
X(i,:) = X_new;
fit (i)=f_new;
end
%% END PHASE 1: Moving towards prey (exploration phase)
%% PHASE 2: Winging on the water surface (exploitation phase)
X_new=X(i,:)+0.2*(1-t/Max_iterations).*(2*rand(1,dimension)-1).*X(i,:);% Eq(6)
X_new= max(X_new,lowerbound);X_new = min(X_new,upperbound);
% Updating X_i using (7)
f_new = fitness(X_new);
if f_new <= fit (i)
X(i,:) = X_new;
fit (i)=f_new;
end
%% END PHASE 2: Winging on the water surface (exploitation phase)
end
best_so_far(t)=fbest;
average(t) = mean (fit);
end
Best_score=fbest;
Best_pos=Xbest;
POA_curve=best_so_far;
end
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
7 POA-RBF - 2.zip (6个子文件)
fobj.m 766B
initialization.m 584B
main.m 1KB
POA.m 2KB
levy.m 703B
data.xlsx 36KB
共 6 条
- 1
资源评论
智能算法及其模型预测
- 粉丝: 2363
- 资源: 871
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功