C# Класс 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.

Наследование: ChromosomeBase
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
length int
rand ThreadSafeRandom
val ulong

Открытые методы

Метод Описание
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.

Защищенные методы

Метод Описание
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.

Описание методов

BinaryChromosome() защищенный метод

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.
Результат System

BinaryChromosome() публичный метод

Initializes a new instance of the BinaryChromosome class.
public BinaryChromosome ( int length ) : System
length int Chromosome's length in bits, [2, ].
Результат System

Clone() публичный метод

Clone the chromosome.

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

public Clone ( ) : IChromosome
Результат IChromosome

CreateNew() публичный метод

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
Результат IChromosome

Crossover() публичный метод

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.
Результат void

Generate() публичный метод

Generate random chromosome value.

Regenerates chromosome's value using random number generator.

public Generate ( ) : void
Результат void

Mutate() публичный метод

Mutation operator.

The method performs chromosome's mutation, changing randomly one of its bits.

public Mutate ( ) : void
Результат void

ToString() публичный метод

Get string representation of the chromosome.
public ToString ( ) : string
Результат string

Описание свойств

length защищенное свойство

Chromosome's length in bits.
protected int length
Результат int

rand защищенное статическое свойство

Random number generator for chromosoms generation, crossover, mutation, etc.
protected static ThreadSafeRandom rand
Результат ThreadSafeRandom

val защищенное свойство

Numerical chromosome's value.
protected ulong val
Результат ulong