基于MATLAB的头脑风暴优化算法
Posted fpga&matlab
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了基于MATLAB的头脑风暴优化算法相关的知识,希望对你有一定的参考价值。
% bso test
clc
clear all
close all
%funStr = 'rastrigin'; %output worksheet name
%funName = @rastrigin; % fitness function name
%n_p = 500; % population size
%n_d = 2; % dimension
%n_c = 5; % number of clusters
%rang_l = -100; % left of dynamic range
%rang_r = 100; % right of dynamic range
%max_iteration = 50; % maximal number of iterations
warning off all
n_p = 100; % population size
n_d = 30; % dimension
n_c = 5; % number of clusters
funStr = 'sphere30D5C'; %output worksheet name
funName = @sphere; % fitness function name
rang_l = -100; % left of dynamic range sphere
rang_r = 100; % right of dynamic range
%funStr = 'rastrigin10D5C'; %output worksheet name
%funName = @rastrigin; % fitness function name
%rang_l = -5.12; % left of dynamic range rastrigin
%rang_r = 5.12; % right of dynamic range
max_iteration = 200; % maximal number of iterations
for idx = 1:50 % run times
idx
fit = bso2(funName,n_p,n_d,n_c,rang_l,rang_r,max_iteration); %run BSO one time
% if idx <27
% str = native2unicode(idx + 64);
% else % assume idx <53
% str =['A',native2unicode(idx + 38)];
% end
% xlswrite('bso2.xls',fit,funStr, [str,'1']); % output best fitness over generation to EXCEL worksheet for each BSO run
% ['run', num2str(idx)]
fit1=fit';
fits(idx,1:max_iteration)=fit1(1,1:max_iteration);
end
fits=sum(fits)/idx;
plot(fits,'-.');
B-56
以上是关于基于MATLAB的头脑风暴优化算法的主要内容,如果未能解决你的问题,请参考以下文章
优化算法头脑风暴优化算法(BSO)含Matlab源码 497期
MATLAB实战系列(二十九)-头脑风暴优化(BSO)算法求解旅行商问题(TSP)-交叉算子
SDPTWVRP基于matlab头脑风暴算法求解带时间窗和同时取送货车辆路径问题含Matlab源码 1990期
matlab改进(结合聚类)头脑风暴算法求解路径优化问题VRP