Doing libes.a in src/es and adding t-eoReal.cpp in test
I had to move eoRealBounds to utils dir because of global objects Some domino consequences here and there ...
This commit is contained in:
parent
511dc26623
commit
4968d64b05
19 changed files with 120 additions and 25 deletions
|
|
@ -14,10 +14,10 @@ CXXFLAGS = -g -Wall
|
|||
###############################################################################
|
||||
|
||||
check_PROGRAMS = t-eoParetoFitness t-eoPareto t-eofitness t-eoRandom t-eobin t-eoStateAndParser t-eoCheckpointing t-eoSSGA \
|
||||
t-eoExternalEO t-eoSymreg t-eo t-eoReplacement t-eoSelect t-eoGenOp t-eoGA t-eoVector
|
||||
t-eoExternalEO t-eoSymreg t-eo t-eoReplacement t-eoSelect t-eoGenOp t-eoGA t-eoReal t-eoVector
|
||||
TESTS=run_tests t-eoVector t-eoRandom t-eoSSGA t-eoPareto t-eoParetoFitness
|
||||
# removing temporarily t-eoESFull
|
||||
#noinst_PROGRAMS = t-eofitness t-eobin t-eoStateAndParser t-eoCheckpointing t-eoExternalEO t-eoESFull t-eoSymreg t-eo t-eoReplacement t-eoSelect t-eoGenOp t-eoGA
|
||||
# noinst_PROGRAMS = t-eofitness t-eobin t-eoStateAndParser t-eoCheckpointing t-eoExternalEO t-eoESFull t-eoSymreg t-eo t-eoReplacement t-eoSelect t-eoGenOp t-eoGA t-eoReal
|
||||
|
||||
###############################################################################
|
||||
|
||||
|
|
@ -115,6 +115,13 @@ t_eoGA_LDADD = $(top_builddir)/src/ga/libga.a $(LDADDS)
|
|||
|
||||
###############################################################################
|
||||
|
||||
t_eoReal_SOURCES = t-eoReal.cpp real_value.h
|
||||
t_eoReal_DEPENDENCIES = $(DEPS) $(top_builddir)/src/es/libes.a
|
||||
t_eoReal_LDFLAGS = -lm
|
||||
t_eoReal_LDADD = $(top_builddir)/src/es/libes.a $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_eoSSGA_SOURCES = t-eoSSGA.cpp binary_value.h
|
||||
t_eoSSGA_DEPENDENCIES = $(DEPS) $(top_builddir)/src/ga/libga.a
|
||||
t_eoSSGA_LDFLAGS = -lm
|
||||
|
|
|
|||
70
eo/test/t-eoReal.cpp
Normal file
70
eo/test/t-eoReal.cpp
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
#include <iostream>
|
||||
|
||||
#include <es/es.h>
|
||||
#include "real_value.h"
|
||||
#include <apply.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
typedef eoReal<eoMinimizingFitness> EOT;
|
||||
|
||||
eoParser parser(argc, argv); // for user-parameter reading
|
||||
|
||||
eoState state; // keeps all things allocated
|
||||
|
||||
///// FIRST, problem or representation dependent stuff
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
// The evaluation fn - encapsulated into an eval counter for output
|
||||
eoEvalFuncPtr<EOT, double, const std::vector<double>&>
|
||||
mainEval( real_value );
|
||||
eoEvalFuncCounter<EOT> eval(mainEval);
|
||||
|
||||
// the genotype - through a genotype initializer
|
||||
eoInit<EOT>& init = make_genotype(parser, state, eoMinimizingFitness());
|
||||
|
||||
// Build the variation operator (any seq/prop construct)
|
||||
eoGenOp<EOT>& op = make_op(parser, state, init);
|
||||
|
||||
//// Now the representation-independent things
|
||||
//////////////////////////////////////////////
|
||||
|
||||
// initialize the population - and evaluate
|
||||
// yes, this is representation indepedent once you have an eoInit
|
||||
eoPop<EOT>& pop = make_pop(parser, state, init);
|
||||
apply(eval, pop);
|
||||
|
||||
// stopping criteria
|
||||
eoContinue<EOT> & term = make_continue(parser, state, eval);
|
||||
// output
|
||||
eoCheckPoint<EOT> & checkpoint = make_checkpoint(parser, state, eval, term);
|
||||
// algorithm (need the operator!)
|
||||
eoAlgo<EOT>& ga = make_algo_scalar(parser, state, eval, checkpoint, op);
|
||||
|
||||
///// End of construction of the algorith
|
||||
/////////////////////////////////////////
|
||||
// to be called AFTER all parameters have been read!!!
|
||||
make_help(parser);
|
||||
|
||||
//// GO
|
||||
///////
|
||||
cout << "Initial Population\n";
|
||||
pop.sortedPrintOn(cout);
|
||||
cout << endl;
|
||||
|
||||
run_ea(ga, pop); // run the ga
|
||||
|
||||
cout << "Final Population\n";
|
||||
pop.sortedPrintOn(cout);
|
||||
cout << endl;
|
||||
}
|
||||
catch(exception& e)
|
||||
{
|
||||
cout << e.what() << endl;
|
||||
}
|
||||
}
|
||||
Reference in a new issue