C# Class AForge.Genetic.BinaryChromosome

Binary chromosome, which supports length from 2 till 64.

The binary chromosome is the simplest type of chromosomes, which is represented by a set of bits. Maximum number of bits comprising the chromosome is 64.

Inheritance: ChromosomeBase
Afficher le fichier Open project: holisticware-admin/MonoVersal.AForgeNET Class Usage Examples

Protected Properties

Свойство Type Description
length int
rand ThreadSafeRandom
val ulong

Méthodes publiques

Méthode Description
BinaryChromosome ( int length ) : System

Initializes a new instance of the BinaryChromosome class.

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 range of bits 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, changing randomly one of its bits.

ToString ( ) : string

Get string representation of the chromosome.

Méthodes protégées

Méthode Description
BinaryChromosome ( BinaryChromosome source ) : System

Initializes a new instance of the BinaryChromosome class.

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

Method Details

BinaryChromosome() protected méthode

Initializes a new instance of the BinaryChromosome class.

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

protected BinaryChromosome ( BinaryChromosome source ) : System
source BinaryChromosome Source chromosome to copy.
Résultat System

BinaryChromosome() public méthode

Initializes a new instance of the BinaryChromosome class.
public BinaryChromosome ( int length ) : System
length int Chromosome's length in bits, [2, ].
Résultat System

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 range of bits 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, changing randomly one of its bits.

public Mutate ( ) : void
Résultat void

ToString() public méthode

Get string representation of the chromosome.
public ToString ( ) : string
Résultat string

Property Details

length protected_oe property

Chromosome's length in bits.
protected int length
Résultat int

rand protected_oe static_oe property

Random number generator for chromosoms generation, crossover, mutation, etc.
protected static ThreadSafeRandom rand
Résultat ThreadSafeRandom

val protected_oe property

Numerical chromosome's value.
protected ulong val
Résultat ulong