|
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
; L, f" c+ E- _* h- H& B+ K合作协同进化(Cooperative Coevolution)是求解大规模优化算法一个有效的方法。将大规模问题分解为一组组较小的子问题。而合作协同进化的关键是分解策略。
9 c6 D! W( e) L. Q! I& h. r7 s
: u6 C/ _* ^; f g1 o$ v/ bNSGA2算法是一种多目标遗传算法。此文章是随机固定分组的合作协同进化利用NSGA2来优化。: e: K2 j0 V4 ~) b& T* j
5 s( L3 V& g) m( S9 s0 R比如有12个决策变量,我们固定随机优化3个决策变量,那么就将决策变量分成了4组。. f& k( e- a% V7 U# j' h. X
9 k2 I! [9 y# K
MATLAB主函数代码:
9 p5 l% i# ]7 U; ], A d" g5 h' W$ v n
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- clc;
- clear;
- global pop
- pop = 500; %种群数量
- gen = 2; %迭代次数
- global M
- M = 2; %目标数量
- Dim=22; %搜索空间维数(未知数个数)
- sub_dim= 2 ;
- global min_range
- global max_range
- min_range = zeros(1, Dim); %下界
- max_range = ones(1,Dim); %上界
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- divide_datasets();
- global answer
- answer=cell(M,3);
- Dim_index = ones(1,1)*(1:Dim+4);
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- chromosome = initialize_variables(pop, M, Dim, min_range, max_range, Dim_index);
- chromosome = non_domination_sort_mod(chromosome, M, Dim);
- result = 1;
- while gen ~= 0
- subgroup = rnd_divide(Dim, sub_dim);
- for i=1:length(subgroup)
- subgroup{i}(sub_dim+1)=Dim+1;
- subgroup{i}(sub_dim+2)=Dim+2;
- subgroup{i}(sub_dim+3)=Dim+3;
- subgroup{i}(sub_dim+4)=Dim+4;
- [temp_chromosome] = nsga2(chromosome(:,subgroup{i}), sub_dim, subgroup{i});
- chromosome(:,subgroup{i}(1:sub_dim)) = temp_chromosome(:,1:sub_dim);
- end
- chromosome = nsga2(chromosome, Dim, Dim_index);
- chromosome = non_domination_sort_mod(chromosome, M, Dim);
- gen =gen - 1;
- progress = 1-gen/10
- end
- plot(chromosome(:,Dim + 1),chromosome(:,Dim + 2),'*');
- xlabel('f_1'); ylabel('f_2');
- title('Pareto Optimal Front');+ s4 V" i) w' X d0 Y! }
8 T( S" j0 D' d1 b) | a1 ~
3 {- X! \- e( n4 Q% q6 C
随机分组代码:9 w {6 m: m7 I3 l" C+ s' c
+ M% S3 C/ I7 \
- % random grouping
- function group = rnd_divide(dim, subdim)
- dim_rand = randperm(dim);
- group = {};
- for i = 1:subdim:dim
- index = dim_rand(i:i+subdim-1);
- group = {group{1:end} index};
- end
- end
, ]% S) c/ o0 Y3 H! w. K- n1 b
& Q2 _% |+ z& j7 x* G- Y: |: N" w& {( c4 ~8 \3 S. O8 {3 o4 I
8 R2 |* ]1 L% r1 Q+ u) m
/ e, A: s2 I9 H# O7 ?. q* N8 ?- F% g$ d/ `
|
|