7 #include "chromosome.h"
11 * Class representing Generation of given Chromosomes.
13 template < typename _Chromosome >
17 * Chromosomes in the given Generation
19 std::vector<_Chromosome> chromosomes;
21 template<typename> friend class Generation;
29 * Class constructor. Initializes generation with the given chromosomes
31 * @param chromosomes vector containing Chromosomes to use in Generation
33 Generation(const std::vector<_Chromosome>& chromosomes) {
34 this->chromosomes = chromosomes;
37 /** Copy constructor */
38 Generation(const Generation& generation)
39 : chromosomes(generation.chromosomes) {
45 * @param generation Generation from which the Chromosomes should be copied.
46 * @return Generation instance containing copied Chromosomes
48 Generation& operator=(const Generation& generation){
49 this->chromosomes = generation.chromosomes;
54 * Returns number of Chromosomes in current Generation
56 * @return number of Chromosomes in current Generation
58 unsigned int size() const {
59 return this->chromosomes.size();
63 * Returns i-th Chromosome in the current Generation
65 * @return i-th Chromosome in the current Generation
67 _Chromosome& operator[](const unsigned int i) {
68 return this->chromosomes[i];
73 #endif /* __GENERATION_H */