function Rec = recombination(SelectedInds,N) % recombination of selected individuals % in this case we use one point crossover of two individuals for i=1:2:N-1 temp1=SelectedInds(:,:,i); temp2=SelectedInds(:,:,i+1); temp_rnd=round(6*rand+1); temp3=[temp1(:,1:temp_rnd) temp2(:,temp_rnd+1:8)]; temp4=[temp2(:,1:temp_rnd) temp1(:,temp_rnd+1:8)]; Rec(:,:,i)=temp3; Rec(:,:,i+1)=temp4; end end