-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSortPopulation.m
More file actions
30 lines (26 loc) · 1.41 KB
/
SortPopulation.m
File metadata and controls
30 lines (26 loc) · 1.41 KB
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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% MATLAB Code for %
% %
% Non-dominated Sorting Genetic Algorithm II (NSGA-II) %
% Version 1.0 - April 2010 %
% %
% Programmed By: S. Mostapha Kalami Heris %
% %
% e-Mail: sm.kalami@gmail.com %
% kalami@ee.kntu.ac.ir %
% %
% Homepage: http://www.kalami.ir %
% %
% SortPopulation.m : performs sort operation according to %
% rank and crowding distance, and %
% prepares population before selection %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function pop=SortPopulation(pop)
CD=[pop.CrowdingDistance];
[CD CD_sort_order]=sort(CD,'descend');
pop=pop(CD_sort_order);
R=[pop.Rank];
[R R_sort_order]=sort(R);
pop=pop(R_sort_order);
end