-
Notifications
You must be signed in to change notification settings - Fork 0
/
FDV.m
209 lines (184 loc) · 8.15 KB
/
FDV.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
function FDV(Global)
% <algorithm> <F>
% Fuzzy Decision Variable Framework (FDV) with various internal optimizers.
% Rate --- 0.8 --- Fuzzy evolution rate. Default = 0.8
% Acc --- 0.4 --- Step acceleration. Default = 0.4
% optimiser --- 1 --- Internal optimisation algorithm. 1 = NSGAII, 2 = NSGAIII, 3 = MOEAD, 4 = CMOPSO, 5 = LMOCSO. Default = LMOCSO.
% type --- 1 --- The type of aggregation function. If it is based on the
% MOEA/D algorithm, you need to set the aggregate function type. Default = 1
%------------------------------- Reference --------------------------------
% X. Yang, J. Zou, S. Yang, J. Zheng and Y. Liu,
% "A Fuzzy Decision Variables Framework for Large-scale Multiobjective Optimization,"
% in IEEE Transactions on Evolutionary Computation, doi: 10.1109/TEVC.2021.3118593.
% -----------------------------------------------------------------------
% Copyright (C) 2021 Xu Yang
% -----------------------------------------------------------------------
% Author of this Code:
% Xu Yang <[email protected]> or <[email protected]>
% -----------------------------------------------------------------------
%% Set the default parameters
[Rate,Acc,optimiser,type] = Global.ParameterSet(0.8,0.4,1,1);
%% NSGAII
if optimiser==1
% Generate random population
Population = Global.Initialization();
[~,FrontNo,CrowdDis] = EnvironmentalSelection_NSGAII(Population,Global.N);
% Optimization
while Global.NotTermination(Population)
MatingPool = TournamentSelection(2,Global.N,FrontNo,-CrowdDis);
OffDec = GA(Population(MatingPool).decs);
%% FDV
iter = Global.gen/Global.maxgen;
if iter <= Rate
Offspring = FDVOperator(Rate,Acc,OffDec);
else
Offspring = INDIVIDUAL(OffDec);
end
%%
[Population,FrontNo,CrowdDis] = EnvironmentalSelection_NSGAII([Population,Offspring],Global.N);
end
end
%% NSGAIII
if optimiser==2
% Generate the reference points and random population
[Z,Global.N] = UniformPoint(Global.N,Global.M);
Population = Global.Initialization();
Zmin = min(Population(all(Population.cons<=0,2)).objs,[],1);
% Optimization
while Global.NotTermination(Population)
MatingPool = TournamentSelection(2,Global.N,sum(max(0,Population.cons),2));
OffDec = GA(Population(MatingPool).decs);
%% FDV
iter = Global.gen/Global.maxgen;
if iter <= Rate
Offspring = FDVOperator(Rate,Acc,OffDec);
else
Offspring = INDIVIDUAL(OffDec);
end
%%
Zmin = min([Zmin;Offspring(all(Offspring.cons<=0,2)).objs],[],1);
Population = EnvironmentalSelection_NSGAIII([Population,Offspring],Global.N,Z,Zmin);
end
end
%% MOEA/D
if optimiser==3
% Generate the weight vectors
[W,Global.N] = UniformPoint(Global.N,Global.M);
T = ceil(Global.N/10);
% Detect the neighbours of each solution
B = pdist2(W,W);
[~,B] = sort(B,2);
B = B(:,1:T);
% Generate random population
Population = Global.Initialization();
Z = min(Population.objs,[],1);
% Optimization
while Global.NotTermination(Population)
% For each solution
for i = 1 : Global.N
% Choose the parents
P = B(i,randperm(size(B,2)));
% Generate an offspring
OffDec = GAhalf(Population(P(1:2)).decs);
%% FDV
iter = Global.gen/Global.maxgen;
if iter <= Rate
Offspring = FDVOperator(Rate,Acc,OffDec);
else
Offspring = INDIVIDUAL(OffDec);
end
% Update the ideal point
Z = min(Z,Offspring.obj);
% Update the neighbours
switch type
case 1
% PBI approach
normW = sqrt(sum(W(P,:).^2,2));
normP = sqrt(sum((Population(P).objs-repmat(Z,T,1)).^2,2));
normO = sqrt(sum((Offspring.obj-Z).^2,2));
CosineP = sum((Population(P).objs-repmat(Z,T,1)).*W(P,:),2)./normW./normP;
CosineO = sum(repmat(Offspring.obj-Z,T,1).*W(P,:),2)./normW./normO;
g_old = normP.*CosineP + 5*normP.*sqrt(1-CosineP.^2);
g_new = normO.*CosineO + 5*normO.*sqrt(1-CosineO.^2);
case 2
% Tchebycheff approach
g_old = max(abs(Population(P).objs-repmat(Z,T,1)).*W(P,:),[],2);
g_new = max(repmat(abs(Offspring.obj-Z),T,1).*W(P,:),[],2);
case 3
% Tchebycheff approach with normalization
Zmax = max(Population.objs,[],1);
g_old = max(abs(Population(P).objs-repmat(Z,T,1))./repmat(Zmax-Z,T,1).*W(P,:),[],2);
g_new = max(repmat(abs(Offspring.obj-Z)./(Zmax-Z),T,1).*W(P,:),[],2);
case 4
% Modified Tchebycheff approach
g_old = max(abs(Population(P).objs-repmat(Z,T,1))./W(P,:),[],2);
g_new = max(repmat(abs(Offspring.obj-Z),T,1)./W(P,:),[],2);
end
Population(P(g_old>=g_new)) = Offspring;
end
end
end
%% CMOPSO
if optimiser == 4
% Generate random population
Population = Global.Initialization();
% Optimization
while Global.NotTermination(Population)
[OffDec,OffVel] = Operator_CMOPSO(Population);
%% FDV
iter = Global.gen/Global.maxgen;
if iter <= Rate
Offspring = FDVOperator(Rate,Acc,OffDec,OffVel);
else
Offspring = INDIVIDUAL(OffDec,OffVel);
end
%%
Population = EnvironmentalSelection_CMOPSO([Population,Offspring],Global.N);
end
end
%% LMOCSO
if optimiser == 5
% Generate random population
[V,Global.N] = UniformPoint(Global.N,Global.M);
Population = Global.Initialization();
Population = EnvironmentalSelection_LMOCSO(Population,V,(Global.gen/Global.maxgen)^2);
% Optimization
while Global.NotTermination(Population)
% Calculate the fitness by shift-based density SDE (the shift-based density estimation strategy)
PopObj = Population.objs;
N = size(PopObj,1);
fmax = max(PopObj,[],1);
fmin = min(PopObj,[],1);
PopObj = (PopObj-repmat(fmin,N,1))./repmat(fmax-fmin,N,1);
Dis = inf(N);
for i = 1 : N
SPopObj = max(PopObj,repmat(PopObj(i,:),N,1));
for j = [1:i-1,i+1:N]
Dis(i,j) = norm(PopObj(i,:)-SPopObj(j,:));
end
end
Fitness = min(Dis,[],2);
if length(Population) >= 2
Rank = randperm(length(Population),floor(length(Population)/2)*2);
else
Rank = [1,1];
end
Loser = Rank(1:end/2);
Winner = Rank(end/2+1:end);
Change = Fitness(Loser) >= Fitness(Winner);
Temp = Winner(Change);
Winner(Change) = Loser(Change);
Loser(Change) = Temp;
[OffDec,OffVel] = Operator_LMOCSO(Population(Loser),Population(Winner),Rate);
%% FDV
iter = Global.gen/Global.maxgen;
if iter <= Rate
Offspring = FDVOperator(Rate,Acc,OffDec,OffVel);
else
Offspring = INDIVIDUAL(OffDec,OffVel);
end
%%
Population = EnvironmentalSelection_LMOCSO([Population,Offspring],V,(Global.gen/Global.maxgen)^2);
end
end
end