Skip to content

MaurycyLiebner/EGenetic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

EGenetic

Qt based genetic algoritms library.

Example

See include/egenetic.h.

EGeneticFunctions<double> funcs;

funcs.fGenerator = []() {
    return 0.01* rand() % 100;
};

funcs.fBreeder = [](const double& s1, const double& s2) {
    return 0.5*(s1 + s2);
};

funcs.fSelector = [](const double& s) {
    return 10000 * (s - 1./3.);
};

funcs.fReceiver = [](const std::vector<double>& ss) {
    // here handle the result
};

funcs.fStopped = []() {
    // here delete the EGenetic<double> instance
};

EGeneticSettings sett;
// set how often to receive results (the lower the value the more often)
sett.fReceiveInc = 100;

const auto g = new EGenetic<double>();
g->start(funcs, sett);
// call g->stop() when you want to stop the calculations