if I have a chromosome =[1.01, 2.03, 4.06, 6.03, 0, 5.06, 4.12, 0, 3.03, -1, 1.12, 10.01, 4.05, 8.05, 3.07, 5.08, -1, 7.10, 8.01]; how can I separate it into segments using -1 gene and -1 will be remain in the modified gene after mutation
I need to select 2 random indices inside any segment and make inversion mutation between those indices
idx = find(chromosome==-1); c1 = chromosome(1:idx-1); c2 = chromosome(idx+1:end);==for comparison. Also,c1,c2is hardly extendable (what if there are 50 chromosomes?). Shaimaa, please see minimal reproducible example and edit your post to contain the sample output of what you'd like to achieve and also what happens with multiple-1values in your array.