#include <Individual.h>
Inheritance diagram for genetiK::gp::Individual:
Public Member Functions | |
Individual (IndividualFactory *individualFactory) | |
creates an Individual and generates its tree. | |
Individual (const Individual &individual) | |
creates a copy of an Individual | |
virtual | ~Individual (void) |
destructor | |
virtual double | fitness ()=0 |
The fitness function. | |
virtual genetiK::Individual * | copy () const =0 |
Copy this individual. | |
virtual int | mutate (const double mutationProbabilty) |
mutate the individual | |
virtual int | crossOver (genetiK::Individual *i, genetiK::Individual **child1, genetiK::Individual **child2) |
Cross over. | |
virtual std::string | toString () const |
outputs the individual. | |
Protected Member Functions | |
Gene * | extract (const unsigned int label) const |
Extract a branch. | |
Gene * | substituteBranch (const unsigned int label, Gene *newSubTree) |
Substitute a branch. | |
void | setLabels () |
Sets the labels to all the tree. | |
unsigned int | getCardinality () const |
Return the cardinality of the tree. | |
IndividualFactory * | getIndividualFactory () const |
Return the factory which generated this individual. | |
Gene * | getRoot () const |
Return the root gene of the genetic programming tree. |
This class extends the generic genetiK::Individual. It represents an individual as a gene tree.
|
creates an Individual and generates its tree.
|
|
creates a copy of an Individual
|
|
Copy this individual. copy this Individual. You should override this function in your Individual implementation, and return the appropriate new Individual, possibly, using the copy constructor. Implements genetiK::Individual. Implemented in genetiK::gp::st::Individual. |
|
Cross over.
Implements genetiK::Individual. Reimplemented in genetiK::gp::st::Individual. |
|
Extract a branch. Try to find and extract a branch labelled label
|
|
The fitness function. a function that quantifies the optimality of a solution. You should override this function in your Individual implementation, and evaluate your own fitness. Implements genetiK::Individual. Implemented in genetiK::gp::st::Individual. |
|
Return the cardinality of the tree. Return the cardinality of the tree. The cardinality of the tree is computed when you call setLabels(). You should call setLabels() before getCardinality().
|
|
Return the factory which generated this individual. This fuction is used to retrieve the IndividualFactory which generated this individual. The IndividualFactory is needed for the cross-over and mutation.
|
|
Return the root gene of the genetic programming tree. Return the root gene of the genetic programming tree.
|
|
mutate the individual
Implements genetiK::Individual. Reimplemented in genetiK::gp::st::Individual. |
|
Sets the labels to all the tree. Sets the labels to all the tree, and compute the cardinality and the eight of each node.
|
|
Substitute a branch. Try to find, and substitute a branch.
|
|
outputs the individual.
Reimplemented from genetiK::Individual. |