C# Класс AForge.Genetic.SimpleGeneFunction

Genetic programming gene, which represents simple arithmetic functions and arguments.

Simple gene function may represent an arithmetic function (+, -, *, /) or an argument to function. This class is used by Genetic Programming (or Gene Expression Programming) chromosomes to build arbitrary expressions with help of genetic operators.

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

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

Свойство Тип Описание
rand AForge.ThreadSafeRandom

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

Метод Описание
Clone ( ) : IGPGene

Clone the gene.

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

CreateNew ( ) : IGPGene

Creates new gene with random type and value.

The method creates new randomly initialized gene . The method is useful as factory method for those classes, which work with gene's interface, but not with particular gene class.

CreateNew ( GPGeneType type ) : IGPGene

Creates new gene with certain type and random value.

The method creates new gene with specified type, but random value. The method is useful as factory method for those classes, which work with gene's interface, but not with particular gene class.

Generate ( ) : void

Randomize gene with random type and value.

The method randomizes the gene, setting its type and value randomly.

Generate ( GPGeneType type ) : void

Randomize gene with random value.

The method randomizes a gene, setting its value randomly, but type is set to the specified one.

SimpleGeneFunction ( int variablesCount ) : System

Initializes a new instance of the SimpleGeneFunction class.

The constructor creates randomly initialized gene with random type and value by calling Generate( ) method.

SimpleGeneFunction ( int variablesCount, GPGeneType type ) : System

Initializes a new instance of the SimpleGeneFunction class.

The constructor creates randomly initialized gene with random value and preset gene type.

ToString ( ) : string

Get string representation of the gene.

Приватные методы

Метод Описание
SimpleGeneFunction ( int variablesCount, bool random ) : System

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

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

Clone the gene.

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

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

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

Creates new gene with random type and value.

The method creates new randomly initialized gene . The method is useful as factory method for those classes, which work with gene's interface, but not with particular gene class.

public CreateNew ( ) : IGPGene
Результат IGPGene

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

Creates new gene with certain type and random value.

The method creates new gene with specified type, but random value. The method is useful as factory method for those classes, which work with gene's interface, but not with particular gene class.

public CreateNew ( GPGeneType type ) : IGPGene
type GPGeneType Gene type to create.
Результат IGPGene

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

Randomize gene with random type and value.

The method randomizes the gene, setting its type and value randomly.

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

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

Randomize gene with random value.

The method randomizes a gene, setting its value randomly, but type is set to the specified one.

public Generate ( GPGeneType type ) : void
type GPGeneType Gene type to set.
Результат void

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

Initializes a new instance of the SimpleGeneFunction class.

The constructor creates randomly initialized gene with random type and value by calling Generate( ) method.

public SimpleGeneFunction ( int variablesCount ) : System
variablesCount int Total amount of variables in the task which is supposed /// to be solved.
Результат System

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

Initializes a new instance of the SimpleGeneFunction class.

The constructor creates randomly initialized gene with random value and preset gene type.

public SimpleGeneFunction ( int variablesCount, GPGeneType type ) : System
variablesCount int Total amount of variables in the task which is supposed /// to be solved.
type GPGeneType Gene type to set.
Результат System

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

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

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

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

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