A small header library for quick integration of genetic algorithms into other C++ projects.
- Bitstring representation (BitGeno)
- real valued representation (FloatGeno)
- Stochastic Universal Sampling
class YourClass : public Geno
{
void initializeRandom(pcg32&) {}
Pheno* generatePhenotype() {}
Geno* copy() {}
void mutate(pcg32&, float) {}
Geno* crossover(Geno*, pcg32&, float) {}
};
class YourPheno : public Pheno
{
double evaluateFitness() {}
};
GA<YourGeno, SUS> ga = GA<YourGeno, SUS>();
ga.evolve();
Geno* best = ga.getBestGenInds()[0];
cout << "Best Individual: " << endl;
best->print();
cout << "Best Fitness: " << best->evaluateFitness() << endl;
- Zack Misso