genetiK::gp::st::IndividualFactory Class Reference
[Strongly Typed Genetic Programming framework]

IndividualFactory: GP-ST-specific IndividualFactory. More...

#include <IndividualFactory.h>

Inheritance diagram for genetiK::gp::st::IndividualFactory:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

 IndividualFactory (unsigned char maxHeight, gp::ETreeInitialization treeInitialization, GeneType rootType)
 Creates a factory that creates Individual objects for the Strongly Typed Genetic Programming.
virtual ~IndividualFactory ()
 Destructor.
genetiK::Individualgenerate ()=0
 abstract generate function
GeneType getNextType () const
 return the type of the next gene to be created
void setNextType (const GeneType nextGeneType)
 set the type of the next gene to be created
virtual gp::GenegenerateBranch (unsigned char height, ETreeInitialization treeInitialization)
 generate a new branch

Protected Member Functions

virtual gp::GenegenerateGene (EGenerateGeneFlags flags)=0
 abstract generate gene function
virtual gp::GenegenerateTree ()
 generate a new tree It simply calls the generateBranch with the appropriate height and root type.
virtual void generateChildren (gp::Gene *branchRoot, unsigned char height)
 populate a node generating all its subbranches This method generates all branchRoot subbranches.

Detailed Description

IndividualFactory: GP-ST-specific IndividualFactory.

This class extends the genetiK::gp::Individual class. It represents an individual as a typed gene tree.


Constructor & Destructor Documentation

genetiK::gp::st::IndividualFactory::IndividualFactory unsigned char  maxHeight,
gp::ETreeInitialization  treeInitialization,
GeneType  rootType
 

Creates a factory that creates Individual objects for the Strongly Typed Genetic Programming.

Parameters:
maxHeight max height of the tree
treeInitialization Tree initialization method: FULL or GROW
rootType the type of the root gene
See also:
ETreeInitialization

gp::IndividualFactory


Member Function Documentation

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

abstract generate function

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

Returns:
a new Individual

Implements genetiK::gp::IndividualFactory.

gp::Gene * genetiK::gp::st::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 from genetiK::gp::IndividualFactory.

void genetiK::gp::st::IndividualFactory::generateChildren gp::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 from genetiK::gp::IndividualFactory.

virtual gp::Gene* genetiK::gp::st::IndividualFactory::generateGene EGenerateGeneFlags  flags  )  [protected, 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 and the nextGeneType returning a new random gene of type getNextType().

If the new created gene doesn't satisfy the specified rules, an Exception will be thrown

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
See also:
getNextType();

gp::Gene * genetiK::gp::st::IndividualFactory::generateTree  )  [protected, virtual]
 

generate a new tree It simply calls the generateBranch with the appropriate height and root type.

Returns:
the new tree
See also:
generateBranch

Reimplemented from genetiK::gp::IndividualFactory.

GeneType genetiK::gp::st::IndividualFactory::getNextType  )  const [inline]
 

return the type of the next gene to be created

Specifies the type of the next gene to be created.

Returns:
the type of the next gene
See also:
generateGene(EGenerateGeneFlags flags)

void genetiK::gp::st::IndividualFactory::setNextType const GeneType  nextGeneType  )  [inline]
 

set the type of the next gene to be created

Specifies the next type of the gene to be created.

Parameters:
nextGeneType the type of the next gene
See also:
generateGene(EGenerateGeneFlags flags)


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