7 #include "chromosome.h"
8 #include "generation.h"
9 #include "generator/bit.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"
18 #include "condition/generationLimit.h"
21 using namespace genetic;
24 typedef Gene<int> _Gene;
25 typedef Chromosome<_Gene> _Chromosome;
27 typedef WSTI<_Chromosome> _Fitness;
28 typedef Roulette<_Chromosome> _Selection;
29 typedef Crossover<_Chromosome> _Crossover;
30 typedef Mutation<_Chromosome> _Mutation;
32 typedef generator::Bit<_Chromosome> _Generator;
33 typedef Algorithm<_Chromosome, _Selection, _Crossover, _Mutation, _Fitness> _Algorithm;
34 typedef GenerationLimit<_Chromosome> _Condition;
36 const int chromosomeSize = 10;
37 const int generationSize = 200;
38 const double crossoverChance = 0.75;
39 const double mutationChance = 0.01;
41 _Fitness fitness(0.5, 2.5);
42 _Generator generationGenerator(generationSize, chromosomeSize);
44 _Algorithm algorithm(generationGenerator, fitness, crossoverChance, mutationChance);
45 _Condition condition(1000);
47 algorithm.searchForResult(condition);