Property | Type | Description | |
---|---|---|---|
genes | IGPGene[] | ||
headLength | int | ||
length | int |
Method | Description | |
---|---|---|
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 one-point or two-point crossover selecting them randomly with equal probability. |
|
GEPChromosome ( IGPGene ancestor, int headLength ) : System |
Initializes a new instance of the GEPChromosome class. This constructor creates a randomly generated GEP chromosome, 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 calling on of the methods randomly: MutateGene, TransposeIS, TransposeRoot. |
|
RecombinationOnePoint ( |
One-point recombination (crossover).
|
|
RecombinationTwoPoint ( |
Two point recombination (crossover).
|
|
ToString ( ) : string |
Get string representation of the chromosome by providing its expression in reverse polish notation (postfix notation).
|
|
ToStringNative ( ) : string |
Get string representation of the chromosome. |
Method | Description | |
---|---|---|
GEPChromosome ( |
Initializes a new instance of the GEPChromosome class.
|
|
GetTree ( ) : |
Get tree representation of the chromosome. The method builds expression's tree for the native linear representation of the GEP chromosome. |
|
MutateGene ( ) : void |
Usual gene mutation. The method performs usual gene mutation by randomly changing randomly selected gene. |
|
Recombine ( IGPGene src1, IGPGene src2, int point, int length ) : void |
Swap parts of two chromosomes. The method performs interchanging of genes between two chromosomes starting from the point position. |
|
TransposeIS ( ) : void |
Transposition of IS elements (insertion sequence). The method performs transposition of IS elements by copying randomly selected region of genes into chromosome's head (into randomly selected position). First gene of the chromosome's head is not affected - can not be selected as target point. |
|
TransposeRoot ( ) : void |
Root transposition. The method performs root transposition of the GEP chromosome - inserting new root of the chromosome and shifting existing one. The method first of all randomly selects a function gene in chromosome's head - starting point of the sequence to put into chromosome's head. Then it randomly selects the length of the sequence making sure that the entire sequence is located within head. Once the starting point and the length of the sequence are known, it is copied into chromosome's head shifting existing elements in the head. |
public Crossover ( IChromosome pair ) : void | ||
pair | IChromosome | Pair chromosome to crossover with. |
return | void |
protected GEPChromosome ( |
||
source | Source GEP chromosome to clone from. | |
return | System |
public GEPChromosome ( IGPGene ancestor, int headLength ) : System | ||
ancestor | IGPGene | A gene, which is used as generator for the genetic tree. |
headLength | int | Length of GEP chromosome's head (see |
return | System |
public RecombinationOnePoint ( |
||
pair | Pair chromosome to crossover with. | |
return | void |
public RecombinationTwoPoint ( |
||
pair | Pair chromosome to crossover with. | |
return | void |
protected static Recombine ( IGPGene src1, IGPGene src2, int point, int length ) : void | ||
src1 | IGPGene | First chromosome participating in genes' interchange. |
src2 | IGPGene | Second chromosome participating in genes' interchange. |
point | int | Index of the first gene in the interchange sequence. |
length | int | Length of the interchange sequence - number of genes /// to interchange. |
return | void |