-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathLocalSeeding.m
26 lines (24 loc) · 1017 Bytes
/
LocalSeeding.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
function Forest=LocalSeeding(Forest, Eval)
newtrees=[];
for q=1:size(Forest.T,1)
if Forest.T(q,Forest.P.Dimension+2)==0 %Dimension+2 shows the Age of each tree
% choosing LSC variables randomly
move=randperm(Forest.P.Dimension,Forest.P.LSC);
childs=[];
for i=move
temp=Forest.T(q,:);
temp(1,i)=temp(1,i)+random('unif',-Forest.P.dx(i) ,Forest.P.dx(i) ,1,1);
temp(1,i)=min(Forest.P.Ulimit(i),max(Forest.P.Llimit(i),temp(1,i)));
temp(1,Forest.P.Dimension+1)=Eval(temp(1:Forest.P.Dimension));
temp(1,Forest.P.Dimension+2)=0;
childs=[childs;temp];
end
newtrees=[newtrees;childs];
childs=[];
end
end
% Increasing the Age of all trees except for new trees
Forest.T(:,Forest.P.Dimension+2)=Forest.T(:,Forest.P.Dimension+2)+1;
% adding the new trees with Age 0 to the Forest
Forest.T=[Forest.T; newtrees];
end