-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgetMigration.m
More file actions
72 lines (68 loc) · 2.5 KB
/
getMigration.m
File metadata and controls
72 lines (68 loc) · 2.5 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
function [migPop] = getMigration(migIndv,nPop)
%
%File name: getMigration.m
%
% Programmed by Oloruntoba Oluwabunmi
% Last revised: Sept 2019
% Reference: Oloruntoba O., Cosma G., Liotta A. (2019). Clan-based CUltural Algorithm for Feature Selection. In:
% IEEE International Conference on Data Minning (ICDM 2019), November 8-11, 2019, Beijing China
%
% Copyright (c) 2019 Oloruntoba Oluwabunmi<bunmiotoba@gmail.com>.
%
%
% Function to determine the migration destination of individuals for each
% sub-populations
% The migrating population is randomly assigned such that the destination
% population is not the same as the originating population
%
%
nIndv = floor(nPop*migIndv);
numPop = 4;
migPop = zeros(nIndv,numPop);
for i=1:nIndv % column
for j=1:numPop
if (j == 1) % originates from sub-population 1
randomCheck = 1;
while (randomCheck == 1)
randomCheck = round(mod(2 + ((rand()*10)*2),4));
if (randomCheck <= 0)
randomCheck = 1;
end
end
migPop(i,j) = randomCheck;
else
if (j == 2) % originates from sub-population 2
randomCheck = 2;
while ((randomCheck) == 2)
randomCheck = round(mod(1 + ((rand()*10)+(2/3)),4));
if (randomCheck <= 0)
randomCheck = 2;
end
end
migPop(i,j) = (randomCheck);
else
if (j== 3) % originates from sub-population 3
randomCheck = 3;
while ((round(randomCheck) == 3) )
randomCheck = round(mod(1 +(rand()* 10),4));
if (randomCheck <= 0)
randomCheck = 3;
end
end
migPop(i,j) = round(randomCheck);
else
if (j == 4) % originates from sub-population 4
randomCheck = 4;
while ((round(randomCheck) == 4) )
randomCheck = round(mod((1+(rand()*10)*2),4));
if (randomCheck <= 0)
randomCheck = 4;
end
migPop(i,j) = round(randomCheck);
end
end
end
end
end
end
end