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

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

[复制链接]

该用户从未签到

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

EDA365欢迎您登录!

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

x

0 ]6 @# l* M" R' N; K/ U合作协同进化已经引入协同进化算法,目的是通过分而治之的范式解决日益复杂的优化问题。理论上,协同改 变子成分的想法是十分适合解决大规模优化问题的。然而在实践中,没有关于问题的先验知识, 问题应如何分解是尚不清楚的。在本文中,我们提出一个自动分解策略,称为差分分组,可以揭示决策变量的底层交互结构和形成子成分,以使它们之间的相互依存关系保持到最低限度。我们在数学上展示这样一个分解策略如何从部分可分性的定义中产生。实证研究表明,这样的近最优的分解可以大大提高大规模的全局优化问题的解决方案的质量。最后,我们展示了这样一个自动分解是如何产生对多样的子成分的分布的更好的近似,导致一个对多样的子成分的计算预算的更高效的分配。
* H" ^; g  y5 d' e  b: l) c6 D3 ?$ ^# F9 L1 C/ U# ?, x
索引词:合作协同进化,大规模优化,问题分解,不可分性,数值优化
) t1 \4 T' }& {  y& A
! t7 {% S  p" S5 F2 g2 O' g, K9 a1 V, b  R, a' f
run.m
% [- n$ M+ o, s, t- S- _# q1 e! }! r2 e: b& T6 I  ^' Y
% Author: Mohammad Nabi Omidvar4 \, L9 }: U8 Y3 s3 x+ q# G
% email address: mn.omidvar AT gmail.com! R) p( b+ s  T( S: u
%
6 t8 r1 d) t* J. Z3 u7 h% ------------
  P" m, s  ]8 k  b# a$ ^% Description:" p( A* u% L: _. B) q5 M1 a8 ~
% ------------
- K5 o. _& _( o* Y% This files is the entry point for running the differential gropuing algorithm.
3 s7 ~! y+ A: k! Y5 V8 a) f  r8 @0 }  v* m
clear all;; ?8 W! n# n7 ?; D& \; Z0 R

* T3 {. x. _8 Y+ C7 _8 T; t! B% Specify the functions that you want the differential grouping algorithm to
; y" K7 n5 C4 M& \: \& M- ^% identify its underlying grouping structure.
) i3 ^; o, _7 V% Z  g0 gfunc = [20:-1:1];1 K: G# b; H" Q0 `1 {5 o+ x
for i=func3 o2 @% t; J: ?' c9 z9 m" `' p0 u
    func_num = i
9 ]0 o' @$ A3 v# w; P* z% N7 |* ^& Q5 e6 x, n% n# D; |& I. R" b
    t1 = [1 4 7 8 9 12 13 14 17 18 19 20];
4 r& C2 l( {7 G& i' F    t2 = [2 5 10 15];
) l5 J7 b0 t  q0 h    t3 = [3 6 11 16];
1 T8 |- _( C- J* s! V( X* e2 }  V  X- E+ u. P2 R1 A9 s- p
    if (ismember(func_num, t1))2 A: r( B, {1 L; @7 |, ^
        lb = -100;
5 @& r+ T% B* C  P1 H" u        ub = 100;- I# O( ^  M6 s- Z1 m" k2 G
    elseif (ismember(func_num, t2))" t: c' z% b% J4 V, L9 a  Q- u
        lb = -5;, U2 A/ [) ~$ A1 C" w& v4 X' h
        ub = 5;
& [" b' z: W9 p! g    elseif (ismember(func_num, t3))
2 t9 o% Y! ^% L0 H        lb = -32;
2 v1 i' P7 w/ s$ Z  s- N! S% Q: }        ub = 32;4 s# r$ s6 P" T
    end3 Q2 h5 {; Y: b/ b/ w/ j. P8 R
: J8 @9 ~* H7 Q6 R
    opts.lbound  = lb;" Y' H: [% [' D* W/ {* A
    opts.ubound  = ub;
: j9 w0 x* X9 h4 f- X- J    opts.dim     = 1000;
! d) j/ \+ |1 H: U2 V    opts.epsilon = 1e-3;  u- X" W3 f7 h  r' r1 r! b
& k- {$ q. [3 q. q7 p0 \% F5 p; W
    addpath('cec2010');( M$ q6 l# W1 r& L" Z; ]- K0 M* J. d
    addpath('cec2010/datafiles');0 [; X5 J, y2 s8 Y$ Y4 U
    global initial_flag;% a  n# `2 U/ Q  K8 P
    initial_flag = 0;
" D* s4 [1 F4 O" q" l: D6 ~( D) e5 a% Z) _5 v; q  \2 `
    [seps, nonseps, FEs] = dg('benchmark_func', func_num, opts);
8 o( `/ S, V3 t2 X. F
/ O5 h1 l( B& D    % filename = sprintf('./results/F%02d.mat', func_num);
% Z. R, b/ }# Z* \; \4 W& k    % save (filename, 'seps', 'nonseps', 'FEs', '-v7');. V; a: `' G" y( p8 |8 w7 l, ]# o
end
1 a, A' S, o: `% K+ n$ ^/ \3 k
* L8 m2 u# n& c9 F
+ x% e# g" K% p. z& D& wdg.m - Y8 G& @, c: s: N" y0 y; ~
, E$ q' {5 ?0 ^, E0 c/ A, |
% Author: Mohammad Nabi Omidvar1 w9 A0 Z9 A$ z
% email : mn.omidvar AT gmail.com
8 d- g3 |; X* H# \9 j. _! s5 U%+ h7 o, _. v  ]' o2 {5 M# [6 ^
% ------------) M* [# x; o) q( [
% Description:
* H: V. Q9 j& C' c, s, M/ S5 S% ------------
; M; C" `4 @( @1 k% dg - This function runs the differential grouping
5 y- ~! X6 s4 g3 a9 w" q%      procedure to identify the non-separable groups
3 Z, c6 T1 ^' u%      in cec'2010 benchmark problems.o" f3 }6 \" D; w
%7 J$ W) @3 ~8 s/ e! i  e( M" x+ x9 k
% -------& Y3 R% h7 m0 L, v+ ]
% Inputs:% y4 u9 k" s" s9 L8 z1 x+ ^
% -------! T' ]! k  d. Y
%    fun        : the function suite for which the interaction structure
+ j( }6 t  ^2 g% G! W1 i1 t* p6 V%                 is going to be identified in this case benchmark_func
( E9 H) c& M. `7 z& M# v%                 of cec'2010.
" g, c0 M2 L$ G  g+ E%
4 Z0 p0 p, h+ F) ~7 A# f( J9 C+ d8 U%    fun_number : the function number.
  b( [9 t: I$ I) ?: Y%. W; w, T' Z0 l3 O% C* {
%    options    : this variable contains the options such as problem5 q) I3 p1 z  K2 j
%                 dimensionality, upper and lower bounds and the parameter & E& }3 S; _' Y: r
%                 epsilon used by differential grouping.
+ l6 a5 e  z2 I) B%    input3 - Description9 ~8 `4 i; g7 r3 w2 p) H6 Y
%
8 V% [1 Z3 [; t' D" _% --------) Y! k9 s$ o4 q/ \: O
% Outputs:! f& L3 p& @! O) `' E9 G: b
% --------
6 o$ C  Y. L7 F! q$ d6 [9 E. N%    sep      : a vector of all separable variables.
" f3 D) g4 S& Z, M' f" E%    allgroups: a cell array containing all non-separable groups.% l+ _$ e5 W/ S8 ]
%    FEs      : the total number of fitness evaluations used.9 B! T9 h/ e- u, G# d6 x& k  ]
%) O$ f8 L5 H, Y' y; y- V7 ]1 O! g
% --------
5 |* ?" R/ c2 l$ A  C% License:
. `) B9 o& y3 o7 l3 P0 g) k2 E4 v% --------& J( H, t8 f% ~1 D2 N
% This program is to be used under the terms of the GNU General Public License 5 k  {* l* S) E6 Z* i0 H
% (http://www.gnu.org/copyleft/gpl.html).8 x' @) b" [( {. L
% Author: Mohammad Nabi Omidvar
7 c0 g* q" U! l* w% y, T% e-mail: mn.omidvar AT gmail.com
$ W8 b1 B6 J# B! A% Copyright notice: (c) 2013 Mohammad Nabi Omidvar
% a. z" u# w+ S: ]
7 e! @6 E0 T$ t( |) d% o
, i8 _6 A! r( O6 I" o2 i/ E( Y6 rfunction [seps, allgroups, FEs] = dg(fun, fun_number, options);
% l( k. N/ t; P2 I   ub        = options.ubound;
6 S" H2 d5 I$ j: R" }1 b# n  K   lb        = options.lbound;
) e$ W0 f1 I- H0 U+ x6 }1 C   dim       = options.dim;
/ x8 l# F7 {( e* J; z   epsilon   = options.epsilon;& U7 ~7 r' Z' w; z& g
   r         = ub - lb;
# E0 Z" g' t6 {4 q4 _% x   dims      = [1:1:dim];- f% b6 v! ^( T% y
   seps      = [];
2 o5 i, r2 W% b' O; y- z! u   allgroups = {};
. w- [7 W5 f) q& X: w  o1 q   FEs       = 0;; {* m: f7 e, d3 ~: z# ?$ `8 ^
6 A9 x* [( Q; a- K
   while (length(dims) >= 1)
; R5 i; ^) l8 H2 h: |  o       allgroups;! a5 W, m  l' F- ]/ m2 e
       n = length(dims). O# Z% R" j  Y9 M
       group = [dims(1)];
/ r3 U- u8 q2 V* p9 m% H  ~       group_ind = [1];/ i8 R& B4 L' y5 x$ b; N! ]3 f

  l' Q6 T& H; {, t2 d8 T% I: a4 Q! |       p1 = lb * ones(1,dim);8 V( L, ?7 N0 ]) s
       p2 = p1;
% c# r2 J' A3 l# o/ a       p2(dims(1)) = ub;% ~% I  D8 H7 C1 L4 J

- o$ v1 ?$ E9 i! z3 |. J* q       delta1 = feval(fun, p1, fun_number) - feval(fun, p2, fun_number);# v4 v0 E5 |/ ^' C) i

8 r4 f# ~% @4 j+ L: H       FEs = FEs + 2;
+ x$ e2 I- p+ t1 r2 e& _6 n$ V5 d7 H( @
       for i=2:n
+ o( b9 N1 U! v1 S4 @6 }           p3 = p1;; z) I+ n* \/ g; a' j" y4 N
           p4 = p2;- c6 t6 s& W1 x% y) D

3 B" ]: y- g' M9 e/ K0 j           temp = 0;( R0 t: B/ f# V+ \% P
           p3(dims(i)) = temp;
5 t6 f0 v" C. c8 W. W- j           p4(dims(i)) = temp;
* b) O/ f) c8 I' n+ |0 l" Z- I) @3 L+ J) R# v# n
           delta2 = feval(fun, p3, fun_number) - feval(fun, p4, fun_number);% e$ m( a/ ], i

* T! v* r3 P4 I9 Y! p5 F           FEs = FEs + 2;) x0 f" ~* o* e/ s
2 a) y" P0 {# G
           if(abs(delta1-delta2) > epsilon)
  Q: C2 g% c7 _% w+ V8 |% {               group = [group ; dims(i)];- T! J$ N3 Y: k+ R: A
               group_ind = [group_ind ; i];
8 F* v: }$ G2 M           end
) n: f6 l; b$ v7 Y       end1 ]8 S# j$ O0 F

+ R8 \! ], R( t0 u       if(length(group) == 1)5 L. f' n- I0 c4 d/ Y4 J, T4 Q. G, b0 k
           seps = [seps ; group];
* k9 ~( F% e/ E       else! h/ ?6 M7 X) P0 m. {0 N7 l0 }, r
           allgroups = {allgroups{1:end}, group};7 _' e( ^. b$ M" }5 j6 X* |9 i9 [
       end
* p* q6 }) Y7 C" W
* O7 a! P3 _8 v       if(length(dims) > 0)
$ H+ j) C! t" b  H           dims(group_ind) = [];
; K1 l! X6 o4 s9 J7 I1 g       end5 Y* n7 M$ L5 e* `0 R' M
   end
( ^' c* H5 u, C: o" o( g# Y" T' c7 Gend
3 X7 V+ l! g; [. z* I5 r6 c
0 w) Q9 N/ @$ P/ G* q$ v0 m% g+ \. B8 {* x$ N; e/ M
analyze.m' c. L  q: z" [
4 _/ J4 j! [  \6 \1 K
% Author: Mohammad Nabi Omidvar4 a  i) ?# w! ]7 r( W# d' W
% email address: mn.omidvar AT gmail.com. a, c  H# Q  i# }; Z4 G6 @7 Z: X
%. S9 S% N& {- j
% ------------. G+ z, `( ^4 N6 t
% Description:( h3 Q7 L8 [* \: d5 J
% ------------
2 s( j0 V+ q! [8 L8 j0 n% This file is used to analyze the peRFormance of the differential
+ `& b8 M. y! `) Y% grouping algorithm on CEC'2010 benchmark problems.4 f8 D# D! A+ E, i
% This program reads the data files generated by differential ' {  v7 ^  r+ n: r, s
% grouping and shows how many variables from each formed group% \# {/ I  ^- R2 P; }8 f8 u
% are correctly identified and to which permutation group they
9 D  m' h. |, j/ T% belong.
0 C* d( o( e( D7 ?9 D3 T9 f% O: o%
3 ?3 E5 d# {1 @! s) j%--------+ Z, Q9 y# \) S0 ?
% Inputs:4 h! j5 r* H* Q- |& E
%--------
& L* `$ u0 Z% I5 F# u- g%    funs: a vector containing the functions ids the functions that you
/ h6 b: H( V! {4 R& Y7 n+ j%          want to analyze.7 I% K' e( c  Z5 b
%
1 a- e* \8 v- j- l. d( S! c% -----------( e+ v7 F1 b/ R6 u
% References:1 M; B, q5 i+ }6 e& Y% F( R" L, i; w
% -----------
/ P  h1 [$ c% h5 d4 F; n0 q2 ]% Omidvar, M.N.; Li, X.; Mei, Y.; Yao, X., "Cooperative Co-evolution with% m5 Z4 ?$ E# v& Z) I9 L! z% @
% Differential Grouping for Large Scale Optimization," Evolutionary Computation,0 Y6 r* v: P6 Q. `
% IEEE Transactions on, vol.PP, no.99, pp.1,1, 06 z4 p& c' E* r( O
% http://dx.doi.org/10.1109/TEVC.2013.22815437 f- u' e* `+ y5 F$ y5 `, J3 R5 P4 m
%, P; Y0 @- C! ]1 |
% --------& v1 e- V, H! m* b
% License:& I) ^, R" s0 l+ q! Q3 q
% --------6 Q: C' P" Q3 g8 w
% This program is to be used under the terms of the GNU General Public License 7 l7 x. W) W9 \) h) ~. j; d( P
% (http://www.gnu.org/copyleft/gpl.html).
& |& {% A' Q) y% Author: Mohammad Nabi Omidvar
/ G4 g9 ^% x; K, G+ F+ w' G0 R- `% ?% e-mail: mn.omidvar AT gmail.com
5 s. J# h5 u* q2 F( z3 m2 C% Copyright notice: (c) 2013 Mohammad Nabi Omidvar' \* P+ y8 v. u8 T. x

9 v% o6 @0 z: _- I* P1 I- d
; y! R# @  [; v% r- q$ t( ~% |2 Tfunction analyze(funcs)
9 k& ]$ U! Y* p# p4 b' E    more off;
8 l; g6 V5 Y6 e8 K. S% o1 @/ e) I5 S4 c- |; E/ S
    % Number of non-separable groups for each function in CEC'210 benchmark suite.
& Y2 n% i" W/ j. ]; y  z2 O    numNonSep = [0 0 0 1 1 1 1 1 10 10 10 10 10 20 20 20 20 20 20 20];1 {9 g3 s" k8 y2 `' U
: Y, c* y% H6 t
    for f=funcs' S1 f/ ]2 O( i' s- I1 N7 p* M, A% _
        filename = sprintf('./results/F%02d.mat', f);4 E  G! W8 E# u' m0 B/ E
        p = 1:1:1000;/ X. U4 }4 m9 B& N
        load(filename);1 G! w7 b: T* e# \* L9 G3 V7 \

3 ~1 c& M. U! {& b; z        mat = zeros(length(nonseps), 20);6 r3 E: Q5 i+ u/ b! H8 [. u
        drawline('=');0 o( a( u, r! n2 K7 |" x
        fprintf('Function F: %02d\n', f);
8 W# R3 b/ {# v# q9 r        fprintf('FEs used: %d\n', FEs);
$ i5 u8 [2 t0 s# {  j& G2 k. b2 R        fprintf('Number of separables variables: %d\n', length (seps));% L% y$ Y& A; G" }% E7 |
        fprintf('Number of non-separables groups: %d\n', length (nonseps));& u* n0 {+ n2 k4 @; C  C# }

. Z! }) C% j4 s; X$ d5 z        filename1 = sprintf('./cec2010/datafiles/f%02d_op.mat', f);
: \7 D4 q1 j. d/ G8 r" y        filename2 = sprintf('./cec2010/datafiles/f%02d_opm.mat', f);
) M( ^% L( N9 n4 }& K# `* l        flag = false;* x" G) k% U& P# @4 I
        if(exist(filename1))
8 W0 V! W/ u6 [+ m' {& I* [            load(filename1);
0 y9 Y# H: G) M) F, h            flag = true;3 e  ^4 `7 h+ ~( P
        elseif(exist(filename2))- r9 `0 d( d& X: e# W' |2 Z! \% q5 i
            load(filename2);
2 ?9 E  t7 J4 X& I            flag = true;0 s  a' ^" ]9 M  V
        end
* ~+ N1 J5 C3 p0 @1 ]$ x4 S- M5 J: C$ s# l5 G6 R
        printheader();' ~  f3 D) P6 O! w" V% E
" l& T" i8 D7 B+ _, R
        for i=[1:1:length(nonseps)]
  \5 Z  _& w9 W  K# g4 [7 p            fprintf('Size of G%02d: %3d  |  ', i, length (nonseps{i}));
* D" ?% T- t+ ~2 m4 \! w* i            m = 50;& e4 [) `% j  L
            if(flag)
" S' D# a2 I3 M) T+ v1 L  R3 U, l                for g=[1:1:20]
/ V# }5 u; ~1 f" V3 ~                    captured = length(intersect(p((g-1)*m+1:g*m), nonseps{i}));1 q! O% ?6 |  W7 ~9 i8 _7 D& _" ~
                    fprintf(' %4d', captured);
* u- C; F. b4 j/ W# f$ X, t                    mat(i, g) = captured;% V: p! Y, S' o' K
                end2 z( j% S2 E" `, K+ b' c8 j6 V+ r7 T$ ?
            end6 T7 L" _0 ?0 k( w) r% ?
            fprintf('\n');
' H0 F" e# W5 ?' [2 W        end. o% ^) N' w6 A3 }! ?7 i, U' P
/ S0 Q* N* r0 I- z2 ]
        mat2 = mat;4 a' z- z6 G0 P, @
        [temp I] = max(mat, [], 1);9 s3 K: v1 z, U
        [sorted II] = sort(temp, 'descend');
# p  O" e4 Y+ b; ]4 h6 K        masks = zeros(size(mat));
+ V, x/ U  w9 ^3 p" s; \% a        for k = 1:min(size(mat))
$ z  J6 y7 h0 p0 G* Y" B            mask = zeros(1, length(sorted));2 z7 [1 t4 S- z. q
            mask(II(k)) = 1;
; c  U- s" X+ w  x' }            masks(I(II(k)), :) = mask;
/ `8 W: H! }3 Y  v9 G+ d/ s            %point = [I(k) II(k)];
& U8 L$ A4 E/ w' b& [            mat(I(II(k)), :) = mat(I(II(k)), :) .* mask;
5 x6 Q; i, j, C0 P' m9 b9 q3 @            [temp I] = max(mat, [], 1);
8 N, r1 D  X! l- E7 x, U            [sorted II] = sort(temp, 'descend');
6 R$ f& U5 V7 {/ U# j9 R        end% t' W! X( ]0 ]) [0 s
        mat = mat2 .* masks;: b( H( ^! q- y( P! ^
        [temp I] = max(mat, [], 1);* F: C, m2 X/ y; ]: f9 F
        if(ismember(f, [19 20]))! Y- `. Q2 Y2 K; |
            gsizes = cellfun('length', nonseps);
5 ~* p2 _9 w( A9 o* K1 e4 F            fprintf('Number of non-separable variables correctly grouped: %d\n', max(gsizes));; R+ X, H) F& k
        else" \: b& A  ~" y/ M% ]  ?( O
            fprintf('Number of non-separable variables correctly grouped: %d\n', sum(temp(1:numNonSep(f))));
- a& _7 n1 `, \4 Z- ?        end4 M0 Q9 E) }/ ~/ v$ h
        drawline('=');
/ C8 ]% {& D4 a* s8 t5 c        pause;9 `! J, k% x+ |7 b! J
end# q- Y( ]& n8 x+ R

& K% M4 X6 ^% |0 F+ _# \  H- Hend1 c3 r  O9 \4 j
% Helper Functions ----------------------------------------------------------- w: i0 y/ a9 _$ s, P) Q+ w5 ?
function drawline(c)" m& b. u7 Z, K- j
    for i=1:121% M3 V8 [6 H+ i2 {$ G" r
        fprintf(1,c);. V- h) C/ O: @  v8 n6 o4 w% c$ l
    end* d4 G2 F0 N& m! Z1 ~
    fprintf('\n')  P, b3 F) v7 g8 Y" _: w/ }
end
; \3 u/ z' u9 I/ X
  c5 B  Y2 j% k' n$ dfunction printheader()
( b" @& b  d" o% o    fprintf('Permutation Groups|  ');
$ `) `' p9 T& k- @9 x. _& ?    for i=1:20
% B5 t6 I+ c* Q0 d, e" y/ @. t        fprintf(' %4s', sprintf('P%d', i));
: Q3 ?( A& j9 q    end . a. _! m7 u0 B
    fprintf('\n')
7 D3 |; _+ [- d3 I2 t* j) h" Z    drawline('-');# t7 I0 f: D0 J+ H
end
4 A3 K5 ]) ~/ C  d- ?1 s% End Helper Functions ------------------------------------------------------/ n% D& M5 q; V) T9 a
( T- g% |& U$ f6 [, n: Q

* c8 d( y$ T5 ^6 \" U1 O
  • TA的每日心情

    2019-11-29 15:37
  • 签到天数: 1 天

    [LV.1]初来乍到

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

    本版积分规则

    关闭

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

    EDA365公众号

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

    GMT+8, 2025-11-24 12:38 , Processed in 0.156250 second(s), 24 queries , Gzip On.

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

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

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