合作协同进化已经引入协同进化算法,目的是通过分而治之的范式解决日益复杂的优化问题。理论上,协同改 变子成分的想法是十分适合解决大规模优化问题的。然而在实践中,没有关于问题的先验知识, 问题应如何分解是尚不清楚的。在本文中,我们提出一个自动分解策略,称为差分分组,可以揭示决策变量的底层交互结构和形成子成分,以使它们之间的相互依存关系保持到最低限度。我们在数学上展示这样一个分解策略如何从部分可分性的定义中产生。实证研究表明,这样的近最优的分解可以大大提高大规模的全局优化问题的解决方案的质量。最后,我们展示了这样一个自动分解是如何产生对多样的子成分的分布的更好的近似,导致一个对多样的子成分的计算预算的更高效的分配。
索引词:合作协同进化,大规模优化,问题分解,不可分性,数值优化
run.m
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
% Author: Mohammad Nabi Omidvar % email address: mn.omidvar AT gmail.com % % ------------ % Description: % ------------ % This files is the entry point for running the differential gropuing algorithm. clear all; % Specify the functions that you want the differential grouping algorithm to % identify its underlying grouping structure. func = [20:-1:1]; for i=func func_num = i t1 = [1 4 7 8 9 12 13 14 17 18 19 20]; t2 = [2 5 10 15]; t3 = [3 6 11 16]; if (ismember(func_num, t1)) lb = -100; ub = 100; elseif (ismember(func_num, t2)) lb = -5; ub = 5; elseif (ismember(func_num, t3)) lb = -32; ub = 32; end opts.lbound = lb; opts.ubound = ub; opts.dim = 1000; opts.epsilon = 1e-3; addpath('cec2010'); addpath('cec2010/datafiles'); global initial_flag; initial_flag = 0; [seps, nonseps, FEs] = dg('benchmark_func', func_num, opts); % filename = sprintf('./results/F%02d.mat', func_num); % save (filename, 'seps', 'nonseps', 'FEs', '-v7'); end |
dg.m
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
% Author: Mohammad Nabi Omidvar % email : mn.omidvar AT gmail.com % % ------------ % Description: % ------------ % dg - This function runs the differential grouping % procedure to identify the non-separable groups % in cec'2010 benchmark problems.o % % ------- % Inputs: % ------- % fun : the function suite for which the interaction structure % is going to be identified in this case benchmark_func % of cec'2010. % % fun_number : the function number. % % options : this variable contains the options such as problem % dimensionality, upper and lower bounds and the parameter % epsilon used by differential grouping. % input3 - Description % % -------- % Outputs: % -------- % sep : a vector of all separable variables. % allgroups: a cell array containing all non-separable groups. % FEs : the total number of fitness evaluations used. % % -------- % 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 [seps, allgroups, FEs] = dg(fun, fun_number, options); ub = options.ubound; lb = options.lbound; dim = options.dim; epsilon = options.epsilon; r = ub - lb; dims = [1:1:dim]; seps = []; allgroups = {}; FEs = 0; while (length(dims) >= 1) allgroups; n = length(dims) group = [dims(1)]; group_ind = [1]; p1 = lb * ones(1,dim); p2 = p1; p2(dims(1)) = ub; delta1 = feval(fun, p1, fun_number) - feval(fun, p2, fun_number); FEs = FEs + 2; for i=2:n p3 = p1; p4 = p2; temp = 0; p3(dims(i)) = temp; p4(dims(i)) = temp; delta2 = feval(fun, p3, fun_number) - feval(fun, p4, fun_number); FEs = FEs + 2; if(abs(delta1-delta2) > epsilon) group = [group ; dims(i)]; group_ind = [group_ind ; i]; end end if(length(group) == 1) seps = [seps ; group]; else allgroups = {allgroups{1:end}, group}; end if(length(dims) > 0) dims(group_ind) = []; end end end |
analyze.m
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
% 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 ------------------------------------------------------ |
请问有完整的程序代码吗,这部分只是分组那部分的代码吧,想看看完整的跑测试函数的代码,或者后半部分的优化代码也可以,感谢
所以本人比较着急想实现这个代码,然后再去改,非常感谢!
抱歉,我已经不做这个方向了,请参考:https://www.omegaxyz.com/2018/01/29/ccpso_std/
对不起,我才看到,收到,非常感谢!
错误使用 feval
未定义函数或变量 ‘benchmark_fun’。
出错 dg (line 102)
delta1 = feval(fun, p1, fun_number) – feval(fun, p2, fun_number);
出错 run (line 51)
[seps, nonseps, FEs] = dg(‘benchmark_fun’, func_num, opts);
我出现了这个错误,不知道是什么原因,非常感谢!
请问代码中的测试函数文件可否发一份给我?万分感谢!
这个代码是作者写的,你在谷歌上搜索应该能找到
好的,谢谢
您好,请问那这上面的代码是不是不全,还是写得有些问题,就是上面的run.m的代码是用来运行的,它在调用 [seps, nonseps, FEs] = dg(‘benchmark_func’, func_num, opts);也就是第51行的代码它的’benchmark_func’这一部分只应用了这个函数,却没有具体的内容,不知道是缺一段整个代码还是在dg.mat里面少一个benchmark_func函数,由于本人最近在研究协同进化的特征选择问题,而且正在写毕业论文,马上就交,比较不容易找到这篇论文,所以请教一下这个算法的全部代码在哪个具体的网站的哪个位置能找到,非常感谢!