-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGlobalSeeding.m
More file actions
36 lines (34 loc) · 1.21 KB
/
Copy pathGlobalSeeding.m
File metadata and controls
36 lines (34 loc) · 1.21 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
function Forest=GlobalSeeding(candidate, Forest, Eval)
% This function gets the candidate population, the whole Forest and the evaluation function and
% performs global seeding on a percentage of candidate population
%
% Input:
% candidate: The candidate population from population limiting stage
% Forest: The whole Forest
% Eval: Evaluation function handler
%
% Output:
% Forest: The Forest with newly added trees
%
% © Copyright Ghaemi
% 8/3/2014 University of Tabriz, Tabriz, Iran
index=[];
New_Trees=[];
% choosing GSC variables randomly
for i=1:Forest.P.GSC
index=[index, randi([1,Forest.P.Dimension])];
end
% choose a percentage of candidate population
RevoSize=floor(((size(candidate,1))*Forest.P.Transfer_rate)/100);
SelectedTrees=candidate(1:RevoSize, :);
for w=1:size(SelectedTrees,1)
tempTree=SelectedTrees(w,:);
for j=index
tempTree(1,j)=random('unif',Forest.P.Llimit,Forest.P.Ulimit,1,1);
end
tempTree(1,Forest.P.Dimension+1)=Eval(tempTree(1,1:Forest.P.Dimension));
tempTree(1,Forest.P.Dimension+2)=0;
New_Trees=[New_Trees; tempTree(1,:)];
end
Forest.T=[Forest.T; New_Trees];
end