1 #ifndef __GENERATOR_GENERATOR_H
2 #define __GENERATOR_GENERATOR_H
7 #include "../chromosome.h"
8 #include "../generation.h"
15 * Generator for generating entire Generation of Chromosomes (individuals)
17 template < typename _Chromosome >
21 * Type representing Chromosome Gene
23 typedef typename _Chromosome::GeneType GeneType;
26 * Size of the generation to generate
28 unsigned int generationSize;
31 * Size of the chromosome to generate
33 unsigned int chromosomeSize;
36 * Breeding calculations should be done here...
38 * @return newly breeded Generation
40 virtual ::genetic::Generation<_Chromosome> do_breed() = 0;
44 * Constructor. Initializes required variables and constants
46 * @param generationSize Indicates size of the generation
47 * @param chromosomeSize Indicates size of the chromosome
49 Generator(unsigned int generationSize, unsigned int chromosomeSize) {
50 this->generationSize = generationSize;
51 this->chromosomeSize = chromosomeSize;
54 srand((unsigned)time(&t));
58 * Breeds new generation of chromosomes.
60 * @return ::genetic::Generation Generation of Chromosomes
62 ::genetic::Generation<_Chromosome> breed() {
69 #endif /* __GENERATOR_GENERATOR_H */