NSGA-II 非支配排序算法:
Non-dominated Algorithm(dominated matrix D, population P)
for i=1:length(P) {
set R(i).np=0 and R(i).sp=[]
}
for i=1:length(P)
for j=i+1:length(P) {
if D(i,j)=1 {
R(q).np= R(q).np + 1
R(p).sp= R(p).sp ∪ q
} elseif D(i,j)=-1 {
R(p).np= R(p).np + 1
R(q).sp= R(q).sp ∪ q
}
}
Set front(1).f=[]
for i=1:length(P) {
if R(i).np==0 {
P(i).rank=1
front(1).f= front(i).f ∪ i
}
}
Set layer=1
while( front( layer).f is not null ) {
Set Q=[]
for u in front(layer).f {
for v in R(u) .sp{
R(v) .np= R(v) .np-1
if R(p) .np==0{
P(v).rank=layer+1
Q=Q ∪ v
}
}
}
layer=layer+1
front(layer).f=Q
}