www.pudn.com > GA_Toolbar.rar > UNIFORMM.M, change:1997-04-07,size:811b


function [parent] = uniformMutate(parent,bounds,Ops) 
% Uniform mutation changes one of the parameters of the parent 
% based on a uniform probability distribution. 
% function [newSol] = multiNonUnifMutate(parent,bounds,Ops) 
% parent  - the first parent ( [solution string function value] ) 
% bounds  - the bounds matrix for the solution space 
% Ops     - Options for uniformMutation [gen #UnifMutations] 
% Binary and Real-Valued Simulation Evolution for Matlab  
df = bounds(:,2) - bounds(:,1); 	% Range of the variables 
numVar = size(parent,2)-1; 		% Get the number of variables  
% Pick a variable to mutate randomly from 1-number of vars 
mPoint = round(rand * (numVar-1)) + 1; 
newValue = bounds(mPoint,1)+rand * df(mPoint); % Now mutate that point 
parent(mPoint) = newValue; 		% Make the child 
end