protected void TransposeIS()
{
var rand = Generator.Random;
// select source point (may be any point of the chromosome)
int sourcePoint = rand.Next(length);
// calculate maxim source length
int maxSourceLength = length - sourcePoint;
// select target insertion point in the head (except first position)
int targetPoint = rand.Next(headLength - 1) + 1;
// calculate maximum target length
int maxTargetLength = headLength - targetPoint;
// select randomly transposed length
int transposonLength = rand.Next(Math.Min(maxTargetLength, maxSourceLength)) + 1;
// genes copy
IGPGene[] genesCopy = new IGPGene[transposonLength];
// copy genes from source point
for (int i = sourcePoint, j = 0; j < transposonLength; i++, j++)
{
genesCopy[j] = genes[i].Clone();
}
// copy genes to target point
for (int i = targetPoint, j = 0; j < transposonLength; i++, j++)
{
genes[i] = genesCopy[j];
}
}