genetiK::gp::IndividualFactory Class Reference
[Genetic Programming framework]

IndividualFactory: GP-specific Individual Factory. More...

#include <IndividualFactory.h>

Inheritance diagram for genetiK::gp::IndividualFactory:

Inheritance graph
[legend]
Collaboration diagram for genetiK::gp::IndividualFactory:

Collaboration graph
[legend]
List of all members.

Public Types

enum  EGenerateGeneFlags { TERMINAL = 1, FUNCTION = 2 }
 Node flags. More...

Public Member Functions

 IndividualFactory (unsigned char maxHeight, ETreeInitialization treeInitialization)
 Creates a factory that generates Individual objects for the Genetic Programming.
virtual ~IndividualFactory ()
 destructor
genetiK::Individualgenerate ()=0
 abstract generate function
virtual GenegenerateGene (EGenerateGeneFlags flags)=0
 abstract generate gene function
virtual GenegenerateBranch (unsigned char height, ETreeInitialization treeInitialization)
 generate a new branch
virtual GenegenerateTree ()
 generate a new tree
unsigned char getMaxHeight () const
 max heigth of a tree
ETreeInitialization getTreeInitialization () const
 return the tree initialization method

Protected Member Functions

virtual void generateChildren (Gene *branchRoot, unsigned char height)
 populate a node generating all its subbranches

Detailed Description

IndividualFactory: GP-specific Individual Factory.

This class extends the generic genetiK::IndividualFactory to generate individuals to be used with Genetic Algorithms.


Constructor & Destructor Documentation

genetiK::gp::IndividualFactory::IndividualFactory unsigned char  maxHeight,
ETreeInitialization  treeInitialization
 

Creates a factory that generates Individual objects for the Genetic Programming.

Parameters:
maxHeight max height of the tree
treeInitialization Tree initialization method: FULL or GROW
See also:
EGenerateGeneFlags


Member Function Documentation

genetiK::Individual* genetiK::gp::IndividualFactory::generate  )  [pure virtual]
 

abstract generate function

This function must be extended by sublcasses to generate appropriate individuals.

Returns:
a new Individual

Implements genetiK::IndividualFactory.

Implemented in genetiK::gp::st::IndividualFactory.

gp::Gene * genetiK::gp::IndividualFactory::generateBranch unsigned char  height,
ETreeInitialization  treeInitialization
[virtual]
 

generate a new branch

This function generate a new branch.

Parameters:
height the max height of the new branch
treeInitialization GROW or FULL
Returns:
the new branch

Reimplemented in genetiK::gp::st::IndividualFactory.

void genetiK::gp::IndividualFactory::generateChildren Gene branchRoot,
unsigned char  height
[protected, virtual]
 

populate a node generating all its subbranches

This method generates all branchRoot subbranches.

Parameters:
branchRoot the gene to be populated
height the max height of the subbranches

Reimplemented in genetiK::gp::st::IndividualFactory.

virtual Gene* genetiK::gp::IndividualFactory::generateGene EGenerateGeneFlags  flags  )  [pure virtual]
 

abstract generate gene function

This function must be extended by sublcasses to generate appropriate gene. This function returns a random gene obeying the rules specified in flags.

Parameters:
flags TERMINAL for a gene with arity equal to 1 and FUNCTION for a gene with greter or equal to 1. If both the flags are specified, you should return a random gene (TERMINAL or FUNCTION)
Returns:
a random gene

Gene * genetiK::gp::IndividualFactory::generateTree  )  [virtual]
 

generate a new tree

It simply calls the generateBranch with the appropriate height

Returns:
the new tree
See also:
generateBranch

Reimplemented in genetiK::gp::st::IndividualFactory.

unsigned char genetiK::gp::IndividualFactory::getMaxHeight  )  const [inline]
 

max heigth of a tree

return the upper bound of a tree height

Returns:
the upper bound
See also:
generateBranch

ETreeInitialization genetiK::gp::IndividualFactory::getTreeInitialization  )  const [inline]
 

return the tree initialization method

return the tree initialization method

Returns:
the tree initialization method
See also:
ETreeInitialization


The documentation for this class was generated from the following files:
Generated on Thu Feb 23 12:22:31 2006 for GenetiK by  doxygen 1.4.6