clc;
clear all;
close all;
%----------------------------------------------------
% provided by www.onlinesim.ir
%----------------------------------------------------
for zz=1:1
tic
clc
% F_idx=14
main_run=zz
GBEST=[];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
n_swarm=100; %%%%%%%%%%%%%%%%%%% number of initial population
iter=300; %%%%%%%%%%%%%%%%%%% number of iteration
c1=2;
c2=2;
w=0.8;
dim=17;
min_var=[-1*ones(1,10)];
max_var=[1*ones(1,10)];
D=length(max_var); %%%%% number of variable %%%%%%%%%%%%%%%%%
Nparam=D;
[s,n_var]=size(max_var);
upper_v=.2.*max_var;
lower_v=-.2.*max_var;
m=n_swarm;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for i=1:n_swarm
[pop]=population(1,D,min_var,max_var);
[pop_cost(i,:)]=goal_function(pop,1,D);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
pop;
pop_cost;
pop_cost_sort=sortrows(pop_cost,n_var+1);
g_best=pop_cost_sort(1,:);
p_best(1:n_swarm,:)=pop_cost(1:n_swarm,:);
for i=1:n_swarm
v(i,:)=zeros(1,n_var);
end
pop_cost2=zeros(n_swarm,n_var+1);
g_best1=g_best;
%%
for i=1:iter
clc
main_run=zz
iteration=i
for j=1:n_swarm
c2=2;
c1=2;
v(j,:)=c1*rand*(p_best(j,1:n_var)-pop_cost(j,1:n_var))+...
c2*rand*(g_best(1,1:n_var)-pop_cost(j,1:n_var))+...
w*v(j,1:n_var);
xxxz=find(v(j,:)-upper_v>0);
v(j,xxxz)=upper_v(xxxz);
xxxz=find(v(j,:)-lower_v<0);
v(j,xxxz)=lower_v(xxxz);
pop_cost_new1(j,1:n_var)=pop_cost(j,1:n_var)+v(j,1:n_var);
pop=pop_cost_new1(j,1:n_var);
s3=find(pop(1,1:D)-max_var>0);
pop(s3)=max_var(s3);
s4=find(min_var-pop(1,1:D)>0);
pop(s4)=min_var(s4);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[pop_cost1]=goal_function(pop,1,n_var);
if pop_cost1(1,end)<p_best(j,end)
p_best(j,:)=pop_cost1(1,:);
end
pop_cost2(j,:)=pop_cost1(1,:);
end
pop_cost=pop_cost2;
pop_cost_sort=sortrows(pop_cost,n_var+1);
g_best1=pop_cost_sort(1,:);
if g_best1(1,end)<g_best(1,end)
g_best=g_best1;
end
p(zz,:)=g_best(1,:);
lll(zz,i)=g_best(1,end);
GBEST(1,i)=g_best(1,end);
end
g_best;
res_PSO.etime(zz)=toc;
res_PSO.x_best(zz,:)=g_best(1:end-1);
res_PSO.f_best(zz)=g_best(end);
res_PSO.plot_best(zz,:)=GBEST;
end
res_PSO.etime(zz)
res_PSO.x_best(zz,:)
zzzs=[p lll];
p;
save('res_PSO_RPO', 'res_PSO')
BFV=min(res_PSO.f_best)
AVB=mean(res_PSO.f_best)
stdev=std(res_PSO.f_best)
%
plot(res_PSO.plot_best(zz,:),'-','linewidth',2)
没有合适的资源?快使用搜索试试~ 我知道了~
pso.rar_Move Over_swarm

共5个文件
m:4个
mat:1个

1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 108 浏览量
2022-09-19
22:14:23
上传
评论
收藏 3KB RAR 举报
温馨提示
In computer science, particle swarm optimization (PSO) is a computational method that optimizes a problem by iteratively trying to improve a candidate solution with regard to a given measure of quality. PSO optimizes a problem by having a population of candidate solutions, here dubbed particles, and moving these particles around in the search-space according to simple mathematical formulae over the particle s position and velocity. Each particle s movement is influenced by its local best known position but, is also guided toward the best known positions in the search-space, which are updated as better positions are found by other particles. This is expected to move the swarm toward the best solutions.
资源推荐
资源详情
资源评论























收起资源包目录







共 5 条
- 1
资源评论


钱亚锋
- 粉丝: 124
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


最新资源
- xx信息与通信工程个人简历模板.doc
- JavaScript获取上传文件容量.doc
- 2023年地质大学远程网络继续教育结构力学习题集以及答案.doc
- NVR网络监控方案.doc
- 蛋白质结构预测在线软件.doc
- ArcGIS三维解决方案要点.doc
- 浅析互联网+背景下古典优秀文化的传承和弘扬.docx
- 机械设计制造及其自动化在现代企业中的发展.docx
- 实验一 Linux环境下的进程管理.doc
- 2023年全国计算机等级考试三级嵌入式题库含答案.docx
- 公共就业与人才服务信息化综合解决方案.ppt
- 基于人工智能技术的网络安全防护探索.docx
- 2022现代项目管理学习心得体会.docx
- 初始化项目管理.ppt
- RFID中间及系统集成技术PPT课件.ppt
- PPT模板:互联互通互联网金融平台运营计划总结报告模板.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制
