AForge.Genetic.GEPChromosome.TransposeIS C# (CSharp) Метод

TransposeIS() защищенный Метод

Transposition of IS elements (insertion sequence).

The method performs transposition of IS elements by copying randomly selected region of genes into chromosome's head (into randomly selected position). First gene of the chromosome's head is not affected - can not be selected as target point.

protected TransposeIS ( ) : void
Результат void
		protected void TransposeIS( )
		{
			// select source point (may be any point of the chromosome)
			int sourcePoint = rand.Next( length );
			// calculate maxim source length
			int maxSourceLength = length - sourcePoint;
			// select tartget 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 transposon 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];
			}
		}