Finished Roulette Selection.
[genetic.git] / src / generation.h
1 #ifndef __GENERATION_H
2 #define __GENERATION_H
3
4 #include <vector>
5
6 #include <gene.h>
7 #include <chromosome.h>
8
9 using namespace std;
10
11 namespace genetic {
12     /**
13      * Generation of given Chromosomes.
14      */
15     template < typename _Chromosome >
16     class Generation {
17     protected:
18         vector<_Chromosome> chromosomes;
19
20     public:
21         Generation() {}
22
23         Generation(vector<_Chromosome> chromosomes) {
24             this->chromosomes = chromosomes;
25         }
26
27         /** Copy constructor */
28         Generation(const Generation& generation)
29             : chromosomes(generation.get()) {
30         }
31
32         vector<_Chromosome> get() const {
33             return this->chromosomes;
34         }
35
36         Generation& operator=(const Generation& generation){
37             this->chromosomes = generation.get();
38             return *this;
39         }
40     };
41 }
42
43 #endif /* __GENERATION_H */