?? crossover.m
字號:
function [childpath1,childpath2]=Crossover(parentpath1,parentpath2,Pc)
%部分影射交叉PMX
[row,col]=size(parentpath1);
tempP=rand(1);
childpath1=parentpath1;
childpath2=parentpath2;
if(tempP<Pc)
point=randperm(col-1);
point1=min(point(1),point(2));
point2=max(point(1),point(2));
for j=point1+1:point2
[rowindex,colindex]=find(parentpath1(j)==parentpath2);
childpath1(j)=parentpath1(colindex);
childpath1(colindex)=parentpath1(j);
[rowindex,colindex]=find(parentpath2(j)==parentpath1);
childpath2(j)=parentpath2(colindex);
childpath2(colindex)=parentpath2(j);
parentpath1=childpath1;
parentpath2=childpath2;
end
end
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -