Using mat lab to solve order crossover problem
조회 수: 3 (최근 30일)
이전 댓글 표시
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)];
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Thermodynamics & Statistical Physics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!