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
|
|
@ -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 )
|
||||
|
|
|
|||
Reference in a new issue