50% Crossover 

Hi again,

I'm using proportional crossover and would like to ensure both parent genotypes contribute equally (close to 50% each). Is there any way to program this without writing my own crossover function? (so you don’t get 98% of creature A and 2% of creature B)?

I'm pretty sure I could write something that works, but i thought I'd check if there was any prebuilt functionality or even the code from your current crossover function.

Thanks again! So far everything is working REALLY well with the system.

Forums: 
Maciej Komosinski's picture

I guess you are using the f1 genetic encoding, right?

The "%" is computed based on the amount of text that is inherited, which not necessarily reflects phenetic similarity... but these should be more or less similar in f1.

Currently, there is no way to control the amount of genes exchanged. The two cut points are randomly selected in each of the parent genotypes, and then the two-point crossover is carried out.

As a workaround, you could perform the crossover, then analyze the "info" field in the offspring genotype, and if the split was not balanced, you could repeat the crossover until it is satisfactory. But... consider whether imbalanced crossovers are really that bad for you.

Not to worry, I'm just using

String.left(genoString1, String.len(genoString1)/2) + String.right(genoString2, String.len(genoString2)/2);

which does the trick (of course it returns lots of faulty genotypes but I'll worry about that later).