Generic chromosome. More...
#include <rga.h>
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
-
inst Pointer to the instance. id Identifier of the chromosome.
|
virtual |
Destruct the chromosome.
Member Function Documentation
|
virtual |
Initialization of the chromosome.
- Parameters
-
thData Pointer to the "thread-dependent" data of the chromosome.
Reimplemented in RChromoSG< cInst, cChromo, cThreadData, cGroup, cObj >, RChromoNN< cInst, cChromo, cThreadData, cGroup, cObj >, RChromoH< cInst, cChromo, cFit, cThreadData, cNode, cObj >, RChromo2D< cInst, cChromo, cFit, cThreadData, cInfo >, RChromoG< cInst, cChromo, cFit, cThreadData, cGroup, cObj >, RChromoG< cInst, cChromo, RFitnessNN, cThreadData, cGroup, cObj >, and RChromoG< cInst, cChromo, RFitnessSG, cThreadData, cGroup, cObj >.
|
virtual |
Construct a valid solution.
Reimplemented in RChromoH< cInst, cChromo, cFit, cThreadData, cNode, cObj >, RChromo2D< cInst, cChromo, cFit, cThreadData, cInfo >, RChromoG< cInst, cChromo, cFit, cThreadData, cGroup, cObj >, RChromoG< cInst, cChromo, RFitnessNN, cThreadData, cGroup, cObj >, and RChromoG< cInst, cChromo, RFitnessSG, cThreadData, cGroup, cObj >.
|
virtual |
Evaluate the fitness of the chromosome.
Reimplemented in RChromoSG< cInst, cChromo, cThreadData, cGroup, cObj >, and RChromoNN< cInst, cChromo, cThreadData, cGroup, cObj >.
|
virtual |
Do a crossover by using the chromosome as child.
- Parameters
-
parent1 First parent used. parent2 Second parent used.
Reimplemented in RChromoH< cInst, cChromo, cFit, cThreadData, cNode, cObj >, RChromoG< cInst, cChromo, cFit, cThreadData, cGroup, cObj >, RChromoG< cInst, cChromo, RFitnessNN, cThreadData, cGroup, cObj >, RChromoG< cInst, cChromo, RFitnessSG, cThreadData, cGroup, cObj >, and RChromo2D< cInst, cChromo, cFit, cThreadData, cInfo >.
|
virtual |
Do a mutation with the chromosome.
Reimplemented in RChromoH< cInst, cChromo, cFit, cThreadData, cNode, cObj >, RChromoG< cInst, cChromo, cFit, cThreadData, cGroup, cObj >, RChromoG< cInst, cChromo, RFitnessNN, cThreadData, cGroup, cObj >, RChromoG< cInst, cChromo, RFitnessSG, cThreadData, cGroup, cObj >, and RChromo2D< cInst, cChromo, cFit, cThreadData, cInfo >.
|
virtual |
Do a strong mutation with the chromosome (by default, it called the normal muation.
|
virtual |
Do an inversion with the chromosome.
Reimplemented in RChromoG< cInst, cChromo, cFit, cThreadData, cGroup, cObj >, RChromoG< cInst, cChromo, RFitnessNN, cThreadData, cGroup, cObj >, and RChromoG< cInst, cChromo, RFitnessSG, cThreadData, cGroup, cObj >.
|
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 |
Print information on screen.
Reimplemented in RChromoH< cInst, cChromo, cFit, cThreadData, cNode, cObj >.
|
virtual |
Verify the validity of the chromosome.
Reimplemented in RChromoG< cInst, cChromo, cFit, cThreadData, cGroup, cObj >, RChromoG< cInst, cChromo, RFitnessNN, cThreadData, cGroup, cObj >, RChromoG< cInst, cChromo, RFitnessSG, cThreadData, cGroup, cObj >, RChromoH< cInst, cChromo, cFit, cThreadData, cNode, cObj >, and RChromo2D< cInst, cChromo, cFit, cThreadData, cInfo >.
|
virtual |
The assignment operator.
Reimplemented in RChromoSG< cInst, cChromo, cThreadData, cGroup, cObj >, RChromoG< cInst, cChromo, cFit, cThreadData, cGroup, cObj >, RChromoG< cInst, cChromo, RFitnessNN, cThreadData, cGroup, cObj >, RChromoG< cInst, cChromo, RFitnessSG, cThreadData, cGroup, cObj >, RChromoNN< cInst, cChromo, cThreadData, cGroup, cObj >, RChromoH< cInst, cChromo, cFit, cThreadData, cNode, cObj >, and RChromo2D< cInst, cChromo, cFit, cThreadData, cInfo >.
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.