AForge.Genetic.EliteSelection.ApplySelection C# (CSharp) Méthode

ApplySelection() public méthode

Apply selection to the specified population.
Filters specified population keeping only specified amount of best chromosomes.
public ApplySelection ( List chromosomes, int size ) : void
chromosomes List Population, which should be filtered.
size int The amount of chromosomes to keep.
Résultat void
        public void ApplySelection( List<IChromosome> chromosomes, int size )
        {
            // sort chromosomes
            chromosomes.Sort( );

            // remove bad chromosomes
            chromosomes.RemoveRange( size, chromosomes.Count - size );
        }
    }