TreeIndividual
Models & Types · AiDotNet.Genetics
Represents an individual in genetic programming with a tree structure.
Implements: IEvolvable<NodeGene, double>
Constructors
| Constructor | Summary |
|---|---|
TreeIndividual(NodeGene rootNode) |
Creates a tree individual with the specified root node. |
TreeIndividual(Random random, List<string> terminals, bool fullMethod) |
Creates a new tree individual with a random tree. |
Methods
| Method | Summary |
|---|---|
ICollection<NodeGene> GetGenes() |
|
IEvolvable<NodeGene, double> Clone() |
|
NodeGene SelectRandomNode() |
Selects a random node from the tree. |
double Evaluate(Dictionary<string, double> variables) |
Evaluates the tree for a given input and returns the result. |
double GetFitness() |
|
int GetDepth() |
Gets the depth of the tree. |
string GetExpression() |
Gets a string representation of the tree. |
void PermutationMutation() |
Performs permutation mutation by randomizing the order of arguments. |
void PointMutation() |
Performs point mutation on the tree by changing a random terminal or function. |
void ReplaceSubtree(NodeGene target, NodeGene replacement) |
Replaces a subtree with another subtree. |
void SetFitness(double fitness) |
|
void SetGenes(ICollection<NodeGene> genes) |
|
void SubtreeMutation() |
Performs subtree mutation by replacing a random subtree with a new one. |