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

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

[复制链接]

该用户从未签到

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

EDA365欢迎您登录!

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

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

6 f: J/ a: H; A& c' j索引词:合作协同进化,大规模优化,问题分解,不可分性,数值优化 * C' z2 _  X0 j! f
" O8 A+ I4 m# M. W" m$ v. L0 ?9 h

( L6 b" r. ~! k4 i, l/ m0 nrun.m
+ B3 B( f( L1 V. _0 M  ^1 m" x0 c/ B% \9 J; y
% Author: Mohammad Nabi Omidvar
! d2 l* V$ ^" }: c, }7 K% email address: mn.omidvar AT gmail.com0 B* x) H3 O7 ?8 G5 g# _7 v  y
%
& g8 I6 b$ u) w; ?% i- a4 F% ------------
" R2 `  f& R. Q% Description:& n8 r& b4 ~. ~
% ------------
& O. B: Y7 q: b# A; n% This files is the entry point for running the differential gropuing algorithm.$ L( C4 @" ]2 ~, {3 e5 R, ?8 j
8 A) v+ D% R" ?
clear all;
7 g" N2 l' c, K% U9 r9 _9 j3 w1 j& V* ^6 ]% f& F. Q  g6 L/ x
% Specify the functions that you want the differential grouping algorithm to
6 I0 h- w  w+ V) e+ n' h% identify its underlying grouping structure.6 W6 Z& r6 l8 ~) h+ a0 q
func = [20:-1:1];7 k& R6 S  Y& F/ K
for i=func
7 I! b5 N3 ^: Y: ^! L    func_num = i7 H8 Y" N. y+ l6 i5 @- d

; L" M! @. u8 b1 P$ B; k6 Y5 D    t1 = [1 4 7 8 9 12 13 14 17 18 19 20];" D, w4 ]0 ?& E! t, _# o8 `9 h1 t
    t2 = [2 5 10 15];
3 s) B) [3 d: F% ~, Y    t3 = [3 6 11 16];
% L, p( F4 ~$ e$ `# E% G+ k  b( x* ]1 x  E' z4 y% H$ n/ `7 h6 T
    if (ismember(func_num, t1))
0 c% J" e5 }) p+ g9 S        lb = -100;
% v, S: f9 M/ K+ u        ub = 100;% |' H; h" M; [& c$ o
    elseif (ismember(func_num, t2))0 m0 V9 Q( o7 x- @. K
        lb = -5;
( @( |/ G" c, M% f* E        ub = 5;+ p6 R3 |9 c4 X( I! F8 _9 D
    elseif (ismember(func_num, t3))
  B' Q' \+ I  h' b: I) P0 P8 V        lb = -32;# Q7 o+ b) O4 e7 M- n$ ]9 B
        ub = 32;
& x: Q' O' h+ |+ v9 n4 }! t- e    end. s1 b! D: _* C7 C5 |4 _2 h
3 j6 I" L3 g# Z8 d+ n6 G1 T; U
    opts.lbound  = lb;
/ h/ B& K, o; A% w9 U: ]    opts.ubound  = ub;
: l, A( o/ l/ T; K  B! n- Y" x& X    opts.dim     = 1000;+ i$ v7 |) k+ n2 B
    opts.epsilon = 1e-3;
$ z" ?' O7 \* l' A: ]8 H( {1 r* U) p% ]+ q! {
    addpath('cec2010');5 @+ z* `6 A2 q
    addpath('cec2010/datafiles');  K- _# `6 k% d% ~* h3 _
    global initial_flag;* B/ ~$ ~0 m4 B$ x0 @5 |
    initial_flag = 0;8 [$ c7 h0 T3 s- m# ?# ^* f+ m' a

: [9 ]4 ?* r0 H6 D6 K4 d    [seps, nonseps, FEs] = dg('benchmark_func', func_num, opts);' |5 V% y3 o8 _# H8 @2 o- t3 O" n

/ Y( N: w2 ]5 O" s" E4 x9 @. O; k    % filename = sprintf('./results/F%02d.mat', func_num);/ S, E$ y' o+ j
    % save (filename, 'seps', 'nonseps', 'FEs', '-v7');
+ h4 G, F' x& h! s2 K1 U  c! send  g; Q" b0 P8 t

1 h/ ?9 F5 t( k0 u0 a& \2 L6 _( k% H, q8 N# t4 y8 E5 g" ~' T& r
dg.m
) B3 k  z, C, R2 U2 }; q1 v# J5 l3 X; d+ J/ ?5 ^4 c
% Author: Mohammad Nabi Omidvar* C5 V* Z2 m. V/ @
% email : mn.omidvar AT gmail.com2 ~9 |4 ^3 B9 s  D6 I
%
& X; e+ @/ v0 Z# B% ------------* N& ?- l# y) `1 T7 G- i5 E( Z
% Description:6 _! G# s- [( k9 f$ j( z
% ------------2 T  X0 O1 \' i, k: L1 N! X
% dg - This function runs the differential grouping
) x4 |0 F' d; J1 T& h4 }%      procedure to identify the non-separable groups
) e* p$ ~2 `7 b$ b& A9 i%      in cec'2010 benchmark problems.o
$ }6 {: v' i7 k%6 f% C' F% t4 t$ L5 D
% -------
. v0 ?, g' S- U; E: B% L% Inputs:( `) }. x/ D9 U4 w" S% Q+ W! U$ x# r/ n
% -------
- F) \5 Q& k$ q; H, L( h( r) h%    fun        : the function suite for which the interaction structure
! l- ^  ?$ h# n; _: D/ v%                 is going to be identified in this case benchmark_func " J$ z! o5 t5 X3 {3 r8 N/ v# k' A
%                 of cec'2010.
# q. f1 {$ ?+ k6 v4 K+ d8 T%& r: X6 M% u/ d
%    fun_number : the function number.
, J' l$ R( m; |" G2 R7 F%2 G" p( Q- |$ b  p& Z) ?. R  e" r
%    options    : this variable contains the options such as problem
0 o; [! |5 j0 w- o* ?9 ~% o5 {%                 dimensionality, upper and lower bounds and the parameter - T( O# s$ R0 c$ ?5 B8 V/ v" n. a
%                 epsilon used by differential grouping.
% h" `% h: Z! b%    input3 - Description5 _2 D, x7 ~8 I  ]8 k" U; ^
%
  y5 Z5 I% p) L$ r, R- l+ h% --------$ P" j2 c) Y" S! a9 F
% Outputs:
6 @1 _6 Z( R+ ^( t9 n2 H% --------3 G! O6 l# h1 N1 T/ g
%    sep      : a vector of all separable variables.
1 r4 N% k/ A8 y$ g2 f* }%    allgroups: a cell array containing all non-separable groups.* g% }' i8 r% h8 @6 ?+ D2 h* y4 E
%    FEs      : the total number of fitness evaluations used.2 M! W/ Q0 T9 z" m# Z3 g
%# j5 k! R: K( A, ]7 E* Z# n$ O
% --------
" d; T$ t# J3 Y! d; Q/ p% License:3 S' f& ?+ W( P, p; G7 `
% --------9 o7 u; I' g7 |' v0 ~7 `( w
% This program is to be used under the terms of the GNU General Public License
' y: ^3 I) h2 q5 U# Z- ^, q; w7 g% (http://www.gnu.org/copyleft/gpl.html).3 a6 @5 s# Q& S; Z% `" {
% Author: Mohammad Nabi Omidvar
* i* N  r/ ]1 |7 T% e-mail: mn.omidvar AT gmail.com
) g; T0 n# A7 Q* X; H/ [% Copyright notice: (c) 2013 Mohammad Nabi Omidvar
3 B5 b% G* U) E6 _  h# L7 M+ V  c  h1 _3 F/ W

) [0 F7 Y6 |5 Wfunction [seps, allgroups, FEs] = dg(fun, fun_number, options);2 h- |" i0 [+ }% e1 N0 x
   ub        = options.ubound;6 K, j, T$ Z% M# p( B! E' P; t" c' G
   lb        = options.lbound;3 z5 b8 A9 s1 m# Q- _
   dim       = options.dim;5 c) C. y0 p# h/ S% S
   epsilon   = options.epsilon;
/ _: m" f8 S2 k3 {4 M6 B# s   r         = ub - lb;
7 I& N0 ?/ m2 E* K( R   dims      = [1:1:dim];& n! U7 j" h4 s% c
   seps      = [];$ F: p2 V3 Y+ c0 \
   allgroups = {};$ n" Y) P7 d0 k# D7 c5 D# N& r% w
   FEs       = 0;
  S' d" ]; z3 a% Z- H! |- b' V! a) }5 b; p
   while (length(dims) >= 1)
9 ^, Z2 k: [$ Z1 B4 u8 f+ L       allgroups;/ ?- g# T( `5 |: T+ B
       n = length(dims)
2 l3 \# i' i$ b5 p, b5 k5 E$ a       group = [dims(1)];
! h& m# Q9 l! ~5 K1 @. Q2 E, a3 d, M3 p; d       group_ind = [1];. d3 @5 Y" p" N( k* M! H; e$ {

9 E3 ~% e- {$ B& f$ I/ e) n& Y       p1 = lb * ones(1,dim);
3 d- d' s3 X7 W& W" N       p2 = p1;: L( A8 A  |, r& R9 h
       p2(dims(1)) = ub;
& I/ {- ~7 W5 J7 w& r. F' n1 D# B$ D  R( S" I4 N, K
       delta1 = feval(fun, p1, fun_number) - feval(fun, p2, fun_number);
2 h; a2 \: Z6 i. a+ H2 R5 N
% X, j5 c% ~' x9 Q, w1 T       FEs = FEs + 2;( h& r( I: A$ R6 J" h

! L# b0 A: p, M- y5 i       for i=2:n
1 q& x; U% m% L" }# f, d) q, Q           p3 = p1;
' [' I& P5 D4 l           p4 = p2;
6 [& c+ f3 I* G7 G& u8 `/ V) W6 H" E( S! A; Q# z5 G! h) `
           temp = 0;4 {5 o" ?8 K, w: D3 K
           p3(dims(i)) = temp;7 n! R" O1 ]8 k3 m0 C9 F1 r8 t
           p4(dims(i)) = temp;
! M6 p; ?" K) }) N% d+ M6 i0 W) r. u+ A# p
           delta2 = feval(fun, p3, fun_number) - feval(fun, p4, fun_number);  n! D2 J: C8 @4 a/ r! {) U
% V8 h$ _$ \. Y
           FEs = FEs + 2;
% D  S3 I% @7 A9 e
* U; O5 b% }& \$ Q" S$ p! e' q* x           if(abs(delta1-delta2) > epsilon); e" x; j* l, i7 ]* d7 Z
               group = [group ; dims(i)];# _$ p% K: D" d; K8 m6 C
               group_ind = [group_ind ; i];
: {, O" k! p8 `           end3 ^* A9 b9 v6 l% D2 z
       end. Y1 s" [" A9 Z& H

7 w/ k( G" @. Q4 b, C9 w  R       if(length(group) == 1)5 q# U4 S. Y% B$ M
           seps = [seps ; group];
% C" _( q8 P, \6 A6 e& g       else1 E7 A; k: y( C
           allgroups = {allgroups{1:end}, group};. R, O0 h7 @' _: I: y$ E
       end7 H) S( h- Y( P, Q3 O0 G: o

1 _" \4 x: f1 M' P) R       if(length(dims) > 0)0 h& U2 b( R; N
           dims(group_ind) = [];
6 ~/ Q8 v; P8 ?, |* E' o       end: V, ~- h4 S, x! U  Z) w, a4 D
   end
2 p7 }- s$ ^4 I$ u, [4 P& B3 |end
4 M* c3 r( O, y, A) W% u2 z8 q+ o  D; H9 V1 ^

9 t% \8 F' H2 O# R* uanalyze.m
0 {* ~0 V; Y; q8 T3 e  n. f6 Q# l; Q5 L7 u# ~# {2 I- `! s0 l. T
% Author: Mohammad Nabi Omidvar/ R; j$ Y6 Z" S6 L- y8 ]
% email address: mn.omidvar AT gmail.com' B8 g) z4 w& P+ U* g
%
% h5 a+ f$ n% W& Z9 `7 A2 G8 ]0 }% ------------5 S$ l" r' U3 f( @/ V8 g( W& y
% Description:
9 h9 R7 Q( x% @5 N% _% ------------! C# Z& o9 I7 o& m9 f8 h
% This file is used to analyze the peRFormance of the differential9 C+ E# ^# i5 C) ]" W2 v3 q
% grouping algorithm on CEC'2010 benchmark problems.
, w5 Q% D; j2 k  V3 ^$ }- p. _- u! y% This program reads the data files generated by differential
* O$ C& o/ ]0 }% n* c; h. A% grouping and shows how many variables from each formed group
8 d+ ?3 d- X  M0 z0 i% are correctly identified and to which permutation group they0 e6 H0 F6 g3 H- [9 I( g
% belong.
9 M& k' U8 R' H* N%6 [  S0 R0 v( \0 H. ^
%--------
, p/ P0 F7 w, g! k2 ~0 K% Inputs:7 P1 e% h: W( d' F/ v; E
%--------
3 T! L* u: {4 T. K& A%    funs: a vector containing the functions ids the functions that you
6 |9 F+ Y+ c4 c5 O7 f/ N%          want to analyze.+ B+ _; q- A$ ], a% _
%! T* P' U3 U/ s7 u
% -----------
% S2 c. T7 r& A; `% References:
" R0 @; u1 f& Z7 p. B, z6 y0 O% -----------
0 M" Q+ n8 Y& R% Omidvar, M.N.; Li, X.; Mei, Y.; Yao, X., "Cooperative Co-evolution with
" M! N/ Y1 N$ O1 k3 v# F7 ^9 P: y$ V% Differential Grouping for Large Scale Optimization," Evolutionary Computation,
) Q% z0 A8 }- e9 X/ w6 I) m7 X% IEEE Transactions on, vol.PP, no.99, pp.1,1, 0
/ b% M. `  n( r: h% http://dx.doi.org/10.1109/TEVC.2013.2281543
) F- c$ v, ~0 ?4 D4 t, a%
. h' O  _1 u4 A) V% --------
) H& o/ w5 m& o. `% X3 z, c6 @# u% License:
) @5 q0 |& h; M8 Z# |7 o/ w% --------
) q0 V8 J* @; i8 v3 R6 J# [% This program is to be used under the terms of the GNU General Public License
/ A2 w0 x: b8 @' U5 C7 T2 W% (http://www.gnu.org/copyleft/gpl.html).6 c0 r0 k1 a5 n; M. O* p) A
% Author: Mohammad Nabi Omidvar
8 z" b4 g$ [! C% e-mail: mn.omidvar AT gmail.com
6 h) I% E" X& Y8 D, ]: }% Copyright notice: (c) 2013 Mohammad Nabi Omidvar
( U% h8 R4 L% e4 x; J( G, ^
$ [# M, i" C2 Z: Y
1 a- {9 e% F9 K/ X" Afunction analyze(funcs)
& _1 l! w9 H8 u) t+ U0 B2 C4 i    more off;
( V  X; P+ ]' O: s& \2 n- }+ l
) q% D, h4 A( ?! v/ w7 a/ ?# U/ |    % Number of non-separable groups for each function in CEC'210 benchmark suite., R& H) D# f: n7 s  o7 z/ p
    numNonSep = [0 0 0 1 1 1 1 1 10 10 10 10 10 20 20 20 20 20 20 20];
% A0 w* X8 \/ N% P7 T8 q$ g
: a$ B3 C1 D3 g    for f=funcs
$ n. g3 l# x4 E8 c. A" D9 S        filename = sprintf('./results/F%02d.mat', f);
- [/ a6 b# R/ [, W8 g( p! v        p = 1:1:1000;
% b4 I7 {2 n. J: \        load(filename);* _+ K$ a9 b2 Q0 x
3 [+ W0 W* T1 x6 q8 c6 d) E% i( _
        mat = zeros(length(nonseps), 20);
8 F6 ^/ J2 g* S# |; a% v) X3 M        drawline('=');
. M  i1 ]9 V3 U7 }* \$ r        fprintf('Function F: %02d\n', f);
+ c0 K0 z4 a4 m" K$ U1 ~        fprintf('FEs used: %d\n', FEs);( @" H$ n5 Z9 O1 g- i* b1 q% l# B
        fprintf('Number of separables variables: %d\n', length (seps));) l, i# ^  {; ?; U9 U4 i. }% G4 O
        fprintf('Number of non-separables groups: %d\n', length (nonseps));
& }) f4 v* ?4 h) }; C
  C8 L" u1 H+ e$ J) K( R        filename1 = sprintf('./cec2010/datafiles/f%02d_op.mat', f);* V: y& g7 v& U, v& B" W9 V! V* d2 I
        filename2 = sprintf('./cec2010/datafiles/f%02d_opm.mat', f);
! t8 l" \( q! {8 n7 ?% ?        flag = false;5 ?  X+ q7 j" o
        if(exist(filename1))( s4 }7 I. v; P8 E- I' p
            load(filename1);
7 m; _* s) `' ?' G( O( k+ N; O            flag = true;
1 b% d; H% N; b5 l        elseif(exist(filename2))( J/ R7 T7 W& ~5 x- F5 E
            load(filename2);2 a' q  \/ Q! c: N
            flag = true;: y9 S- Z7 o8 Q2 [2 k$ |
        end
* |+ l# ^+ T. \/ D/ E1 P2 h' Y7 J% s5 U$ D
        printheader();
  v* T% k1 i& o% ]* E1 g  s+ o# A) g- I2 O$ M6 ~$ ?# N+ u# j
        for i=[1:1:length(nonseps)]
7 G% n. \! {1 Y' @1 q( ^+ y1 \8 c5 |0 N            fprintf('Size of G%02d: %3d  |  ', i, length (nonseps{i}));
, q3 X: X1 {: H$ x, o, h            m = 50;0 _) f# @8 ?. W/ d4 W
            if(flag): o; u9 ~( M8 ~4 n0 f$ d  C* I! Q% ^
                for g=[1:1:20]
. V6 q- d: O% Y, x& H+ U                    captured = length(intersect(p((g-1)*m+1:g*m), nonseps{i}));
7 F& d2 \3 B) a  {6 X( k$ [/ L                    fprintf(' %4d', captured);
0 `7 z0 s0 d7 E1 `7 N7 e6 ]- ?                    mat(i, g) = captured;
$ R, Y3 X2 m3 W; t0 g! O                end
9 y) ^0 y" i2 K, m            end
- U! r0 C& R& \/ {9 _            fprintf('\n');
/ ^6 m6 P4 w8 `; d        end
6 e' V4 g1 W! _3 l5 b
9 K' i9 y& ~- J3 R        mat2 = mat;* f, M0 N: o: Q5 Q& x) Y
        [temp I] = max(mat, [], 1);: t9 g+ B+ a* @8 X; `4 }, s
        [sorted II] = sort(temp, 'descend');) U- D* P, k1 N* h
        masks = zeros(size(mat));
) G5 q2 {6 p% O3 z0 x2 d! j        for k = 1:min(size(mat))
# F" E: f1 x7 u* B4 Z  l: ~  O" V            mask = zeros(1, length(sorted));# l1 h. |9 D2 |) O) _/ F
            mask(II(k)) = 1;
, S/ r3 r9 `% `5 M. s7 [            masks(I(II(k)), :) = mask;: l' L% g+ Y5 f6 L6 r# R
            %point = [I(k) II(k)];
* O/ S0 y: x* B. \3 j3 G            mat(I(II(k)), :) = mat(I(II(k)), :) .* mask;
- X6 S& c7 i: ^1 `6 x            [temp I] = max(mat, [], 1);
5 J3 S4 @& B0 |8 ?: S9 {" F: u3 [7 K            [sorted II] = sort(temp, 'descend');
; W, V3 i5 b, }- Y+ C        end( H, |$ v$ \8 P2 t- i
        mat = mat2 .* masks;
) e- j6 j6 g" J        [temp I] = max(mat, [], 1);
$ |0 H' l/ t" U+ j4 t        if(ismember(f, [19 20]))
' S. [, f% K, |$ V            gsizes = cellfun('length', nonseps);% L8 ~- U6 _" ^8 B! Y9 X
            fprintf('Number of non-separable variables correctly grouped: %d\n', max(gsizes));
; F  Y% P7 c: U1 ~        else8 B/ }6 U) T2 x% C; L+ s
            fprintf('Number of non-separable variables correctly grouped: %d\n', sum(temp(1:numNonSep(f))));
: s8 M$ x3 I% ]5 p( o' P- M        end+ k& ^+ d: i& P/ d- g) `
        drawline('=');7 P: J) g% s/ w' T4 ^
        pause;
" J" D' Y& A* e/ a2 b! {. F, V- {end( d: O, a# f$ R, K& ]1 C
# m: l3 `1 Z- z( Y! M0 h' e1 p# p
end
( _2 i3 P6 i5 F& N5 [5 J% Helper Functions ----------------------------------------------------------; J7 {% b; s# ~7 ?/ Y. w
function drawline(c)
: ~5 D7 x  W3 A8 _    for i=1:121
# P7 P5 S6 W5 u% F        fprintf(1,c);$ {. j) m# c+ R
    end- \9 [& L" p) G7 N
    fprintf('\n')
+ m! g; u8 Y% g" C6 xend
6 K& R9 [7 P9 R- n2 I. u- [( T" n/ i" J- L
function printheader()/ a5 L2 x% S: d7 |
    fprintf('Permutation Groups|  ');4 X. k9 i/ K6 d
    for i=1:20# T3 j6 @/ [( M5 N7 Q  \
        fprintf(' %4s', sprintf('P%d', i));/ z+ j: H; ~3 `* f+ K1 Q0 ^
    end - X- q9 x5 d5 r0 V
    fprintf('\n')9 H. o1 p; V% P1 F& v; C5 C
    drawline('-');
9 L( \9 x3 O1 f3 Y- H" Fend% y! n6 G4 ^1 c" T% Q% V  i
% End Helper Functions ------------------------------------------------------- h0 [5 @: D. j& |! Q/ {

! A' q% C3 O! ~7 s7 k. k" Z& J' u% T/ u! c
  • 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-8-23 21:02 , Processed in 0.140625 second(s), 23 queries , Gzip On.

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

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

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