forked from wangqiang135/ABC-BP
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGreedySelection.m
More file actions
37 lines (34 loc) · 1 KB
/
Copy pathGreedySelection.m
File metadata and controls
37 lines (34 loc) · 1 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
function [Colony Obj Fit oBas]=GreedySelection(Colony1,Colony2,ObjEmp,ObjEmp2,FitEmp,FitEmp2,fbas,ABCOpts,i)
oBas=fbas;
Obj=ObjEmp;
Fit=FitEmp;
Colony=Colony1;
if (nargin==8) %Inside the body of a user-defined function, NARGIN returns the number of input arguments that were used to call the function.
for ind=1:size(Colony1,1)
if (FitEmp2(ind)>FitEmp(ind))
oBas(ind)=0;
Fit(ind)=FitEmp2(ind);
Obj(ind)=ObjEmp2(ind);
Colony(ind,:)=Colony2(ind,:);
else
oBas(ind)=fbas(ind)+1;
Fit(ind)=FitEmp(ind);
Obj(ind)=ObjEmp(ind);
Colony(ind,:)=Colony1(ind,:);
end;
end; %for
end; %if
if(nargin==9)
ind=i;
if (FitEmp2(ind)>FitEmp(ind))
oBas(ind)=0;
Fit(ind)=FitEmp2(ind);
Obj(ind)=ObjEmp2(ind);
Colony(ind,:)=Colony2(ind,:);
else
oBas(ind)=fbas(ind)+1;
Fit(ind)=FitEmp(ind);
Obj(ind)=ObjEmp(ind);
Colony(ind,:)=Colony1(ind,:);
end;
end;