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
|
|
@ -13,16 +13,17 @@ LDADDS = $(top_builddir)/src/libeo.a $(top_builddir)/src/utils/libeoutils.a
|
|||
CXXFLAGS = -g
|
||||
###############################################################################
|
||||
|
||||
noinst_PROGRAMS = t-eofitness t-eobin t-eoStateAndParser t-eoCheckpointing t-eoExternalEO t-eoSymreg t-eo t-eoReplacement t-eoSelect t-eoGenOp
|
||||
check_PROGRAMS = t-eofitness t-eobin t-eoStateAndParser t-eoCheckpointing t-eoExternalEO t-eoSymreg t-eo t-eoReplacement t-eoSelect t-eoGenOp t-eoGA
|
||||
TESTS=run_tests
|
||||
# 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
|
||||
#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_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)
|
||||
|
||||
###############################################################################
|
||||
|
||||
|
|
@ -39,57 +40,64 @@ t_eobin_LDADD = $(LDADDS)
|
|||
###############################################################################
|
||||
|
||||
t_eoStateAndParser_SOURCES = t-eoStateAndParser.cpp
|
||||
t_eoStateAndParser_DEPENDENCIES = $(DEPS)
|
||||
t_eoStateAndParser_LDFLAGS = -lm
|
||||
t_eoStateAndParser_LDADD = $(LDADDS)
|
||||
t_eoStateAndParser_DEPENDENCIES = $(DEPS)
|
||||
t_eoStateAndParser_LDFLAGS = -lm
|
||||
t_eoStateAndParser_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_eoCheckpointing_SOURCES = t-eoCheckpointing.cpp
|
||||
t_eoCheckpointing_DEPENDENCIES = $(DEPS)
|
||||
t_eoCheckpointing_LDFLAGS = -lm
|
||||
t_eoCheckpointing_LDADD = $(LDADDS)
|
||||
t_eoCheckpointing_DEPENDENCIES = $(DEPS)
|
||||
t_eoCheckpointing_LDFLAGS = -lm
|
||||
t_eoCheckpointing_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_eoReplacement_SOURCES = t-eoReplacement.cpp
|
||||
t_eoReplacement_DEPENDENCIES = $(DEPS)
|
||||
t_eoReplacement_LDFLAGS = -lm
|
||||
t_eoReplacement_LDADD = $(LDADDS)
|
||||
t_eoReplacement_DEPENDENCIES = $(DEPS)
|
||||
t_eoReplacement_LDFLAGS = -lm
|
||||
t_eoReplacement_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_eoSelect_SOURCES = t-eoSelect.cpp
|
||||
t_eoSelect_DEPENDENCIES = $(DEPS)
|
||||
t_eoSelect_LDFLAGS = -lm
|
||||
t_eoSelect_LDADD = $(LDADDS)
|
||||
t_eoSelect_DEPENDENCIES = $(DEPS)
|
||||
t_eoSelect_LDFLAGS = -lm
|
||||
t_eoSelect_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_eoExternalEO_SOURCES = t-eoExternalEO.cpp
|
||||
t_eoExternalEO_DEPENDENCIES = $(DEPS)
|
||||
t_eoExternalEO_LDFLAGS = -lm
|
||||
t_eoExternalEO_LDADD = $(LDADDS)
|
||||
t_eoExternalEO_DEPENDENCIES = $(DEPS)
|
||||
t_eoExternalEO_LDFLAGS = -lm
|
||||
t_eoExternalEO_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_eoSymreg_SOURCES = t-eoSymreg.cpp
|
||||
t_eoSymreg_DEPENDENCIES = $(DEPS)
|
||||
t_eoSymreg_LDFLAGS = -lm
|
||||
t_eoSymreg_LDADD = $(LDADDS)
|
||||
t_eoSymreg_DEPENDENCIES = $(DEPS)
|
||||
t_eoSymreg_LDFLAGS = -lm
|
||||
t_eoSymreg_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_eo_SOURCES = t-eo.cpp
|
||||
t_eo_DEPENDENCIES = $(DEPS)
|
||||
t_eo_LDFLAGS = -lm
|
||||
t_eo_LDADD = $(LDADDS)
|
||||
t_eo_DEPENDENCIES = $(DEPS)
|
||||
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)
|
||||
t_eoGenOp_DEPENDENCIES = $(DEPS)
|
||||
t_eoGenOp_LDFLAGS = -lm
|
||||
t_eoGenOp_LDADD = $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
||||
t_eoGA_SOURCES = t-eoGA.cpp binary_value.h
|
||||
t_eoGA_DEPENDENCIES = $(DEPS) $(top_builddir)/src/ga/libga.a
|
||||
t_eoGA_LDFLAGS = -lm
|
||||
t_eoGA_LDADD = $(top_builddir)/src/ga/libga.a $(LDADDS)
|
||||
|
||||
###############################################################################
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/sh
|
||||
#!/bin/sh
|
||||
echo "Starting t-eo"
|
||||
./t-eo > eo.log
|
||||
|
||||
|
|
@ -33,6 +33,9 @@ echo "Testing t-eobin"
|
|||
echo "Testing t-eofitness"
|
||||
./t-eofitness > fitness.log
|
||||
|
||||
echo "Testing t-eoGA"
|
||||
./t-eoGA > t-eoGA.log
|
||||
|
||||
echo "Finished"
|
||||
|
||||
#TODO test if an error occured
|
||||
|
|
|
|||
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;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue