ECF 1.5
Individual.h
1#ifndef Individual_h
2#define Individual_h
3
4#include "Genotype.h"
5#include "Fitness.h"
6
11class Individual : public std::vector <GenotypeP>
12{
13protected:
14 StateP state_;
15
16public:
18 {
19 cid = 0;
20 }
21
22 Individual(StateP state);
23
24 bool initialize(StateP state);
25
26 void write(XMLNode&);
27
28 void read(XMLNode&);
29
30 std::string toString();
31
32 Individual* copy();
33
34 GenotypeP getGenotype(uint index = 0);
35
36 FitnessP getFitness();
37
38 FitnessP fitness;
39
40 uint index;
41
42 uint cid;
43};
44typedef boost::shared_ptr<Individual> IndividualP;
45
46#endif // Individual_h
47
Individual class - inherits a vector of Genotype objects.
Definition: Individual.h:12
FitnessP getFitness()
return sptr to individual's fitness object
Definition: Individual.cpp:50
uint cid
coherence index, used in asynchronous parallel algoritmhs
Definition: Individual.h:42
GenotypeP getGenotype(uint index=0)
return genotype with given index
Definition: Individual.cpp:44
void write(XMLNode &)
write individual to XML node
Definition: Individual.cpp:62
void read(XMLNode &)
read individual from XML node
Definition: Individual.cpp:103
bool initialize(StateP state)
initialize individual
Definition: Individual.cpp:12
std::string toString()
output individual to string
Definition: Individual.cpp:86
FitnessP fitness
sptr to individual's fitness object
Definition: Individual.h:38
uint index
individual's index in Deme
Definition: Individual.h:40
Individual * copy()
create a copy of the individual
Definition: Individual.cpp:31