The big GeneraoOp interface change - in test dir

This commit is contained in:
evomarc 2001-02-09 05:43:06 +00:00
commit 018db6689a
4 changed files with 30 additions and 18 deletions

View file

@ -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_SOURCES = t-eoESFull.cpp real_value.h
t_eoESFull_DEPENDENCIES = $(DEPS) # t_eoESFull_DEPENDENCIES = $(DEPS)
t_eoESFull_LDFLAGS = -lm # t_eoESFull_LDFLAGS = -lm
t_eoESFull_LDADD = $(LDADDS) # t_eoESFull_LDADD = $(LDADDS)
############################################################################### ###############################################################################
@ -84,3 +86,10 @@ t_eo_LDFLAGS = -lm
t_eo_LDADD = $(LDADDS) t_eo_LDADD = $(LDADDS)
############################################################################### ###############################################################################
t_eoGenOp_SOURCES = t-eoGenOp.cpp
t_eoGenOp_DEPENDENCIES = $(DEPS)
t_eoGenOp_LDFLAGS = -lm
t_eoGenOp_LDADD = $(LDADDS)
###############################################################################

View file

@ -112,7 +112,7 @@ int main()
eoExternalInit<FitnessType, External> init(RandomStruct); eoExternalInit<FitnessType, External> init(RandomStruct);
eoExternalMonOp<FitnessType, External> mutate(UserDefMutate); eoExternalMonOp<FitnessType, External> mutate(UserDefMutate);
eoExternalBinOp<FitnessType, External> cross1(UserDefBinCrossover); eoExternalBinOp<FitnessType, External> cross1(UserDefBinCrossover);
eoExternalQuadraticOp<FitnessType, External> cross2(UserDefQuadCrossover); eoExternalQuadOp<FitnessType, External> cross2(UserDefQuadCrossover);
// eoExternalEvalFunc<FitnessType, External> eval(UserDefEvalFunc); // eoExternalEvalFunc<FitnessType, External> eval(UserDefEvalFunc);

View file

@ -15,7 +15,7 @@
// general // general
#include <utils/eoRNG.h> // Random number generators #include <utils/eoRNG.h> // Random number generators
#include <ga/eoBin.h> #include <ga.h>
#include <utils/eoParser.h> #include <utils/eoParser.h>
#include <utils/eoState.h> #include <utils/eoState.h>
@ -35,7 +35,7 @@ struct Dummy : public EO<double>
int the_main(int argc, char **argv) int the_main(int argc, char **argv)
{ // ok, we have a command line parser and a state { // ok, we have a command line parser and a state
typedef eoBin<float> Chrom; typedef eoBit<float> Chrom;
eoParser parser(argc, argv); eoParser parser(argc, argv);

View file

@ -211,8 +211,8 @@ int main()
typedef eoParseTree<FitnessType, GpNode> EoType; typedef eoParseTree<FitnessType, GpNode> EoType;
typedef eoPop<EoType> Pop; typedef eoPop<EoType> Pop;
const int MaxSize = 75; const int MaxSize = 100;
const int nGenerations = 50; const int nGenerations = 500;
// Initializor sequence, contains the allowable nodes // Initializor sequence, contains the allowable nodes
vector<GpNode> init(init_sequence, init_sequence + 5); vector<GpNode> init(init_sequence, init_sequence + 5);
@ -223,21 +223,24 @@ int main()
// Root Mean Squared Error Measure // Root Mean Squared Error Measure
RMS<FitnessType, GpNode> eval; RMS<FitnessType, GpNode> eval;
Pop pop(500, initializer); Pop pop(5000, initializer);
apply<EoType>(eval, pop); apply<EoType>(eval, pop);
eoSubtreeXOver<FitnessType, GpNode> xover(MaxSize); eoSubtreeXOver<FitnessType, GpNode> xover(MaxSize);
eoBranchMutation<FitnessType, GpNode> mutation(initializer, MaxSize); eoBranchMutation<FitnessType, GpNode> mutation(initializer, MaxSize);
eoSequentialGOpSel<EoType> seqSel; // The operators are encapsulated into an eoTRansform object,
// that performs sequentially crossover and mutation
eoSGATransform<EoType> transform(xover, 0.75, mutation, 0.25);
seqSel.addOp(mutation, 0.25); // The robust tournament selection
seqSel.addOp(xover, 0.75); eoDetTournamentSelect<EoType> selectOne(2); // tSize in [2,POPSIZE]
// is now encapsulated in a eoSelectMany: 2 at a time -> SteadyState
eoSelectMany<EoType> select(selectOne,2, eo_is_an_integer);
eoDetTournamentSelect<EoType> selector(5); // and the Steady-State replacement
eoSSGAWorseReplacement<EoType> replace;
eoDetTournamentInserter<EoType> inserter(eval, 5);
// Terminators // Terminators
eoGenContinue<EoType> term(nGenerations); eoGenContinue<EoType> term(nGenerations);
@ -256,7 +259,7 @@ int main()
monitor.add(best); monitor.add(best);
// GP generation // GP generation
eoSteadyStateEA<EoType> gp(seqSel, selector, inserter, checkPoint); eoEasyEA<EoType> gp(checkPoint, eval, select, transform, replace);
cout << "Initialization done" << endl; cout << "Initialization done" << endl;