📄 cx.m
字号:
% CX means Olives, Smith, and Hollands' Cycle Crossover(CX)
% Procedure :CX
% Step1. Find the cycle which is defined by the corresponding positions of cities between parents
% Step2. Copy the cities in the cycle to a child with the corresponding positions of one parent.
% Step3. Determine the remaining cities for the child by deleting those cities which are already
% in the cycle from the other parent.
% Step4. Fulfill the child with the remaining cities.
function CX%(Va,Vb)
Va=1:9
Vb=[5 4 6 9 2 3 7 8 1]
%--------------------------------------------------------------------------------
% Step1. Find the cycle which is defined by the corresponding positions of cities between parents
for ix=1:length(Va)
rawMapRelation(ix,1:2)=[Va(ix),Vb(ix)];
end
rawMapRelation
rowIndex=1;
colIndex=1;
tMap=[rawMapRelation;fliplr(rawMapRelation)]
Map=tMap'
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -