From 018db6689a1604502555033ba92b0048f834932f Mon Sep 17 00:00:00 2001 From: evomarc Date: Fri, 9 Feb 2001 05:43:06 +0000 Subject: [PATCH] The big GeneraoOp interface change - in test dir --- eo/test/Makefile.am | 19 ++++++++++++++----- eo/test/t-eoExternalEO.cpp | 2 +- eo/test/t-eoStateAndParser.cpp | 4 ++-- eo/test/t-eoSymreg.cpp | 23 +++++++++++++---------- 4 files changed, 30 insertions(+), 18 deletions(-) diff --git a/eo/test/Makefile.am b/eo/test/Makefile.am index d69a6082..3f00251f 100644 --- a/eo/test/Makefile.am +++ b/eo/test/Makefile.am @@ -13,14 +13,16 @@ LDADDS = $(top_builddir)/src/libeo.a $(top_builddir)/src/utils/libeoutils.a ############################################################################### -noinst_PROGRAMS = t-eofitness t-eobin t-eoStateAndParser t-eoCheckpointing t-eoExternalEO t-eoESFull t-eoSymreg t-eo t-eoReplacement t-eoSelect +noinst_PROGRAMS = t-eofitness t-eobin t-eoStateAndParser t-eoCheckpointing t-eoExternalEO t-eoSymreg t-eo t-eoReplacement t-eoSelect t-eoGenOp +# 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_eoESFull_SOURCES = t-eoESFull.cpp real_value.h -t_eoESFull_DEPENDENCIES = $(DEPS) -t_eoESFull_LDFLAGS = -lm -t_eoESFull_LDADD = $(LDADDS) +# t_eoESFull_SOURCES = t-eoESFull.cpp real_value.h +# t_eoESFull_DEPENDENCIES = $(DEPS) +# t_eoESFull_LDFLAGS = -lm +# t_eoESFull_LDADD = $(LDADDS) ############################################################################### @@ -84,3 +86,10 @@ t_eo_LDFLAGS = -lm t_eo_LDADD = $(LDADDS) ############################################################################### + +t_eoGenOp_SOURCES = t-eoGenOp.cpp +t_eoGenOp_DEPENDENCIES = $(DEPS) +t_eoGenOp_LDFLAGS = -lm +t_eoGenOp_LDADD = $(LDADDS) + +############################################################################### diff --git a/eo/test/t-eoExternalEO.cpp b/eo/test/t-eoExternalEO.cpp index c880ba21..f9bb69b4 100644 --- a/eo/test/t-eoExternalEO.cpp +++ b/eo/test/t-eoExternalEO.cpp @@ -112,7 +112,7 @@ int main() eoExternalInit init(RandomStruct); eoExternalMonOp mutate(UserDefMutate); eoExternalBinOp cross1(UserDefBinCrossover); - eoExternalQuadraticOp cross2(UserDefQuadCrossover); + eoExternalQuadOp cross2(UserDefQuadCrossover); // eoExternalEvalFunc eval(UserDefEvalFunc); diff --git a/eo/test/t-eoStateAndParser.cpp b/eo/test/t-eoStateAndParser.cpp index f1548dfc..420da234 100644 --- a/eo/test/t-eoStateAndParser.cpp +++ b/eo/test/t-eoStateAndParser.cpp @@ -15,7 +15,7 @@ // general #include // Random number generators -#include +#include #include #include @@ -35,7 +35,7 @@ struct Dummy : public EO int the_main(int argc, char **argv) { // ok, we have a command line parser and a state - typedef eoBin Chrom; + typedef eoBit Chrom; eoParser parser(argc, argv); diff --git a/eo/test/t-eoSymreg.cpp b/eo/test/t-eoSymreg.cpp index 21a0d94d..ca76e772 100644 --- a/eo/test/t-eoSymreg.cpp +++ b/eo/test/t-eoSymreg.cpp @@ -211,8 +211,8 @@ int main() typedef eoParseTree EoType; typedef eoPop Pop; - const int MaxSize = 75; - const int nGenerations = 50; + const int MaxSize = 100; + const int nGenerations = 500; // Initializor sequence, contains the allowable nodes vector init(init_sequence, init_sequence + 5); @@ -223,21 +223,24 @@ int main() // Root Mean Squared Error Measure RMS eval; - Pop pop(500, initializer); + Pop pop(5000, initializer); apply(eval, pop); eoSubtreeXOver xover(MaxSize); eoBranchMutation mutation(initializer, MaxSize); - eoSequentialGOpSel seqSel; + // The operators are encapsulated into an eoTRansform object, + // that performs sequentially crossover and mutation + eoSGATransform transform(xover, 0.75, mutation, 0.25); - seqSel.addOp(mutation, 0.25); - seqSel.addOp(xover, 0.75); + // The robust tournament selection + eoDetTournamentSelect selectOne(2); // tSize in [2,POPSIZE] + // is now encapsulated in a eoSelectMany: 2 at a time -> SteadyState + eoSelectMany select(selectOne,2, eo_is_an_integer); - eoDetTournamentSelect selector(5); - - eoDetTournamentInserter inserter(eval, 5); + // and the Steady-State replacement + eoSSGAWorseReplacement replace; // Terminators eoGenContinue term(nGenerations); @@ -256,7 +259,7 @@ int main() monitor.add(best); // GP generation - eoSteadyStateEA gp(seqSel, selector, inserter, checkPoint); + eoEasyEA gp(checkPoint, eval, select, transform, replace); cout << "Initialization done" << endl;