C# Класс Accord.Genetic.ShortArrayChromosome

Short array chromosome.

Short array chromosome represents array of unsigned short values. Array length is in the range of [2, 65536].

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

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

Свойство Тип Описание
length int
maxValue int
val ushort[]

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

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

ShortArrayChromosome ( int length ) : System

Initializes a new instance of the ShortArrayChromosome class.

This constructor initializes chromosome setting genes' maximum value to maximum posible value of type.

ShortArrayChromosome ( int length, int maxValue ) : System

Initializes a new instance of the ShortArrayChromosome class.

ToString ( ) : string

Get string representation of the chromosome.

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

Метод Описание
ShortArrayChromosome ( ShortArrayChromosome source ) : System

Initializes a new instance of the ShortArrayChromosome class.

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

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

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 genes (array elements) 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 genes (array elements).

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

ShortArrayChromosome() защищенный Метод

Initializes a new instance of the ShortArrayChromosome class.

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

protected ShortArrayChromosome ( ShortArrayChromosome source ) : System
source ShortArrayChromosome Source chromosome to copy.
Результат System

ShortArrayChromosome() публичный Метод

Initializes a new instance of the ShortArrayChromosome class.
This constructor initializes chromosome setting genes' maximum value to maximum posible value of type.
public ShortArrayChromosome ( int length ) : System
length int Chromosome's length in array elements, [2, ].
Результат System

ShortArrayChromosome() публичный Метод

Initializes a new instance of the ShortArrayChromosome class.
public ShortArrayChromosome ( int length, int maxValue ) : System
length int Chromosome's length in array elements, [2, ].
maxValue int Maximum value of chromosome's gene (array element).
Результат System

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

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

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

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

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

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

Maximum value of chromosome's gene (element).
protected int maxValue
Результат int

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

Chromosome's value.
protected ushort[] val
Результат ushort[]