7 #include "chromosome.h"
8 #include "generation.h"
9 #include "generator/generation.h"
11 #include "selection/roulette.h"
12 #include "crossover/crossover.h"
13 #include "mutation/mutation.h"
14 #include "fitness/wsti.h"
16 #include "algorithm.h"
17 #include "condition/condition.h"
20 using namespace genetic;
23 typedef Gene<int> _Gene;
24 typedef Chromosome<_Gene> _Chromosome;
26 typedef WSTI<_Chromosome> _Fitness;
27 typedef Roulette<_Chromosome> _Selection;
28 typedef Crossover<_Chromosome> _Crossover;
29 typedef Mutation<_Chromosome> _Mutation;
31 typedef generator::Generation<_Chromosome> _Generator;
32 typedef Algorithm<_Chromosome, _Selection, _Crossover, _Mutation, _Fitness> _Algorithm;
33 typedef Condition<_Chromosome> _Condition;
35 const int chromosomeSize = 10;
36 const int generationSize = 200;
37 const double crossoverChance = 0.75;
38 const double mutationChance = 0.1;
40 _Fitness fitness(0.5, 2.5);
41 _Generator generationGenerator(generationSize, chromosomeSize);
43 _Algorithm algorithm(generationGenerator, fitness, crossoverChance, mutationChance);
46 algorithm.searchForResult(condition);