170 bool store(FILE* f)
const;
180 static bool restore(
int numberIndividuals,std::map<int,std::string>& nameSet,std::map<int,RESTORE_GA_INDIVIDUAL*>& individualSet, std::map<
int,std::vector<int> >& linkSet, std::vector<Individual*>& storage);
188 static bool restoreParent(
int numberIndividuals,std::map<int,RESTORE_GA_INDIVIDUAL*>& individualSet);
Gen * getGen(int x) const
return a gen of the individual
Definition: Individual.h:85
double getFitnessC() const
this function calculate the fitness value of the individual (const)
Definition: Individual.cpp:57
bool isMutated(void) const
test if the individual a product of mutation
Definition: Individual.h:144
const Individual * getParent1(void) const
returns parent 1 of the individual
Definition: Individual.h:132
int getSize(void) const
return the size of the individual.
Definition: Individual.h:78
The Gen class.
Definition: Gen.h:51
int m_ID
the ID of the individual
Definition: Individual.h:199
Individual * m_parent1
parent 1
Definition: Individual.h:209
Individual * m_parent2
parent 2
Definition: Individual.h:214
virtual ~Individual()
default destructor
Definition: Individual.cpp:44
bool store(FILE *f) const
store the individual in a file
Definition: Individual.cpp:108
void removeGen(Gen *gen)
remove a specified gen from the individual
Definition: Individual.cpp:65
double getFitness()
this function calculate the fitness value of the individual
Definition: Individual.cpp:48
double m_fitness
save the calculated fitness value
Definition: Individual.h:229
static bool restore(int numberIndividuals, std::map< int, std::string > &nameSet, std::map< int, RESTORE_GA_INDIVIDUAL * > &individualSet, std::map< int, std::vector< int > > &linkSet, std::vector< Individual * > &storage)
restore all individual from a restore structure
Definition: Individual.cpp:155
bool isFitnessCalculated() const
returns the m_fitnessCalculated flag, which represent, that the fitness value was calculated before...
Definition: Individual.h:163
std::string m_name
the name of the individual
Definition: Individual.h:194
static bool restoreParent(int numberIndividuals, std::map< int, RESTORE_GA_INDIVIDUAL * > &individualSet)
restore the parent links from a restore structure
Definition: Individual.cpp:186
bool m_fitnessCalculated
remember if the fitness value was calculated
Definition: Individual.h:224
const std::vector< Gen * > & getGene(void) const
returns all gens of the individual
Definition: Individual.h:97
bool m_mutated
remember if the individual a product of mutation
Definition: Individual.h:219
void setMutated(void)
this select the individual as a product of mutation.
Definition: Individual.h:126
std::string RootToString(bool withMutation=true) const
returns a string with the parents and a mark for mutation
Definition: Individual.cpp:87
void addGen(Gen *gen)
add a gen to the individual.
Definition: Individual.h:91
int getID(void) const
return the ID of the individual
Definition: Individual.h:66
This class represent one individual of the complete gen.
Definition: Individual.h:45
const Individual * getParent2(void) const
returns parent 2 of the individual
Definition: Individual.h:138
std::vector< Gen * > m_gene
the gens inside the individual
Definition: Individual.h:204
std::string IndividualToString(void) const
returns a string, which repesent the individual (for logging)
Definition: Individual.cpp:73
std::string getName(void) const
return the name of the individual
Definition: Individual.h:72