Generic chromosome. More...

#include <rga.h>

Inheritance diagram for RChromo< cInst, cChromo, cFit, cThreadData >:
[legend]

Public Member Functions

 RChromo (cInst *inst, size_t id)
 
virtual void Init (cThreadData *thData)
 
virtual void RandomConstruct (void)
 
virtual void Evaluate (void)
 
virtual void Crossover (cChromo *parent1, cChromo *parent2)
 
virtual void Mutation (void)
 
virtual void StrongMutation (void)
 
virtual void Inversion (void)
 
virtual void Optimisation (void)
 
virtual void Print (void)
 
virtual void Verify (void)
 
virtual void Copy (const cChromo &chromo)
 
virtual ~RChromo (void)
 

Public Attributes

cInst * Instance
 
size_t Id
 
cFit * Fitness
 
bool ToEval
 

Detailed Description

template<class cInst, class cChromo, class cFit, class cThreadData>
singleton R::RChromo< cInst, cChromo, cFit, cThreadData >

Generic chromosome.

Chromosome for the generic GA.

Constructor & Destructor Documentation

RChromo ( cInst *  inst,
size_t  id 
)

Construct the chromosome.

Parameters
instPointer to the instance.
idIdentifier of the chromosome.
virtual ~RChromo ( void  )
virtual

Destruct the chromosome.

Member Function Documentation

virtual void Evaluate ( void  )
virtual
virtual void Crossover ( cChromo *  parent1,
cChromo *  parent2 
)
virtual
virtual void StrongMutation ( void  )
virtual

Do a strong mutation with the chromosome (by default, it called the normal muation.

virtual void Optimisation ( void  )
virtual

Perform an optimization. This function is called every time a chromosome is modified by the crossover, inversion, or the mutation operator.

Reimplemented in RChromoSG< cInst, cChromo, cThreadData, cGroup, cObj >, RChromoG< cInst, cChromo, cFit, cThreadData, cGroup, cObj >, RChromoG< cInst, cChromo, RFitnessNN, cThreadData, cGroup, cObj >, and RChromoG< cInst, cChromo, RFitnessSG, cThreadData, cGroup, cObj >.

virtual void Print ( void  )
virtual

Print information on screen.

Reimplemented in RChromoH< cInst, cChromo, cFit, cThreadData, cNode, cObj >.

Member Data Documentation

cInst* Instance

Pointer to the instance.

size_t Id

Identifier of the chromosome.

cFit* Fitness

Pointer to the fitness of the chromosome.

bool ToEval

Variable to indicate if the chromosome has to be evaluated again, for example after a crossover or a mutation.