jdisset / gaga

GAGA is a fast, header only, multi-objective, and distributed evolutionary algorithm library written in modern C++. It is designed to be easily usable with various genotype representations and allows the user to enable or disable several features such as novelty search or speciation. It also produces and exports various customizable statistics.
MIT License
18 stars 4 forks source link

Enabled isBetter function templatisation + minor typo fixes #2

Closed cmourglia closed 8 years ago

cmourglia commented 8 years ago

You can now create your GA with a second template parameter supposed to provide comparison between to doubles, e.g:

struct Lesser
{
    bool operator()(double a, double b) const { return a < b; }
};

When you create your GA, you call it with GA<DNA, Lesser> myGa; which will replace isBetter default comparison (greater than) by ours.

jdisset commented 8 years ago

Thanks a lot for this pr. I would rather have the isBetter method tied to a lambda function instead of it decided at compile time, that would allow for switching it along the evo run (although I agree it is rather uncommon to want to change such a thing during a run), and adding captures might be desirable in some cases.