资源简介
竞争群(competitive swarm optimizer (CSO))算法的matlab代码实现。(包含函数和例子)
代码片段和文件信息
function [ bestever bestSwarm ] = cso( varargin )
% Implementation of a competitive swarm optimizer (CSO) for large scale optimization
%
% See the details of CSO in the following paper
% R. Cheng and Y. Jin A Competitive Swarm Optimizer for Large Scale Optmization
% IEEE Transactions on Cybernetics 2014
%
% The test instances are the CEC‘08 benchmark functions for large scale optimization
%
% The source code CSO is implemented by Ran Cheng
%
% If you have any questions about the code please contact:
% Ran Cheng at r.cheng@surrey.ac.uk
% Prof. Yaochu Jin at yaochu.jin@surrey.ac.uk
%
% Code update on 2018-03-18
% A.Star Snowland Co. Ltd chenxiaolong12315@163.com
%
% [res bestSwarm] = cso(fitness_function XRRmin XRRmax maxfe)
% input args
% fitness: a function handle to calculate the fitness of swarms(popsize x dim matrix)
% popsize: integer the popsize of swarm
% bound_min bound_max: the matrix(1 x dim) is the bounary of the swarms
% maxfe: a integer number of iterations
% debug: default 0 display bestfitness in each iteration
% output args
% Example:
% fun=inline(‘sqrt(x(:1).^2+x(:2).^2)‘‘x‘);
% [res swarm] = cso(fun100[-8-8][88]10000.2);
% xi = -8:0.05:8;
% yi = -8:0.05:8;
% [xy] = meshgrid(xi yi);
% z = sqrt(x.^2+y.^2);
% mesh(xyz);
% hold on
% plot3(swarm(1)swarm(2) res ‘r+‘)
[fitness_functionm bound_min bound_max maxfe phi debug] = checkInput(varargin);
XRRmin = repmat(bound_min m 1);
XRRmax = repmat(bound_max m 1);
[~ d] = size(XRRmin);
%% initialization
p = XRRmin + (XRRmax - XRRmin) .* rand(m d);
v = zeros(md);
bestever = 1e200;
fitness = fitness_function(p);
FES = m;
gen = 0;
bestSwarm = p(1:);
ceil_half_m = ceil(m/2);
%% main loop
while(FES < maxfe)
% generate random pairs
rlist = randperm(m);
rpairs = [rlist(1:ceil_half_m); rlist(floor(m/2) + 1:m)]‘;
% calculate the center position
center = ones(ceil_half_m1)*mean(p);
% do pairwise competitions
mask = (fitness(rpairs(:1)) > fitness(rpairs(:2)));
losers = mask.*rpairs(:1) + ~mask.*rpairs(:2);
winners = ~mask.*rpairs(:1) + mask.*rpairs(:2);
%random matrix
randco1 = rand(ceil_half_m d);
randco2 = rand(ceil_half_m d);
randco3 = rand(ceil_half_m d);
% losers learn from winners
v(losers:) = randco1.*v(losers:) ...
+ randco2.*(p(winners:) - p(losers:)) ...
+ phi*randco3.*(center - p(losers:));
p(losers:) = p(losers:) + v(losers:);
% boundary control
for i = 1:ceil_half_m
p(losers(i):) = max(p(losers(i):) XRRmin(losers(i):));
p(losers(i):) = min(p(losers(i):) XRRmax(losers(i):));
end
% fitness evaluation
fitness(losers:) = fitness_function(p(losers:));
[min_fitness min_fitness_ind] = min(fitness);
if bestever > min_fitness
bestever = min_fitness;
bestSwarm = p(min_fitness_ind
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-03-19 09:38 CSO_Matlab-master\
目录 0 2018-03-19 09:38 CSO_Matlab-master\CEC08 Func\
文件 37430 2018-03-19 09:38 CSO_Matlab-master\CEC08 Func\FractalFunctions.jar
文件 7840 2018-03-19 09:38 CSO_Matlab-master\CEC08 Func\ackley_shift_func_data.mat
文件 3497 2018-03-19 09:38 CSO_Matlab-master\CEC08 Func\benchmark_func.m
文件 171 2018-03-19 09:38 CSO_Matlab-master\CEC08 Func\fastfractal_doubledip_data.mat
文件 195 2018-03-19 09:38 CSO_Matlab-master\CEC08 Func\fbias_data.mat
文件 7817 2018-03-19 09:38 CSO_Matlab-master\CEC08 Func\griewank_shift_func_data.mat
文件 7914 2018-03-19 09:38 CSO_Matlab-master\CEC08 Func\rastrigin_shift_func_data.mat
文件 7831 2018-03-19 09:38 CSO_Matlab-master\CEC08 Func\rosenbrock_shift_func_data.mat
文件 7751 2018-03-19 09:38 CSO_Matlab-master\CEC08 Func\schwefel_shift_func_data.mat
文件 7826 2018-03-19 09:38 CSO_Matlab-master\CEC08 Func\sphere_shift_func_data.mat
文件 3431 2018-03-19 09:38 CSO_Matlab-master\CSO.m
文件 3176 2018-03-19 09:38 CSO_Matlab-master\CSO_test.m
文件 255 2018-03-19 09:38 CSO_Matlab-master\cso_test_hat.m
- 上一篇:阶比跟踪谱
- 下一篇:matlab中基于Viola-Jones算法的人脸检测
相关资源
- matlab中基于Viola-Jones算法的人脸检测
- 阶比跟踪谱
- 用matlab软件求img图像的标准差
- 用matlab计算img图像的均方根误差
- matlab源码 PLS算法
- l1-ls 范数求解matlab程序包
- matlab色散程序
- MATLAB 并联机构工作空间搜索代码
- 滑模变结构控制matlab仿真第三版先进
- MATLAB处理地震波的程序
-
基于Matlab_Simuli
nk的空气悬架非线性 - FREAK Matlab实现
- 基于harris角点特征提取的matlab图像拼
- matlab 2012b 破解版
- PCA-SIFT 源代码 matlab
- ISODATA算法 matlab实现
- 用MATLAB写的图像处理,直方图,灰度
- 双向可逆DC/DC MATLAB模型
- ContourletMatlab去噪
- 波束形成 MATLAB 实现
- 三维锥束CT反投影滤波重建matlab程序
- MatlabGui坐标轴内随鼠标移动的十字线
- 谱估计 MUSIC算法 matlab程序
- K近邻算法、剪辑近邻、压缩近邻等算
- 粒子群优化算法Matlab源程序
- SUSAN算法的MATLAB实现
- 非负矩阵分解的matlab代码内容全
- 自适应中值滤波算法matlab
- MATLAB实现信号的AM调制与解调
- matlab代码KNN,层次聚类,C均值,最邻
评论
共有 条评论