-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcalSubpFitness.m
40 lines (39 loc) · 1.24 KB
/
calSubpFitness.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
function g = calSubpFitness(type, objs, z, W)
% Calculate the function values of the scalarization method
%
% Author: Ruihao Zheng
% Last modified: 17/08/2022
type2 = floor(type);
switch type2
case 1
% weight sum approach
switch round((type - type2) * 10)
case 1
g = sum(objs ./ W, 2);
case 2
g = sum((objs-z) .* W, 2);
otherwise
g = sum(objs .* W, 2);
end
case 2
% Tchebycheff approach
switch round((type - type2) * 10)
case 1
g = max(abs(objs-z) ./ W, [], 2);
otherwise
g = max(abs(objs-z) .* W, [], 2);
end
case 7
% p-norm scalarization
if type - type2 == 0
p = 2;
else
p = round((type - type2) * 1000, 2); % p is only allowed to have two decimal places
end
if p == 2
g = sum((abs(objs-z).* W).^p, 2).^(1/p); % faster than vecnorm
else
g = vecnorm(abs(objs-z).* W, p, 2);
end
end
end