|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
: ~/ Z8 T* E4 F& t+ \; v' I合作协同进化(Cooperative Coevolution)是求解大规模优化算法一个有效的方法。将大规模问题分解为一组组较小的子问题。而合作协同进化的关键是分解策略。7 V. v; T* J( h1 x; b* K+ U
! h' I/ w7 d; P. b* o5 b& @0 ]
PSO算法是粒子群优化算法。此文章是随机固定分组的合作协同进化利用PSO来优化。
7 i- r1 z1 E9 d/ I1 I1 w! M. {
) G' y8 S1 ]% ~9 L ~" R1 C比如有12个决策变量,我们固定随机优化3个决策变量,那么就将决策变量分成了4组。
7 \3 i, i) I; U4 }. a6 y' [+ b6 ~! V7 n/ u8 Q7 _
MATLAB主函数代码:/ D2 |; q7 r# l0 _2 ?
t) W3 _- M1 ?( c9 i9 j- clear;
- clc;
- format long;
- %------给定初始化条件--------
- global M
- global bound
- MaxDT=100; %最大迭代次数
- global Dim
- Dim=22; %搜索空间维数(未知数个数)
- sub_dim= 11 ;
- M=30; %初始化群体个体数目
- bound=1;
- %global answer %最后所有粒子的结果(包括特征与精确度)
- x=randn(M,Dim); %随机初始化位置
- v=randn(M,Dim); %随机初始化速度
- result = 1;
- while MaxDT ~= 0
- subgroup = rnd_divide(Dim, sub_dim);
- for i=1:length(subgroup)
- [sub_x, sub_v, temp_result] = PSO(x(:,subgroup{i}), v(:,subgroup{i}), sub_dim, subgroup{i});
- x(:,subgroup{i}) = sub_x;
- v(:,subgroup{i}) = sub_v;
- if(temp_result < result)
- result = temp_result;
- end
- end
- %可以在协同进化后进行一次全局优化
- %[x, v, temp_result] = PSO(x, v, Dim);
- %if(temp_result < result)
- % result = temp_result;
- %end
- MaxDT =MaxDT - 1;
- end4 e( p& m; n5 N4 Q8 B8 G( L
, s2 t& Q" ^: _3 Q1 [1 g- ~机分组算法" y7 Z) L9 n( P1 b; |
- % 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
- end4 b% W& a. }, i9 t, F
# N( R5 R$ z0 a9 {) R2 L# I3 d- b8 ]1 n其它函数依赖项与PSO算法相同。
6 I& K0 d; T7 D, @8 k& J1 A |
|