|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
A t3 ]4 A, ^# j6 f合作协同进化(Cooperative Coevolution)是求解大规模优化算法一个有效的方法。将大规模问题分解为一组组较小的子问题。而合作协同进化的关键是分解策略。8 x9 }# c, o7 }+ L8 g" N, y( W
8 k) y; @* ~( a5 n/ E% VNSGA2算法是一种多目标遗传算法。此文章是随机固定分组的合作协同进化利用NSGA2来优化。6 S( M: a4 e5 S1 W8 Z9 k
7 Q- V. m5 L6 V+ Q7 s比如有12个决策变量,我们固定随机优化3个决策变量,那么就将决策变量分成了4组。
( i2 f0 ]7 O; b+ y7 R$ R: T3 g( F, h* c; d9 K
MATLAB主函数代码:
! Z @2 L: w" w: G
1 Q; S$ i8 ^5 m: e8 B- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- 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');1 k* R9 G j p7 a! C3 e" e, p& F
( `1 w$ H$ b1 B( l* F
$ d1 B& T. ^ {# z, y
随机分组代码:7 O, M; |' M; D" Z" b! g8 o
' M% t' V( v4 n8 I6 v4 d; |# g$ M% m; q- % 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* `( O+ q# p& j, r
2 ?/ ^7 p1 y" N5 ?$ b
8 L, t3 \$ x' c0 P5 {
1 y& w/ y. j$ l) i0 ^
/ z% _1 v- g9 ~6 n3 V$ O3 @( C; H6 ~; ?% M/ p# h
|
|