Ok, updated the Makefile.am again to use the
make check Command I picked up in the automake documentation (RTFM, you know) Tagged a lot of header functions in the GnuPlot files with 'inline', so they can be used from more than one sourcefile. Ok, now the interesting news. Started a new library libga (not to be confused with Matthew's GaLib). Here I suggest we put a fairly complete and configurable genetic algorithm. Just to see how far we can stretch ourselves and also to have a GA-componenent that can be used in other applications without having to rebuild the entire thing. test/t-eoGA.cpp tests this library
This commit is contained in:
parent
9f5069b23a
commit
dea8a51f7e
12 changed files with 260 additions and 81 deletions
36
eo/test/t-eoGA.cpp
Normal file
36
eo/test/t-eoGA.cpp
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
#include <iostream>
|
||||
|
||||
#include <ga/ga.h>
|
||||
#include "binary_value.h"
|
||||
#include <apply.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
typedef eoBit<double> EoType;
|
||||
|
||||
eoParser parser(argc, argv);
|
||||
|
||||
eoState state; // keeps all things allocated, including eoEasyEA and eoPop!
|
||||
|
||||
eoEvalFuncPtr<EoType, float> eval( binary_value<EoType> );
|
||||
eoGenContinue<EoType> term(20);
|
||||
eoCheckPoint<EoType> checkpoint(term);
|
||||
|
||||
eoAlgo<EoType>& ga = make_ga(parser, eval, checkpoint, state);
|
||||
|
||||
eoPop<EoType>& pop = init_ga(parser, state, double());
|
||||
|
||||
apply(eval, pop);
|
||||
|
||||
run_ga(ga, pop); // run the ga
|
||||
}
|
||||
catch(exception& e)
|
||||
{
|
||||
cout << e.what() << endl;
|
||||
}
|
||||
}
|
||||
Reference in a new issue