⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mutate.m

📁 王小平《遗传算法——理论、应用与软件实现》随书光盘
💻 M
字号:
function out=mutate(in,pmutate);
%
% Mutate the incoming chromasome
% with a probability of mutating
% each string of pmutate.
%
% This file takes only one member
% of the overall population.
%

[D L]=size(in);

for i = 1:L
	if rand(1)<pmutate
		in(1,i)=abs(in(1,i)-1);
	end
end
out=in;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -