changing Makefile.am's to accept new subdiretory structure
This commit is contained in:
parent
5467df160c
commit
1fe3a72e10
11 changed files with 148 additions and 72 deletions
|
|
@ -4,26 +4,17 @@
|
|||
##
|
||||
###############################################################################
|
||||
|
||||
SUBDIRS = es ga gp obsolete other utils
|
||||
|
||||
lib_LIBRARIES = libeo.a
|
||||
libeo_a_SOURCES = eoPrintable.cpp eoPersistent.cpp
|
||||
libeo_a_SOURCES = eoPrintable.o eoPersistent.o
|
||||
#libeo_a_LIBADD = libeoutils.a
|
||||
|
||||
libeoincdir = $(includedir)/eo
|
||||
libeoinc_HEADERS = EO.h eo eo1d.h eo1dWDistance.h eo2d.h \
|
||||
eo2dVector.h eoAged.h eoAlgo.h\
|
||||
eoAltBreeder.h \
|
||||
eoAtomBitFlip.h eoAtomCreep.h eoAtomMutation.h eoAtomMutator.h \
|
||||
eoAtomRandom.h eoBin.h eoBitOp.h eoBitOpFactory.h eoBreeder.h\
|
||||
eoData.h eoDetTournament.h eoDistance.h eoDup.h eoESChrom.h \
|
||||
eoESFullChrom.h eoESFullMut.h eoEasyEA.h\
|
||||
eoEvalFunc.h eoEvalFuncPtr.h eoEvalFuncPtrCnt.h eoFitTerm.h eoFitness.h\
|
||||
eoGenTerm.h eoGeneralOp.h eoGeneration.h eoGOpSelector.h eoID.h\
|
||||
eoInclusion.h eoInsertion.h\
|
||||
eoKill.h eoLottery.h eoMerge.h eoMultiBinOp.h eoMultiMonOp.h eoMutation.h eoNegExp.h\
|
||||
eoNonUniform.h eoNormal.h eoObject.h eoOp.h eoOpSelector.h\
|
||||
eoParser.h eoPersistent.h eoPop.h eoPopOps.h eoPrintable.h\
|
||||
eoProblem.h eoProportionalGOpSel.h eoProportionalOpSel.h eoRNG.h\
|
||||
eoRnd.h eoString.h\
|
||||
eoStochTournament.h eoTerm.h eoTranspose.h eoUniform.h \
|
||||
eoUniformSelect.h eoUniformXOver.h eoVector.h eoXOver2.h
|
||||
|
||||
|
||||
libeoinc_HEADERS = EO.h eoDup.h eoKill.h eoProportionalGOpSelector.h eoTournament.h eo1d.h eoEasyEA.h eoLottery.h eoProportionalOpSel.h eoTranspose.h eo1dWDistance.h eoEvalFunc.h eoMerge.h eoRandomBreed.h eoUniform.h eo2d.h eoEvalFuncPtr.h eoMutation.h eoRandomIndiSelector.h eoUniformSelect.h eo2dVector.h eoEvalFuncPtrCnt.h eoNegExp.h eoRandomSelect.h eoUniformXOver.h eoAlgo.h eoFactory.h eoNonUniform.h eoRank.h eoVector.h eoAtomBitFlip.h eoFitTerm.h eoNormal.h eoRnd.h eoWrappedOps.h eoAtomCreep.h eoFitness.h eoObject.h eoScalarFitness.h eoXOver2.h eoAtomMutation.h eoGOpBreeder.h eoOp.h eoScheme.h eoAtomMutator.h eoGOpSelector.h eoOpFactory.h eoSelectFactory.h eoBreeder.h eoID.h eoPersistent.h eoSteadyStateGeneration.h eoAtomRandom.h eoGenTerm.h eoOpSelMason.h eoSequentialGOpSelector.h eoBackInserter.h eoGeneration.h eoOpSelector.h eoSteadyStateEA.h eoDetTournament.h eoInclusion.h eoPop.h eoSteadyStateInserter.h eoDetTournamentIndiSelector.h eoIndiSelector.h eoPopOps.h eoStochTournament.h eoDetTournamentInserter.h eoInserter.h eoPrintable.h eoStochTournamentInserter.h eoDistance.h eoInsertion.h eoProportionalGOpSel.h eoTerm.h \
|
||||
es/eoESFullChrom.h es/eoESChrom.h es/eoESFullMut.h \
|
||||
ga/eoBin.h ga/eoBitOp.h ga/eoBitOpFactory.h \
|
||||
gp/eoParseTree.h gp/node_pool.h gp/parse_tree.h \
|
||||
obsolete/eoParser.h obsolete/eoParserUtils.h obsolete/eoProblem.h \
|
||||
other/eoStringMutation.h other/eoExternalEO.h other/eoString.h \
|
||||
utils/compatibility.h utils/eoData.h utils/eoParser.h utils/eoState.h utils/eoRNG.h utils/rnd_generators.h utils/selectors.h utils/eoParam.h
|
||||
|
|
@ -28,10 +28,13 @@
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include <functional> //
|
||||
#include <numeric> // accumulate
|
||||
#include "utils/selectors.h"
|
||||
#include <eo> // eoPop eoSelect MINFLOAT
|
||||
#include <stdexcept> // logic_error
|
||||
#include <utils/selectors.h> // sum_fitness
|
||||
|
||||
// #include <functional> //
|
||||
// #include <numeric> // accumulate
|
||||
// #include <eo> // eoPop eoSelect MINFLOAT
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** eoLottery: a selection method. Puts into the output a group of individuals
|
||||
|
|
@ -45,12 +48,11 @@ template<class EOT> class eoLottery: public eoBinPopOp<EOT>
|
|||
{
|
||||
public:
|
||||
/// (Default) Constructor.
|
||||
eoLottery(const float& _rate = 1.0): eoBinPopOp<EOT>(), rate(_rate)
|
||||
eoLottery(const float& _rate = 1.0): eoBinPopOp<EOT>(), rate_(_rate)
|
||||
{
|
||||
if (minimizing_fitness<EOT>())
|
||||
{
|
||||
eoMinimizingFitnessException up(*this);
|
||||
throw up; // :-)
|
||||
throw logic_error("eoLottery: minimizing fitness");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -61,23 +63,27 @@ template<class EOT> class eoLottery: public eoBinPopOp<EOT>
|
|||
*/
|
||||
void operator()( eoPop<EOT>& pop, eoPop<EOT>& breeders)
|
||||
{
|
||||
int target = (int)(rate * pop.size());
|
||||
int target = static_cast<int>(rate_ * pop.size());
|
||||
|
||||
/* Gustavo: uncomment this if it must be here
|
||||
// test of consistency
|
||||
if (breeders.size() >= target) {
|
||||
throw("Problem in eoLottery: already too many offspring");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
double total;
|
||||
|
||||
try
|
||||
{
|
||||
total = sum_fitness(pop);
|
||||
total = sum_fitness (pop);
|
||||
}
|
||||
catch (eoNegativeFitnessException&)
|
||||
{ // say where it occured...
|
||||
throw eoNegativeFitnessException(*this);
|
||||
}
|
||||
*/
|
||||
|
||||
double total = sum_fitness (pop);
|
||||
|
||||
// selection of chromosomes
|
||||
while (breeders.size() < target)
|
||||
|
|
@ -86,10 +92,10 @@ template<class EOT> class eoLottery: public eoBinPopOp<EOT>
|
|||
}
|
||||
}
|
||||
|
||||
double Rate(void) const { return rate; }
|
||||
double rate(void) const { return rate_; }
|
||||
|
||||
private:
|
||||
double rate; // selection rate
|
||||
double rate_; // selection rate
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ template<class Chrom> class eoBinPrev: public eoMonOp<Chrom>
|
|||
};
|
||||
|
||||
|
||||
/** eoBinCrossover --> classic crossover */
|
||||
/** eoBinCrossover --> classic 2-point crossover */
|
||||
|
||||
template<class Chrom> class eoBinCrossover: public eoQuadraticOp<Chrom>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ void InitRandom( Parser & parser) {
|
|||
s << _seed;
|
||||
parser.setParamValue("--seed", s.str()); // so it will be printed out in the status file, and canbe later re-used to re-run EXACTLY the same run
|
||||
}
|
||||
#error This does not work: load and save the entire state of the rng object.
|
||||
//#error This does not work: load and save the entire state of the rng object.
|
||||
rng.reseed(_seed);
|
||||
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ Modifications.:
|
|||
#ifndef EO_PARSER_UTILS
|
||||
#define EO_PARSER_UTILS
|
||||
|
||||
#include <eoRNG.h>
|
||||
#include <utils/eoRNG.h>
|
||||
#include <eoParser.h>
|
||||
/// Reproducible random seed
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
#ifndef eoExternalEO_h
|
||||
#define eoExternalEO_h
|
||||
|
||||
#include "EO.h"
|
||||
#include <EO.h>
|
||||
|
||||
/**
|
||||
* Definition of an object that allows an external struct
|
||||
|
|
@ -65,3 +65,4 @@ class eoExternalEO : public EO, virtual public External
|
|||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ double sum_fitness(It begin, It end)
|
|||
{
|
||||
double v = static_cast<double>(begin->fitness());
|
||||
if (v < 0.0)
|
||||
throw std::logical_error("Negative Fitness Encountered");
|
||||
throw std::logic_error("sum_fitness: negative fitness value encountered");
|
||||
sum += v;
|
||||
}
|
||||
|
||||
|
|
|
|||
Reference in a new issue