C# 클래스 Accord.Genetic.GPTreeChromosome

Tree chromosome represents a tree of genes, which is is used for different tasks of Genetic Programming (GP).

This type of chromosome represents a tree, where each node is represented by GPTreeNode containing IGPGene. Depending on type of genes used to build the tree, it may represent different types of expressions aimed to solve different type of tasks. For example, a particular implementation of IGPGene interface may represent simple algebraic operations and their arguments.

See documentation to IGPGene implementations for additional information about possible Genetic Programming trees.

상속: ChromosomeBase
파일 보기 프로젝트 열기: accord-net/framework 1 사용 예제들

공개 메소드들

메소드 설명
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 randomly selected sub trees.

GPTreeChromosome ( IGPGene ancestor ) : System

Initializes a new instance of the GPTreeChromosome class.

This constructor creates a randomly generated genetic tree, which has all genes of the same type and properties as the specified ancestor.

Generate ( ) : void

Generate random chromosome value.

Regenerates chromosome's value using random number generator.

Mutate ( ) : void

Mutation operator.

The method performs chromosome's mutation by regenerating tree's randomly selected node.

ToString ( ) : string

Get string representation of the chromosome by providing its expression in reverse polish notation (postfix notation).

The method returns string representation of the tree's root node (see GPTreeNode.ToString).

보호된 메소드들

메소드 설명
GPTreeChromosome ( GPTreeChromosome source ) : System

Initializes a new instance of the GPTreeChromosome class.

This constructor creates new genetic tree as a copy of the specified source tree.

Generate ( GPTreeNode node, int level ) : void

Generate chromosome's subtree of specified level.

비공개 메소드들

메소드 설명
RandomSwap ( GPTreeNode source ) : GPTreeNode

Crossover helper routine - selects random node of chromosomes tree and swaps it with specified node.

Trim ( GPTreeNode node, int level ) : void

Trim tree node, so its depth does not exceed specified level.

메소드 상세

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 randomly selected sub trees.

public Crossover ( IChromosome pair ) : void
pair IChromosome Pair chromosome to crossover with.
리턴 void

GPTreeChromosome() 보호된 메소드

Initializes a new instance of the GPTreeChromosome class.

This constructor creates new genetic tree as a copy of the specified source tree.

protected GPTreeChromosome ( GPTreeChromosome source ) : System
source GPTreeChromosome Source genetic tree to clone from.
리턴 System

GPTreeChromosome() 공개 메소드

Initializes a new instance of the GPTreeChromosome class.

This constructor creates a randomly generated genetic tree, which has all genes of the same type and properties as the specified ancestor.

public GPTreeChromosome ( IGPGene ancestor ) : System
ancestor IGPGene A gene, which is used as generator for the genetic tree.
리턴 System

Generate() 공개 메소드

Generate random chromosome value.

Regenerates chromosome's value using random number generator.

public Generate ( ) : void
리턴 void

Generate() 보호된 메소드

Generate chromosome's subtree of specified level.
protected Generate ( GPTreeNode node, int level ) : void
node GPTreeNode Sub tree's node to generate.
level int Sub tree's level to generate.
리턴 void

Mutate() 공개 메소드

Mutation operator.

The method performs chromosome's mutation by regenerating tree's randomly selected node.

public Mutate ( ) : void
리턴 void

ToString() 공개 메소드

Get string representation of the chromosome by providing its expression in reverse polish notation (postfix notation).

The method returns string representation of the tree's root node (see GPTreeNode.ToString).

public ToString ( ) : string
리턴 string