#pragma once #include "Solution.h" typedef std::vector Solutions; typedef std::vector Scores; typedef float (*FitnessFn)(Solution*); typedef Solution* (*SelectionFn)(Solutions*, Scores*); typedef void (*CrossoverFn)(float rCross, Solution*, Solution*, Solution**, Solution**); typedef void (*MutatorFn)(Solution*, float); class GeneticAlgorithm { private: int generations; float rCross; float rMut; Solutions* population; // GA Functions FitnessFn fitness; SelectionFn selection; CrossoverFn crossover; MutatorFn mutate; public: GeneticAlgorithm(int nGen, float rCross, float rMut, Solutions* population, FitnessFn ff, SelectionFn sf, CrossoverFn cf, MutatorFn mf): // generations(nGen), rCross(rCross), rMut(rMut), population(population), fitness(ff), selection(sf), crossover(cf), mutate(mf) // {}; Solution* algorithm(); };