Using mat lab to solve order crossover problem

3 Ansichten (letzte 30 Tage)
Jahleel  Fleetwood
Jahleel Fleetwood am 16 Apr. 2018
These are my two parents I am using to produce offspring. In doing so I need to use the order crossover method. Here is some code I have and I am confused on how to randomly generate a crossover point, that will then use the ORDER crossover method to produce results. Here is some code I have after taking smaples from different sources. Am I on the right path?
P1=[1,9,12,2, 7,5,8,11,6,13,14,10,3,4,16,15];
P2=[16,13,14,2, 12,7,3,4,1,10,5,6,9,8,15,11];
[m,n]=size(1,7); %C1=P1; %C2=P2;
For i=5:11
if i<5 && i>11
n(i) *maybe use the compare function?
end
%Crossover point cp=randperm(1);
b1 = [P1(1, 1:cp), P1(2, cp+1:end)]; b2 = [P2(1, 1:cp), P2(2, cp+1:end)];

Antworten (0)

Kategorien

Mehr zu Thermodynamics & Statistical Physics finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by