📄 binarymutation.m
字号:
function [parent] = binaryMutation(parent,bounds,pm)
% Binary mutation changes each of the bits of the parent
% based on the probability of mutation
%
% function [newSol] = binaryMutate(parent,bounds,Ops)
% parent - the first parent ( [solution string function value] )
% bounds - the bounds matrix for the solution space
% Ops - Options for binaryMutation [gen prob_of_mutation]
% Binary and Real-Valued Simulation Evolution for Matlab
% Copyright (C) 1996 C.R. Houck, J.A. Joines, M.G. Kay
%
numVar = size(parent,2)-1; % Get the number of variables
% Pick a variable to mutate randomly from 1-number of vars
rN=rand(1,numVar)<pm;
parent=[abs(parent(1:numVar) - rN) parent(numVar+1)];
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -