找回密码
 注册
关于网站域名变更的通知
查看: 335|回复: 1
打印 上一主题 下一主题

差分分组合作协同进化MATLAB代码

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2020-11-9 11:13 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

EDA365欢迎您登录!

您需要 登录 才可以下载或查看,没有帐号?注册

x
合作协同进化已经引入协同进化算法,目的是通过分而治之的范式解决日益复杂的优化问题。理论上,协同改 变子成分的想法是十分适合解决大规模优化问题的。然而在实践中,没有关于问题的先验知识, 问题应如何分解是尚不清楚的。在本文中,我们提出一个自动分解策略,称为差分分组,可以揭示决策变量的底层交互结构和形成子成分,以使它们之间的相互依存关系保持到最低限度。我们在数学上展示这样一个分解策略如何从部分可分性的定义中产生。实证研究表明,这样的近最优的分解可以大大提高大规模的全局优化问题的解决方案的质量。最后,我们展示了这样一个自动分解是如何产生对多样的子成分的分布的更好的近似,导致一个对多样的子成分的计算预算的更高效的分配。

9 k5 d! o6 A3 Hrun.m) p! c* @! M) N, O) |9 _+ `
0 B% m+ ]& H2 u3 w
  • % 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- O0 C! C2 {8 U, e
5 r( ~8 l4 C- o

% A3 `9 _7 O/ c                 dg.m
7 U% k. u7 |6 b' W$ c& U
7 d# n+ q4 U  s2 I, N
  • % 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
    + q# m. D/ d% h) R: H

% @- d/ o5 b; ~2 @/ `! e& ?9 O, x  H! m9 T
                                                    analyze.m* V, z+ j- Y) q4 Q) \* L
0 O; I  m6 J1 c- V. Y. i
  • % 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 ------------------------------------------------------* O' e$ J9 {2 j4 |
                                         

该用户从未签到

2#
发表于 2020-11-9 13:09 | 只看该作者
差分分组合作协同进化MATLAB代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

推荐内容上一条 /1 下一条

EDA365公众号

关于我们|手机版|EDA365电子论坛网 ( 粤ICP备18020198号-1 )

GMT+8, 2025-7-30 01:40 , Processed in 0.125000 second(s), 23 queries , Gzip On.

深圳市墨知创新科技有限公司

地址:深圳市南山区科技生态园2栋A座805 电话:19926409050

快速回复 返回顶部 返回列表