|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
/ u% A4 D" i; h8 Z合作协同进化(Cooperative Coevolution)是求解大规模优化算法一个有效的方法。将大规模问题分解为一组组较小的子问题。而合作协同进化的关键是分解策略。
* d4 p+ s. F% H2 P+ n9 k- T6 U3 j9 ^! q% A) x
NSGA2算法是一种多目标遗传算法。此文章是随机固定分组的合作协同进化利用NSGA2来优化。7 R- Q5 _, k/ |) {/ H
" _ V4 R4 N8 N1 r- w
比如有12个决策变量,我们固定随机优化3个决策变量,那么就将决策变量分成了4组。
l4 h, }9 ~- }4 P2 P: ^5 ]5 E4 R& i& @
MATLAB主函数代码:
4 G3 D7 v- h6 y) B2 Y2 V: c$ `0 |( S) x4 \
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- 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[color=rgb(0, 111, 224) !important]: 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'); q/ ?( t# m4 J% J4 S! Q- D/ g
" p# N5 q+ C1 ?$ S
+ r2 V3 M0 C! y% Y3 W; f$ i( G随机分组代码:
, h1 q+ ~) c9 c( S! f
' L N2 T/ D* _: ?+ d ^7 x- % 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+ t3 c1 M. V& E0 {+ h: a* ~' \
|
|