mutationreverse.m

来自「基于信息熵的免疫算法」· M 代码 · 共 15 行

M
15
字号
function path=MutationReverse(path,Pm)
[row,col]=size(path);
childpath=path;
for i=1:row
    point=randperm(col)-1;
    point1=min(point(1),point(2));
    point2=max(point(1),point(2));
    tempP=rand(1);
    if(tempP<Pm)
        for j=point1+1:point2
            childpath(i,j)=path(i,(point2+point1+1-j));
        end
    end
end
path=childpath;

⌨️ 快捷键说明

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