-
Notifications
You must be signed in to change notification settings - Fork 0
/
AdjustCulture.m
22 lines (22 loc) · 874 Bytes
/
AdjustCulture.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
function Culture = AdjustCulture(Culture, spop)
n = numel(spop);
nVar = numel(spop(1).Position);
for i = 1:n
if spop(i).Cost<Culture.Situational.Cost
Culture.Situational = spop(i);
end
for j = 1:nVar
if spop(i).Position(j)<Culture.Normative.Min(j) ...
|| spop(i).Cost<Culture.Normative.L(j)
Culture.Normative.Min(j) = spop(i).Position(j);
Culture.Normative.L(j) = spop(i).Cost;
end
if spop(i).Position(j)>Culture.Normative.Max(j) ...
|| spop(i).Cost<Culture.Normative.U(j)
Culture.Normative.Max(j) = spop(i).Position(j);
Culture.Normative.U(j) = spop(i).Cost;
end
end
end
Culture.Normative.Size = Culture.Normative.Max-Culture.Normative.Min;
end