-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMutate.m
31 lines (25 loc) · 1.29 KB
/
Mutate.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
27
28
29
30
31
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% MATLAB Code for %
% %
% Non-dominated Sorting Genetic Algorithm II (NSGA-II) %
% Version 1.0 - April 2010 %
% %
% Programmed By: S. Mostapha Kalami Heris %
% %
% e-Mail: [email protected] %
% %
% Homepage: http://www.kalami.ir %
% %
% Mutate.m : implements the mutation operator %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function q=Mutate(p,VarRange)
VarMin=min(VarRange);
VarMax=max(VarRange);
y=p.Position;
j=randi([1 numel(y)]);
y(j)=unifrnd(VarMin,VarMax);
q=CreateEmptyIndividuals();
q.Position=y;
end