% Author: Mohammad Nabi Omidvar
% email address: mn.omidvar AT gmail.com
%
% ------------
% Description:
% ------------
% This file is used to analyze the performance of the differential
% grouping algorithm on CEC'2010 benchmark problems.
% This program reads the data files generated by differential
% grouping and shows how many variables from each formed group
% are correctly identified and to which permutation group they
% belong.
%
%--------
% Inputs:
%--------
% funs: a vector containing the functions ids the functions that you
% want to analyze.
%
% -----------
% References:
% -----------
% Omidvar, M.N.; Li, X.; Mei, Y.; Yao, X., "Cooperative Co-evolution with
% Differential Grouping for Large Scale Optimization," Evolutionary Computation,
% IEEE Transactions on, vol.PP, no.99, pp.1,1, 0
% http://dx.doi.org/10.1109/TEVC.2013.2281543
%
% --------
% License:
% --------
% This program is to be used under the terms of the GNU General Public License
% (http://www.gnu.org/copyleft/gpl.html).
% Author: Mohammad Nabi Omidvar
% e-mail: mn.omidvar AT gmail.com
% Copyright notice: (c) 2013 Mohammad Nabi Omidvar
function analyze(funcs)
more off;
% Number of non-separable groups for each function in CEC'210 benchmark suite.
numNonSep = [0 0 0 1 1 1 1 1 10 10 10 10 10 20 20 20 20 20 20 20];
for f=funcs
filename = sprintf('./results/F%02d.mat', f);
p = 1:1:1000;
load(filename);
mat = zeros(length(nonseps), 20);
drawline('=');
fprintf('Function F: %02d\n', f);
fprintf('FEs used: %d\n', FEs);
fprintf('Number of separables variables: %d\n', length (seps));
fprintf('Number of non-separables groups: %d\n', length (nonseps));
filename1 = sprintf('./cec2010/datafiles/f%02d_op.mat', f);
filename2 = sprintf('./cec2010/datafiles/f%02d_opm.mat', f);
flag = false;
if(exist(filename1))
load(filename1);
flag = true;
elseif(exist(filename2))
load(filename2);
flag = true;
end
printheader();
for i=[1:1:length(nonseps)]
fprintf('Size of G%02d: %3d | ', i, length (nonseps{i}));
m = 50;
if(flag)
for g=[1:1:20]
captured = length(intersect(p((g-1)*m+1:g*m), nonseps{i}));
fprintf(' %4d', captured);
mat(i, g) = captured;
end
end
fprintf('\n');
end
mat2 = mat;
[temp I] = max(mat, [], 1);
[sorted II] = sort(temp, 'descend');
masks = zeros(size(mat));
for k = 1:min(size(mat))
mask = zeros(1, length(sorted));
mask(II(k)) = 1;
masks(I(II(k)), :) = mask;
%point = [I(k) II(k)];
mat(I(II(k)), :) = mat(I(II(k)), :) .* mask;
[temp I] = max(mat, [], 1);
[sorted II] = sort(temp, 'descend');
end
mat = mat2 .* masks;
[temp I] = max(mat, [], 1);
if(ismember(f, [19 20]))
gsizes = cellfun('length', nonseps);
fprintf('Number of non-separable variables correctly grouped: %d\n', max(gsizes));
else
fprintf('Number of non-separable variables correctly grouped: %d\n', sum(temp(1:numNonSep(f))));
end
drawline('=');
pause;
end
end
% Helper Functions ----------------------------------------------------------
function drawline(c)
for i=1:121
fprintf(1,c);
end
fprintf('\n')
end
function printheader()
fprintf('Permutation Groups| ');
for i=1:20
fprintf(' %4s', sprintf('P%d', i));
end
fprintf('\n')
drawline('-');
end
% End Helper Functions ------------------------------------------------------