public void RecombinationTwoPoint(GEPChromosome pair)
{
var rand = Generator.Random;
// check for correct pair
if ((pair.length == length))
{
// crossover point
int crossOverPoint = rand.Next(length - 1) + 1;
// length of chromosome to be crossed
int crossOverLength = length - crossOverPoint;
// if crossover length already equals to 1, then it becomes
// usual one point crossover. otherwise crossover length
// also randomly chosen
if (crossOverLength != 1)
{
crossOverLength = rand.Next(crossOverLength - 1) + 1;
}
// swap parts of chromosomes
Recombine(genes, pair.genes, crossOverPoint, crossOverLength);
}
}