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

📄 mutateoper.m

📁 基本遗传算法的matlab源程序
💻 M
字号:
function geneCodMut=mutateOper(geneCod,proMut)
%  mutation operator 
%  syntax:geneCodMut=mutateOper(geneCod,proMut)
%
%  Output Arguments:
%      geneCode     ---- a matrix of chromosome codes
%  Input Arguments:
%      geneCodMut   ---- a matrix of chromosome codes after mutation
%      proMut       ---- the probability of gene mutation
%
%  Author:Yan Anxin
%  ID number:081810
%  Yax235 DreamWorks, SEE, SEU, 2# Sipailou Nanjing, 210096, P.R.China 

[sizePop,sizeGene]=size(geneCod);
geneCodMut=geneCod;
for ik=1:(sizePop*sizeGene)
    proRand=rand(1);
    if proRand>proMut,continue;end     %random variation 
    geneCodMut(ik)=num2str(1-bin2dec(geneCodMut(ik)));
end

        
        
        
        
        

⌨️ 快捷键说明

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