forked from ankurzing/bleaq2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nonDominatedSorting.m
39 lines (30 loc) · 943 Bytes
/
nonDominatedSorting.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
function [paretoRank] = nonDominatedSorting(functionValue, paretoRank)
noOfObj = size(functionValue,2);
popSize = size(functionValue,1);
if nargin==1
paretoRank = zeros(popSize,1);
end
if popSize==0
paretoRank = [];
return
end
paretoRank = paretoRank+1;
for i=1:popSize
dominance(i) = checkDominance(functionValue(i,:),functionValue);
end
[paretoRank(dominance)] = nonDominatedSorting(functionValue(dominance,:), paretoRank(dominance));
function dominance = checkDominance(objVectorToCheck, vectorsPool)
%Returns 1/true if objVectorToCheck is dominated by any member in
%vectorsPool else it returns 0/false
noOfObj = size(objVectorToCheck,2);
poolSize = size(vectorsPool,1);
for i=1:poolSize
if objVectorToCheck~=vectorsPool(i,:)
if objVectorToCheck<=vectorsPool(i,:)
dominance = true;
return;
end
end
end
dominance = false;
return;