C# Class Accord.Genetic.PermutationChromosome

Permutation chromosome.

Permutation chromosome is based on short array chromosome, but has two features:

all genes are unique within chromosome, i.e. there are no two genes with the same value; maximum value of each gene is equal to chromosome length minus 1.
Inheritance: ShortArrayChromosome
Afficher le fichier Open project: accord-net/framework Class Usage Examples

Méthodes publiques

Méthode Description
Clone ( ) : IChromosome

Clone the chromosome.

The method clones the chromosome returning the exact copy of it.

CreateNew ( ) : IChromosome

Create new random chromosome with same parameters (factory method).

The method creates new chromosome of the same type, but randomly initialized. The method is useful as factory method for those classes, which work with chromosome's interface, but not with particular chromosome type.

Crossover ( IChromosome pair ) : void

Crossover operator.

The method performs crossover between two chromosomes – interchanging some parts between these chromosomes.

Generate ( ) : void

Generate random chromosome value.

Regenerates chromosome's value using random number generator.

Mutate ( ) : void

Mutation operator.

The method performs chromosome's mutation, swapping two randomly chosen genes (array elements).

PermutationChromosome ( int length ) : Accord.Math.Random

Initializes a new instance of the PermutationChromosome class.

Méthodes protégées

Méthode Description
PermutationChromosome ( PermutationChromosome source ) : Accord.Math.Random

Initializes a new instance of the PermutationChromosome class.

This is a copy constructor, which creates the exact copy of specified chromosome.

Private Methods

Méthode Description
CreateChildUsingCrossover ( ushort parent1, ushort parent2, ushort child ) : void
CreateIndexDictionary ( ushort genes ) : ushort[]

Method Details

Clone() public méthode

Clone the chromosome.

The method clones the chromosome returning the exact copy of it.

public Clone ( ) : IChromosome
Résultat IChromosome

CreateNew() public méthode

Create new random chromosome with same parameters (factory method).

The method creates new chromosome of the same type, but randomly initialized. The method is useful as factory method for those classes, which work with chromosome's interface, but not with particular chromosome type.

public CreateNew ( ) : IChromosome
Résultat IChromosome

Crossover() public méthode

Crossover operator.

The method performs crossover between two chromosomes – interchanging some parts between these chromosomes.

public Crossover ( IChromosome pair ) : void
pair IChromosome Pair chromosome to crossover with.
Résultat void

Generate() public méthode

Generate random chromosome value.

Regenerates chromosome's value using random number generator.

public Generate ( ) : void
Résultat void

Mutate() public méthode

Mutation operator.

The method performs chromosome's mutation, swapping two randomly chosen genes (array elements).

public Mutate ( ) : void
Résultat void

PermutationChromosome() protected méthode

Initializes a new instance of the PermutationChromosome class.

This is a copy constructor, which creates the exact copy of specified chromosome.

protected PermutationChromosome ( PermutationChromosome source ) : Accord.Math.Random
source PermutationChromosome Source chromosome to copy.
Résultat Accord.Math.Random

PermutationChromosome() public méthode

Initializes a new instance of the PermutationChromosome class.
public PermutationChromosome ( int length ) : Accord.Math.Random
length int
Résultat Accord.Math.Random