5 #include "chromosome.h"
6 #include "generation.h"
7 #include "generator/generation.h"
9 #include "selection/roulette.h"
10 #include "crossover/crossover.h"
11 #include "mutation/mutation.h"
12 #include "fitness/wsti.h"
14 #include "algorithm.h"
17 using namespace genetic;
20 typedef Gene<int> _Gene;
21 typedef Chromosome<_Gene> _Chromosome;
23 typedef WSTI<_Chromosome> _Fitness;
24 typedef Roulette<_Chromosome> _Selection;
25 typedef Crossover<_Chromosome> _Crossover;
26 typedef Mutation<_Chromosome> _Mutation;
28 typedef generator::Generation<_Chromosome> _Generator;
29 typedef Algorithm<_Chromosome, _Selection, _Crossover, _Mutation> _Algorithm;
31 const int chromosomeSize = 11;
32 const int generationSize = 30;
33 const double crossoverChance = 0.75;
34 const double mutationChance = 0.01;
35 // const int numberOfGenerations = 100;
37 _Fitness fitness(0.5, 2.5);
38 _Generator generationGenerator(generationSize, chromosomeSize);
40 _Algorithm algorithm(generationGenerator, fitness, crossoverChance, mutationChance);
42 algorithm.searchForResult();