AForge.Genetic.GEPChromosome.MutateGene C# (CSharp) Method

MutateGene() protected method

Usual gene mutation.

The method performs usual gene mutation by randomly changing randomly selected gene.

protected MutateGene ( ) : void
return void
		protected void MutateGene( )
		{
			// select random point of mutation
			int mutationPoint = rand.Next( length );

			if ( mutationPoint < headLength )
			{
				// genes from head can be randomized freely (type may change)
				genes[mutationPoint].Generate( );
			}
			else
			{
				// genes from tail cannot change their type - they
				// should be always arguments
				genes[mutationPoint].Generate( GPGeneType.Argument );
			}
		}