【优化算法】头脑风暴优化算法(BSO)【含Matlab源码 497期】
一、获取代码方式
获取代码方式1:
完整代码已上传我的资源:【优化算法】头脑风暴优化算法(BSO)【含Matlab源码 497期】
获取代码方式2:
通过订阅紫极神光博客付费专栏,凭支付凭证,私信博主,可获得此代码。
备注:
订阅紫极神光博客付费专栏,可免费获得1份代码(有效期为订阅日起,三天内有效);
二、头脑风暴优化算法(BSO)简介
受人类创造性解决问题过程——头脑风暴会议的启发, 2011年史玉回老师在第二次群体智能国际会议 (The Second International Conference on Swarm Intelligence(ICSI11)) 中提出一种新的群智能优化算法——头脑风暴优化算法,算法采用聚 类思想搜索局部最优,通过局部最优的比较得到全局最优;采用变异思想增加了算法的多 样性,避免算法陷入局部最优,在这聚与散相辅相承的过程中搜索最优解,思想新颖,适合于解决多峰高维函数问题。
算法流程建模如下
算法步骤描述
三、部分源代码
function best_fitness = bso2(fun,n_p,n_d,n_c,rang_l,rang_r,max_iteration)
% fun = fitness_function
% n_p; population size
% n_d; number of dimension
% n_c: number of clusters
% rang_l; left boundary of the dynamic range
% rang_r; right boundary of the dynamic range
prob_one_cluster = 0.8; % probability for select one cluster to form new individual;
stepSize = ones(1,n_d); % effecting the step size of generating new individuals by adding random values
popu = rang_l + (rang_r - rang_l) * rand(n_p,n_d); % initialize the population of individuals
popu_sorted = rang_l + (rang_r - rang_l) * rand(n_p,n_d); % initialize the population of individuals sorted according to clusters
n_iteration = 0; % current iteration number
% initialize cluster probability to be zeros
prob = zeros(n_c,1);
best = zeros(n_c,1); % index of best individual in each cluster
centers = rang_l + (rang_r - rang_l) * rand(n_c,n_d); % initialize best individual in each cluster
centers_copy = rang_l + (rang_r - rang_l) * rand(n_c,n_d); % initialize best individual-COPY in each cluster FOR the purpose of introduce random best
best_fitness = 1000000*ones(max_iteration,1);
fitness_popu = 1000000*ones(n_p,1); % store fitness value for each individual
fitness_popu_sorted = 1000000*ones(n_p,1); % store fitness value for each sorted individual
indi_temp = zeros(1,n_d); % store temperary individual
%**************************************************************************
%**************************************************************************
% calculate fitness for each individual in the initialized population
for idx = 1:n_pfitness_popu(idx,1) = fun(popu(idx,:));
end
while n_iteration < max_iterationcluster = kmeans(popu, n_c,'Distance','cityblock','Start',centers,'EmptyAction','singleton') % k-mean cluster% clustering fit_values = 100000000000000000000000000.0*ones(n_c,1); % assign a initial big fitness value as best fitness for each cluster in minimization problemsnumber_in_cluster = zeros(n_c,1); % initialize 0 individual in each cluster for idx = 1:n_pnumber_in_cluster(cluster(idx,1),1)= number_in_cluster(cluster(idx,1),1) + 1; % find the best individual in each clusterif fit_values(cluster(idx,1),1) > fitness_popu(idx,1) % minimizationfit_values(cluster(idx,1),1) = fitness_popu(idx,1);best(cluster(idx,1),1) = idx;end end best% form population sorted according to clusterscounter_cluster = zeros(n_c,1); % initialize cluster counter to be 0 acculate_num_cluster = zeros(n_c,1); % initialize accumulated number of individuals in previous clusters for idx =2:n_cacculate_num_cluster(idx,1) = acculate_num_cluster((idx-1),1) + number_in_cluster((idx-1),1);end %start form sorted populationfor idx = 1:n_pcounter_cluster(cluster(idx,1),1) = counter_cluster(cluster(idx,1),1) + 1 ;temIdx = acculate_num_cluster(cluster(idx,1),1) + counter_cluster(cluster(idx,1),1);popu_sorted(temIdx,:) = popu(idx,:);fitness_popu_sorted(temIdx,1) = fitness_popu(idx,1);end % record the best individual in each clusterfor idx = 1:n_ccenters(idx,:) = popu(best(idx,1),:); endcenters_copy = centers % make a copyif (rand() < 0.2) % select one cluster center to be replaced by a randomly generated centercenIdx = ceil(rand()*n_c);centers(cenIdx,:) = rang_l + (rang_r - rang_l) * rand(1,n_d);end % calculate cluster probabilities based on number of individuals in% each clusterfor idx = 1:n_cprob(idx,1) = number_in_cluster(idx,1)/n_p;if idx > 1prob(idx,1) = prob(idx,1) + prob(idx-1,1);endend % generate n_p new individuals by adding Gaussian random values for idx = 1:n_pr_1 = rand(); % probability for select one cluster to form new individualif r_1 < prob_one_cluster % select one clusterr = rand();for idj = 1:n_cif r < prob(idj,1) if rand() < 0.4 % use the centerindi_temp(1,:) = centers(idj,:); else % use one randomly selected clusterindi_1 = acculate_num_cluster(idj,1) + ceil(rand() * number_in_cluster(idj,1));indi_temp(1,:) = popu_sorted(indi_1,:); endbreakendendelse % select two clusters% pick two clusters cluster_1 = ceil(rand() * n_c);indi_1 = acculate_num_cluster(cluster_1,1) + ceil(rand() * number_in_cluster(cluster_1,1)); cluster_2 = ceil(rand() * n_c);indi_2 = acculate_num_cluster(cluster_2,1) + ceil(rand() * number_in_cluster(cluster_2,1)); tem = rand();if rand() < 0.5 %use centerindi_temp(1,:) = tem * centers(cluster_1,:) + (1-tem) * centers(cluster_2,:); else % use randomly selected individuals from each cluster indi_temp(1,:) = tem * popu_sorted(indi_1,:) + (1-tem) * popu_sorted(indi_2,:); endend %Griewank
function z = griewank(x)
% unimodal optimum 0
[m,n]=size(x);
for j=1:mfor e=1:nf1(e)=x(j,e)^2;f2(e)=cos(x(j,e)/sqrt(e));end
四、运行结果
五、matlab版本及参考文献
1 matlab版本
2014a
2 参考文献
[1] 包子阳,余继周,杨杉.智能优化算法及其MATLAB实例(第2版)[M].电子工业出版社,2016.
[2]张岩,吴水根.MATLAB优化算法源代码[M].清华大学出版社,2017.
【优化算法】头脑风暴优化算法(BSO)【含Matlab源码 497期】相关推荐
- 【单目标优化求解】基于matlab黑猩猩算法求解单目标问题【含Matlab源码 1413期】
一.获取代码方式 获取代码方式1: 完整代码已上传我的资源:[单目标优化求解]基于matlab黑猩猩算法求解单目标问题[含Matlab源码 1413期] 点击上面蓝色字体,直接付费下载,即可. 获取代 ...
- 【风电功率预测】基于matlab帝国殖民竞争算法优化BP神经网络风电功率预测【含Matlab源码 1314期】
⛄一.获取代码方式 获取代码方式1: 完整代码已上传我的资源: [风电功率预测]基于matlab帝国殖民竞争算法优化BP神经网络风电功率预测[含Matlab源码 1314期] ⛄二.帝国殖民竞争算法简 ...
- 【APF三维路径规划】基于matlab人工势场算法无人机三维路径规划【含Matlab源码 168期】
一.获取代码方式 获取代码方式1: 通过订阅紫极神光博客付费专栏,凭支付凭证,私信博主,可获得此代码. 获取代码方式2: 完整代码已上传我的资源:[三维路径规划]基于matlab人工势场算法无人机三维 ...
- 【RRT三维路径规划】基于matlab RRT算法无人机三维路径规划【含Matlab源码 155期】
一.获取代码方式 获取代码方式1: 通过订阅紫极神光博客付费专栏,凭支付凭证,私信博主,可获得此代码. 获取代码方式2: 完整代码已上传我的资源:[三维路径规划]基于matlab RRT算法无人机三维 ...
- 【RRT三维路径规划】基于matlab RRT算法无人机三维路径规划【含Matlab源码 1363期】
一.获取代码方式 获取代码方式1: 通过订阅紫极神光博客付费专栏,凭支付凭证,私信博主,可获得此代码. 获取代码方式2: 完整代码已上传我的资源:[三维路径规划]基于matlab RRT算法无人机三维 ...
- 【物流选址】基于matlab免疫算法求解物流选址问题【含Matlab源码 020期】
一.获取代码方式 获取代码方式1: 完整代码已上传我的资源:[物流选址]基于matlab免疫算法求解物流选址问题[含Matlab源码 020期] 获取代码方式2: 付费专栏Matlab路径规划(初级版 ...
- 【A_star三维路径规划】基于matlab A_star算法无人机三维路径规划【含Matlab源码 446期】
⛄一.获取代码方式 获取代码方式1: 完整代码已上传我的资源:[三维路径规划]基于matlab A_star算法无人机三维路径规划[含Matlab源码 446期] 获取代码方式2: 付费专栏Matla ...
- 【ACO TSP】基于matlab蚁群算法求解31城市旅行商问题【含Matlab源码 1147期】
一.获取代码方式 获取代码方式1: 完整代码已上传我的资源:[TSP]基于matlab蚁群算法求解31城市旅行商问题[含Matlab源码 1147期] 点击上面蓝色字体,直接付费下载,即可. 获取代码 ...
- 【LSSVM回归预测】基于matlab灰狼算法优化最小支持向量机GWO-LSSVM数据预测【含Matlab源码 2259期】
⛄一.灰狼算法优化最小支持向量机GWO-LSSVM简介 1 算法理论 采用灰狼优化算法的最小二乘支持向量机模型预测时,为避免过拟合现象和检验该模型的有效性,将实证部分主要分为:①基于灰狼优化算法的最小 ...
- 【LSSVM回归预测】基于matlab狮群算法优化最小二乘支持向量机LSO-LSSVM数据回归预测【含Matlab源码 2261期】
⛄一.狮群算法简介 狮群优化算法(lion swarm optimization algorithm, LSO)是在狮群协作捕猎的基础上提出的一种群智能优化算法.狮群算法将狮群分成3个部分:狮王.母狮 ...
最新文章
- Picasso:开启大前端的未来
- 【深度学习】U-Net 网络分割多分类医学图像解析
- 网狐荣耀源码(含内核源码)可二次开发
- java 短链跳转原理_给你代码:短链接生成原理
- 所想即所得 运维进行时
- [html] 你认为一个好的布局应该是什么样的?有哪些需要注意的地方?
- 计算机科学导论考试A卷试题,09级计算机科学导论A卷答案
- linux系统汇总的qt,QT 编程总结_Linux编程_Linux公社-Linux系统门户网站
- 2010-3-13 社区精英面对面 - 北京 Dev 组 2010 领袖 活动
- Win10 64位系统下PCL + Visual Studio + cmake + (Qt) 安装调试
- System center virtual machine manager 2008 R2安装部署
- 项目遇到的问题总结(四):单页面首屏加载慢解决方案
- excel数字小写转大写公式的教程
- office表格标题和表格距离过大怎么解决
- 半监督学习之伪标签(pseudo label,entropy minimization,self-training)
- 方舟服务器显示等待发布,《明日方舟》开服既炸服的这波操作《方舟生存进化》永远也学不会...
- 3点内容介绍什么是物联网模组
- HTML入门笔记12-HTML中备注写法
- 计算机考研机试如何准备?
- 风格的要素 C语言 pdf,英语写作手册:风格的要素(新译本) [Elements of Style]
热门文章
- DDD实战进阶第一波(七):开发一般业务的大健康行业直销系统(实现产品上下文接口与测试)...
- 【转】The C10K problem(翻译 中文版)
- [CSS揭秘]不规则投影
- Prism初研究之使用Prism 5.0开发模块化应用
- 传智播客Java 方法
- 181218每日一句
- Atitit go语言 golang 艾提拉总结特性优缺点 目录 1. Go 语言最主要的特性:	1 2. 体积大概100M	1 3. 问题	1 3.1. 编译速度和异常控制怎么样	1 3.2.
- Atitit uke签名规范 与防伪鉴别 attilax总结
- Atitit 提升用户体验 生物识别 与登录 身份验证
- atitit.颜色查找 根据范围 图像处理 inRange