C# Class Accord.Genetic.ExtendedGeneFunction

Genetic programming gene, which represents arithmetic functions, common mathematical functions and arguments.

Extended gene function may represent arithmetic functions (+, -, *, /), some common mathematical functions (sin, cos, ln, exp, sqrt) or an argument to functions. This class is used by Genetic Programming (or Gene Expression Programming) chromosomes to build arbitrary expressions with help of genetic operators.

Inheritance: IGPGene
Exibir arquivo Open project: accord-net/framework Class Usage Examples

Public Methods

Method Description
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.

ExtendedGeneFunction ( int variablesCount ) : System

Initializes a new instance of the ExtendedGeneFunction class.

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

ExtendedGeneFunction ( int variablesCount, GPGeneType type ) : System

Initializes a new instance of the ExtendedGeneFunction class.

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

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.

ToString ( ) : string

Get string representation of the gene.

Private Methods

Method Description
ExtendedGeneFunction ( int variablesCount, bool random ) : System

Method Details

Clone() public method

Clone the gene.

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

public Clone ( ) : IGPGene
return IGPGene

CreateNew() public method

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
return IGPGene

CreateNew() public method

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.
return IGPGene

ExtendedGeneFunction() public method

Initializes a new instance of the ExtendedGeneFunction class.

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

public ExtendedGeneFunction ( int variablesCount ) : System
variablesCount int Total amount of variables in the task which is supposed /// to be solved.
return System

ExtendedGeneFunction() public method

Initializes a new instance of the ExtendedGeneFunction class.

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

public ExtendedGeneFunction ( 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.
return System

Generate() public method

Randomize gene with random type and value.

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

public Generate ( ) : void
return void

Generate() public method

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.
return void

ToString() public method

Get string representation of the gene.
public ToString ( ) : string
return string