-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathPopulationLimiting.m
More file actions
54 lines (49 loc) · 1.94 KB
/
PopulationLimiting.m
File metadata and controls
54 lines (49 loc) · 1.94 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
function [Forest,candidate]=PopulationLimiting(Forest)
% This function gets the whole Forest and forms the candidate population
% Input:
% Forest: The whole Forest
%
% Output:
% Forest: The Forest with old and extra trees removed
% candidate: The candidate population to be used in the global seeding
% stage
%
% © Copyright Ghaemi
% 8/3/2014 University of Tabriz, Tabriz, Iran
% [~,index]=sort(Forest.T(:,Forest.P.Dimension+2));
% Forest.T(index,:);
% if(size(Forest.T,1)>Forest.P.area_limit)
% candidate=Forest.T(Forest.P.area_limit+1:size(Forest.T,1),:);
% end
% Forest.T=Forest.T(1:Forest.P.area_limit,:);
% temp=Forest.T(Forest.T(:,Forest.P.Dimension+2)>=Forest.P.Life_time,:);
% Forest.T=Forest.T(Forest.T(:,Forest.P.Dimension+2)<Forest.P.Life_time,:);
% candidate=[candidate;temp];
% candidate=[];
% temp1=Forest.T(Forest.T(:,Forest.P.Dimension+2)<Forest.P.Life_time,:);
% temp2=Forest.T(Forest.T(:,Forest.P.Dimension+2)>=Forest.P.Life_time,:);
% [~,index]=sort(temp1(:,end-1));
% temp1=temp1(index,:);
% if(size(Forest.T,1)>Forest.P.area_limit)
% Forest.T=temp1(1:Forest.P.area_limit,:);
% candidate=temp1(Forest.P.area_limit+1:size(temp1,1),:);
% end
% candidate=[candidate;temp2];
temp=[];
candidate=[];
for i=1:size(Forest.T,1)
if Forest.T(i,Forest.P.Dimension+2)< Forest.P.Life_time
temp=[temp; Forest.T(i,:)]; % trees with "Age" less than Life_time parameter
else
candidate=[candidate; Forest.T(i,:)]; % trees with "Age" bigger than Life_time parameter
end
end
Forest.T=[];
Forest.T=temp;
[p,q]=sort(Forest.T(:,Forest.P.Dimension+1));% Dimension+1 shows the fitness
Forest.T=Forest.T(q,:);
if size(Forest.T,1)>Forest.P.area_limit % removing extra trees
candidate=[candidate;Forest.T(Forest.P.area_limit+1:size(Forest.T,1),:)];
Forest.T(Forest.P.area_limit+1:size(Forest.T,1), :)=[];
end
end %end of function