Updated makefiles, updated the moo stuff and cleaned up some stuff that refused to compile
This commit is contained in:
parent
ffb683368f
commit
18adaef056
19 changed files with 66 additions and 48 deletions
|
|
@ -94,7 +94,7 @@ To add two values, do
|
|||
|
||||
Sym sym = var + const;
|
||||
|
||||
This will create a tree with tree nodes. All other operations work identically.
|
||||
This will create a tree with three nodes. Other operators are overloaded similarily.
|
||||
|
||||
=== Evaluation (eval/) ===
|
||||
|
||||
|
|
|
|||
|
|
@ -17,20 +17,20 @@
|
|||
# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
|
||||
# by quotes) that should identify the project.
|
||||
|
||||
PROJECT_NAME = EO
|
||||
PROJECT_NAME = Evolving Objects
|
||||
|
||||
# The PROJECT_NUMBER tag can be used to enter a project or revision number.
|
||||
# This could be handy for archiving the generated documentation or
|
||||
# if some version control system is used.
|
||||
|
||||
PROJECT_NUMBER = 1.0.2-cvs
|
||||
PROJECT_NUMBER = 1.02-cvs1
|
||||
|
||||
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
|
||||
# base path where the generated documentation will be put.
|
||||
# If a relative path is entered, it will be relative to the location
|
||||
# where doxygen was started. If left blank the current directory will be used.
|
||||
|
||||
OUTPUT_DIRECTORY =
|
||||
OUTPUT_DIRECTORY = /home/mkeijzer/projects/eo/doc
|
||||
|
||||
# The OUTPUT_LANGUAGE tag is used to specify the language in which all
|
||||
# documentation generated by doxygen is written. Doxygen will use this
|
||||
|
|
@ -104,7 +104,7 @@ FULL_PATH_NAMES = NO
|
|||
# If left blank the directory from which doxygen is run is used as the
|
||||
# path to strip.
|
||||
|
||||
STRIP_FROM_PATH =
|
||||
STRIP_FROM_PATH = /home/mkeijzer/projects/eo
|
||||
|
||||
# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
|
||||
# (but less readable) file names. This can be useful is your file systems
|
||||
|
|
@ -391,7 +391,7 @@ WARN_LOGFILE =
|
|||
# directories like "/usr/src/myproject". Separate the files or directories
|
||||
# with spaces.
|
||||
|
||||
INPUT = ..
|
||||
INPUT = /home/mkeijzer/projects/eo
|
||||
|
||||
# If the value of the INPUT tag contains directories, you can use the
|
||||
# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
|
||||
|
|
@ -414,7 +414,7 @@ RECURSIVE = YES
|
|||
# excluded from the INPUT source files. This way you can easily exclude a
|
||||
# subdirectory from a directory tree whose root is specified with the INPUT tag.
|
||||
|
||||
EXCLUDE = ../src/obsolete
|
||||
EXCLUDE = /home/mkeijzer/projects/eo/src/obsolete
|
||||
|
||||
# The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories
|
||||
# that are symbolic links (a Unix filesystem feature) are excluded from the input.
|
||||
|
|
|
|||
|
|
@ -47,11 +47,8 @@ public:
|
|||
typedef F Fitness;
|
||||
|
||||
/** Default constructor.
|
||||
Fitness must have a ctor which takes 0 as a value; we can not use void
|
||||
ctors here since default types like float have no void initializer.
|
||||
VC++ allows it, but gcc does not
|
||||
*/
|
||||
EO(): repFitness(Fitness()), invalidFitness(true) {}
|
||||
EO(): repFitness(Fitness()), invalidFitness(true) { }
|
||||
|
||||
/// Virtual dtor
|
||||
virtual ~EO() {};
|
||||
|
|
|
|||
|
|
@ -143,6 +143,7 @@ pkginclude_HEADERS = eo \
|
|||
eoWeightUpdater.h \
|
||||
es.h \
|
||||
ga.h \
|
||||
PO.h
|
||||
PO.h \
|
||||
eoTimeContinue.h
|
||||
|
||||
AM_CXXFLAGS = -I$(top_srcdir)/src
|
||||
|
|
|
|||
|
|
@ -127,6 +127,7 @@
|
|||
#include <eoParetoRanking.h>
|
||||
#include <eoNDSorting.h>
|
||||
|
||||
|
||||
// Algorithms
|
||||
#include <eoEasyEA.h>
|
||||
#include <eoSGA.h>
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ public:
|
|||
breed(_pop, offspring);
|
||||
|
||||
popEval(_pop, offspring); // eval of parents + offspring if necessary
|
||||
|
||||
|
||||
replace(_pop, offspring); // after replace, the new pop. is in _pop
|
||||
|
||||
if (pSize > _pop.size())
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@
|
|||
*/
|
||||
|
||||
template<class EOT>
|
||||
class eoPop: public std::vector<EOT>, public eoObject, public eoPersistent
|
||||
class eoPop: public std::vector<EOT>, public eoObject, public eoPersistent
|
||||
{
|
||||
|
||||
public:
|
||||
|
|
@ -295,7 +295,6 @@ class eoPop: public std::vector<EOT>, public eoObject, public eoPersistent
|
|||
this->operator[](i).invalidate();
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ public :
|
|||
}
|
||||
}
|
||||
|
||||
for (i=0; i < _pop.size(); i++)
|
||||
for (i=0; i < offspring.size(); i++)
|
||||
{
|
||||
if (rng.flip(mutationRate) )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -47,7 +47,9 @@ class eoCMABreed : public eoBreed< eoVector<FitT, double> > {
|
|||
|
||||
// two temporary arrays of pointers to store the sorted population
|
||||
std::vector<const EOT*> sorted(parents.size());
|
||||
std::vector<const std::vector<double>* > mu(parents.size());
|
||||
|
||||
// mu stores population as vector (instead of eoPop)
|
||||
std::vector<const std::vector<double>* > mu(parents.size());
|
||||
|
||||
parents.sort(sorted);
|
||||
for (unsigned i = 0; i < sorted.size(); ++i) {
|
||||
|
|
@ -55,7 +57,6 @@ class eoCMABreed : public eoBreed< eoVector<FitT, double> > {
|
|||
}
|
||||
|
||||
// learn
|
||||
|
||||
state.reestimate(mu, sorted[0]->fitness(), sorted.back()->fitness());
|
||||
|
||||
if (!state.updateEigenSystem(10)) {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,14 @@ libeomoo_a_SOURCES = eoFrontSorter.cpp \
|
|||
eoNSGA_IIa_Eval.cpp \
|
||||
eoNSGA_II_Eval.cpp
|
||||
|
||||
pkginclude_HEADERS = eoFrontSorter.h \
|
||||
eoMOFitness.h
|
||||
pkginclude_HEADERS =\
|
||||
eoEpsilonArchive.h\
|
||||
eoEpsMOEA.h\
|
||||
eoFrontSorter.h\
|
||||
eoMOEval.h\
|
||||
eoMOFitness.h\
|
||||
eoNSGA_I_Eval.h\
|
||||
eoNSGA_IIa_Eval.h\
|
||||
eoNSGA_II_Eval.h
|
||||
|
||||
AM_CXXFLAGS = -I$(top_srcdir)/src
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class eoEpsMOEA : public eoAlgo<EOT> {
|
|||
eoEvalFunc<EOT>& _eval,
|
||||
eoGenOp<EOT>& _op,
|
||||
const std::vector<double>& eps,
|
||||
unsigned max_archive_size
|
||||
unsigned max_archive_size = std::numeric_limits<unsigned>::max()
|
||||
) : continuator(_continuator),
|
||||
eval (_eval),
|
||||
loopEval(_eval),
|
||||
|
|
|
|||
|
|
@ -114,26 +114,6 @@ exitLoop:
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
static unsigned counter = 0;
|
||||
if (++counter % 500 == 0) {
|
||||
std::vector<long> mins(archive[0].discretized.size(), std::numeric_limits<long>::max());
|
||||
std::vector<long> maxs(archive[0].discretized.size(), std::numeric_limits<long>::min());
|
||||
for (unsigned i = 0; i < archive.size(); ++i) {
|
||||
for (unsigned dim = 0; dim < archive[i].discretized.size(); ++dim) {
|
||||
mins[dim] = std::min( mins[dim], archive[i].discretized[dim] );
|
||||
maxs[dim] = std::max( maxs[dim], archive[i].discretized[dim] );
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << "Range ";
|
||||
for (unsigned dim = 0; dim < mins.size(); ++dim) {
|
||||
std::cout << (maxs[dim] - mins[dim]) << ' ';
|
||||
}
|
||||
std::cout << archive.size() << std::endl;
|
||||
|
||||
}*/
|
||||
|
||||
if (archive.size() > max_size) {
|
||||
unsigned idx = rng.random(archive.size());
|
||||
if (idx != archive.size()-1) std::swap(archive[idx], archive.back());
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
|
||||
#include <limits>
|
||||
#include <eoNSGA_II_Eval.h>
|
||||
#include <moo/eoNSGA_II_Eval.h>
|
||||
|
||||
namespace nsga2 {
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class eoNSGA_II_Eval : public eoMOEval<EOT>
|
|||
eoNSGA_II_Eval(eoPopEvalFunc<EOT>& eval) : eoMOEval<EOT>(eval) {}
|
||||
|
||||
virtual void operator()(eoPop<EOT>& parents, eoPop<EOT>& offspring) {
|
||||
eval(parents, offspring);
|
||||
this->eval(parents, offspring);
|
||||
|
||||
std::vector<EOT*> pop;
|
||||
pop.reserve(parents.size() + offspring.size());
|
||||
|
|
|
|||
|
|
@ -16,7 +16,9 @@ OBJECTS=eoFunctorStore.o PyEO.o abstract1.o algos.o \
|
|||
random_numbers.o geneticOps.o selectOne.o continuators.o\
|
||||
reduce.o replacement.o selectors.o breeders.o\
|
||||
mergers.o valueParam.o perf2worth.o monitors.o\
|
||||
statistics.o
|
||||
statistics.o
|
||||
|
||||
LIB=../libeo.a ../utils/libeoutils.a
|
||||
|
||||
all: PyEO/PyEO.so
|
||||
|
||||
|
|
@ -24,7 +26,7 @@ clean:
|
|||
rm PyEO/*.so *.o test/*.pyc
|
||||
|
||||
PyEO/PyEO.so: $(OBJECTS)
|
||||
$(LINK) -o PyEO/PyEO.so $(OBJECTS) -lboost_python -lpython2.4 -shared #-lstlport
|
||||
$(LINK) -o PyEO/PyEO.so $(OBJECTS) -lboost_python -lpython2.4 ${LIB} -shared #-lstlport
|
||||
|
||||
eoFunctorStore.o: ../eoFunctorStore.h ../eoFunctorStore.cpp
|
||||
$(COMPILE) -o eoFunctorStore.o ../eoFunctorStore.cpp $(INC)
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ BOOST_PYTHON_MODULE(PyEO)
|
|||
|
||||
boost::python::class_<eoPop<PyEO> >("eoPop", init<>() )
|
||||
.def( init< unsigned, eoInit<PyEO>& >()[with_custodian_and_ward<1,3>()] )
|
||||
.def("append", &eoPop<PyEO>::append)
|
||||
.def("append", &eoPop<PyEO>::append, "docstring?")
|
||||
.def("__str__", to_string<eoPop<PyEO> >)
|
||||
.def("__len__", pop_size)
|
||||
.def("sort", pop_sort )
|
||||
|
|
|
|||
|
|
@ -108,4 +108,10 @@ t_eoEasyPSO_SOURCES = t-eoEasyPSO.cpp
|
|||
t_eoNSGA_SOURCES = t-eoNSGA.cpp
|
||||
t_eoFrontSorter_SOURCES = t-eoFrontSorter.cpp
|
||||
t_eoEpsMOEA_SOURCES = t-eoEpsMOEA.cpp
|
||||
t_eoInt_SOURCES = t-eoInt.cpp
|
||||
t_eoInitPermutation_SOURCES = t-eoInitPermutation.cpp
|
||||
t_eoSwapMutation_SOURCES = t-eoSwapMutation.cpp
|
||||
t_eoShiftMutation_SOURCES = t-eoShiftMutation.cpp
|
||||
t_eoTwoOptMutation_SOURCES = t-eoTwoOptMutation.cpp
|
||||
t_eoRingTopology_SOURCES = t-eoRingTopology.cpp
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@
|
|||
typedef EO<float> Chrom;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
int main()
|
||||
{
|
||||
Chrom chrom1, chrom2;
|
||||
|
|
@ -17,6 +16,7 @@ int main()
|
|||
std::cout << "chrom1 = " << chrom1 << std::endl
|
||||
<< "chrom2 = " << chrom2 << std::endl;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#include <eo>
|
||||
|
||||
#include <moo/eoEpsMOEA.h>
|
||||
#include <utils/eoFuncPtrStat.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
|
@ -133,6 +134,17 @@ class Init : public eoInit<eoDouble>
|
|||
}
|
||||
};
|
||||
|
||||
template <class EOT>
|
||||
unsigned get_size(const eoPop<EOT>& pop) {
|
||||
return pop.size();
|
||||
}
|
||||
|
||||
template <class EOT>
|
||||
unsigned counter(const eoPop<EOT>& pop) {
|
||||
static unsigned c = 0;
|
||||
return c++;
|
||||
}
|
||||
|
||||
// Test pareto dominance and perf2worth, and while you're at it, test the eoGnuPlot monitor as well
|
||||
void the_main(int argc, char* argv[])
|
||||
{
|
||||
|
|
@ -174,7 +186,20 @@ void the_main(int argc, char* argv[])
|
|||
|
||||
snapshot.add(fitness0);
|
||||
snapshot.add(fitness1);
|
||||
|
||||
eoGnuplot1DMonitor monitor("sizemon");
|
||||
|
||||
cp.add(monitor);
|
||||
|
||||
eoFuncPtrStat<eoDouble, unsigned> size(get_size<eoDouble>);
|
||||
eoFuncPtrStat<eoDouble, unsigned> counterStat(counter<eoDouble>);
|
||||
|
||||
monitor.add(counterStat);
|
||||
monitor.add(size);
|
||||
|
||||
cp.add(size);
|
||||
cp.add(counterStat);
|
||||
|
||||
// the algo
|
||||
eoEpsMOEA<eoDouble> ea(cp, eval, opsel, MinimizingFitnessTraits::eps );
|
||||
|
||||
|
|
|
|||
Reference in a new issue