7 #include <chromosome.h>
13 * Class representing Generation of given Chromosomes.
15 template < typename _Chromosome >
19 * Chromosomes in the given Generation
21 vector<_Chromosome> chromosomes;
23 template<typename> friend class Generation;
31 * Class constructor. Initializes generation with the given chromosomes
33 * @param chromosomes vector containing Chromosomes to use in Generation
35 Generation(vector<_Chromosome> chromosomes) {
36 this->chromosomes = chromosomes;
39 /** Copy constructor */
40 Generation(const Generation& generation)
41 : chromosomes(generation.chromosomes) {
47 * @param generation Generation from which the Chromosomes should be copied.
48 * @return Generation instance containing copied Chromosomes
50 Generation& operator=(const Generation& generation){
51 this->chromosomes = generation.chromosomes;
56 * Returns number of Chromosomes in current Generation
58 * @return number of Chromosomes in current Generation
60 unsigned int size() const {
61 return this->chromosomes.size();
65 * Returns i-th Chromosome in the current Generation
67 * @return i-th Chromosome in the current Generation
69 _Chromosome& operator[](unsigned int i) {
70 return this->chromosomes[i];
75 #endif /* __GENERATION_H */