1 #ifndef __GENERATOR_GENERATOR_H
2 #define __GENERATOR_GENERATOR_H
8 #include "../chromosome.h"
9 #include "../generation.h"
16 * Generator for generating entire Generation of Chromosomes (individuals)
18 template < typename _Chromosome >
22 * Type representing Chromosome Gene
24 typedef typename _Chromosome::GeneType GeneType;
27 * Size of the generation to generate
29 const unsigned int generationSize;
32 * Size of the chromosome to generate
34 const unsigned int chromosomeSize;
37 * Breeding calculations should be done here...
39 * @return newly breeded Generation
41 virtual ::genetic::Generation<_Chromosome> do_breed() = 0;
45 * Constructor. Initializes required variables and constants
47 * @param generationSize Indicates size of the generation
48 * @param chromosomeSize Indicates size of the chromosome
50 Generator(const unsigned int generationSize, const unsigned int chromosomeSize)
51 : generationSize(generationSize), 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 */