modification and correction of moShiftNeighbor

Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/paradiseo/paradiseo
This commit is contained in:
verel 2013-02-07 12:08:18 +01:00
commit dea818c2b5
3 changed files with 34 additions and 62 deletions

View file

@ -38,7 +38,7 @@ endif()
# enabled components # enabled components
if ("${Paradiseo_FIND_COMPONENTS}" STREQUAL "") if ("${Paradiseo_FIND_COMPONENTS}" STREQUAL "")
set(PARADISEO_LIBRARIES_TO_FIND eo eoutils edoutils cma es flowshop ga moeo) set(PARADISEO_LIBRARIES_TO_FIND eo eoutils cma es flowshop ga moeo)
else() else()
set(PARADISEO_LIBRARIES_TO_FIND ${Paradiseo_FIND_COMPONENTS}) set(PARADISEO_LIBRARIES_TO_FIND ${Paradiseo_FIND_COMPONENTS})
endif() endif()
@ -64,10 +64,6 @@ find_path(EO_INCLUDE_DIR eo
PATH_SUFFIXES include${INSTALL_SUB_DIR}/eo eo/src PATH_SUFFIXES include${INSTALL_SUB_DIR}/eo eo/src
PATHS ${PARADISEO_SRC_PATHS}) PATHS ${PARADISEO_SRC_PATHS})
find_path(EDO_INCLUDE_DIR edo
PATH_SUFFIXES include${INSTALL_SUB_DIR}/edo edo/src
PATHS ${PARADISEO_SRC_PATHS})
find_path(MO_INCLUDE_DIR mo find_path(MO_INCLUDE_DIR mo
PATH_SUFFIXES include${INSTALL_SUB_DIR}/mo mo/src PATH_SUFFIXES include${INSTALL_SUB_DIR}/mo mo/src
PATHS ${PARADISEO_SRC_PATHS}) PATHS ${PARADISEO_SRC_PATHS})
@ -85,7 +81,12 @@ foreach(COMP ${PARADISEO_LIBRARIES_TO_FIND})
PATHS ${PARADISEO_SRC_PATHS}) PATHS ${PARADISEO_SRC_PATHS})
elseif(${COMP} STREQUAL "peo") elseif(${COMP} STREQUAL "peo")
set(PEO_FOUND true) set(PEO_FOUND true)
find_path(PEO_INCLUDE_DIR peo find_path(EDO_INCLUDE_DIR edo
PATH_SUFFIXES include${INSTALL_SUB_DIR}/edo edo/src
PATHS ${PARADISEO_SRC_PATHS})
elseif(${COMP} STREQUAL "edo")
set(EDO_FOUND true)
find_path(EDO_INCLUDE_DIR peo
PATH_SUFFIXES include${INSTALL_SUB_DIR}/peo peo/src PATH_SUFFIXES include${INSTALL_SUB_DIR}/peo peo/src
PATHS ${PARADISEO_SRC_PATHS}) PATHS ${PARADISEO_SRC_PATHS})
endif() endif()

View file

@ -78,7 +78,6 @@
#include <eoEvalCounterThrowException.h> #include <eoEvalCounterThrowException.h>
#include <eoEvalTimeThrowException.h> #include <eoEvalTimeThrowException.h>
#include <eoEvalUserTimeThrowException.h> #include <eoEvalUserTimeThrowException.h>
#include <eoEvalKeepBest.h>
// Continuators - all include eoContinue.h // Continuators - all include eoContinue.h
#include <eoCombinedContinue.h> #include <eoCombinedContinue.h>
@ -103,7 +102,6 @@
#include <eoSharingSelect.h> #include <eoSharingSelect.h>
// Embedding truncation selection // Embedding truncation selection
#include <eoTruncatedSelectOne.h> #include <eoTruncatedSelectOne.h>
#include <eoRankMuSelect.h>
// the batch selection - from an eoSelectOne // the batch selection - from an eoSelectOne
#include <eoSelectPerc.h> #include <eoSelectPerc.h>
@ -143,9 +141,6 @@
#include <utils/eoRealVectorBounds.h> // includes eoRealBounds.h #include <utils/eoRealVectorBounds.h> // includes eoRealBounds.h
#include <utils/eoIntBounds.h> // no eoIntVectorBounds #include <utils/eoIntBounds.h> // no eoIntVectorBounds
// Serialization stuff
#include <serial/eoSerial.h>
// aliens // aliens
#include <other/external_eo> #include <other/external_eo>
#include <eoCounter.h> #include <eoCounter.h>

View file

@ -37,6 +37,8 @@
#include <eoMergeReduce.h> #include <eoMergeReduce.h>
#include <eoReplacement.h> #include <eoReplacement.h>
template <class EOT> class eoIslandsEasyEA ; template <class EOT> class eoIslandsEasyEA ;
template <class EOT> class eoDistEvalEasyEA ; template <class EOT> class eoDistEvalEasyEA ;
@ -100,33 +102,6 @@ template<class EOT> class eoEasyEA: public eoAlgo<EOT>
offspring.reserve(_offspringSize); // This line avoids an incremental resize of offsprings. offspring.reserve(_offspringSize); // This line avoids an incremental resize of offsprings.
} }
/**
* @brief Ctor allowing to specify which pop eval function we're going to use.
*
* Ctor taking a breed and merge, an overload of ctor to define an offspring size, and
* the pop eval function used. This allows to precise if we would like to use the
* parallel evaluation, for instance.
*/
eoEasyEA(
eoContinue<EOT>& _continuator,
eoEvalFunc<EOT>& _eval,
eoPopEvalFunc<EOT>& _pop_eval,
eoBreed<EOT>& _breed,
eoReplacement<EOT>& _replace,
unsigned _offspringSize
) : continuator(_continuator),
eval (_eval),
loopEval(_eval),
popEval(_pop_eval),
selectTransform(dummySelect, dummyTransform),
breed(_breed),
mergeReduce(dummyMerge, dummyReduce),
replace(_replace),
isFirstCall(true)
{
offspring.reserve(_offspringSize); // This line avoids an incremental resize of offsprings.
}
/* /*
eoEasyEA(eoContinue <EOT> & _continuator, eoEasyEA(eoContinue <EOT> & _continuator,
eoPopEvalFunc <EOT> & _pop_eval, eoPopEvalFunc <EOT> & _pop_eval,
@ -244,7 +219,6 @@ template<class EOT> class eoEasyEA: public eoAlgo<EOT>
/// Apply a few generation of evolution to the population. /// Apply a few generation of evolution to the population.
virtual void operator()(eoPop<EOT>& _pop) virtual void operator()(eoPop<EOT>& _pop)
{ {
if (isFirstCall) if (isFirstCall)
{ {
size_t total_capacity = _pop.capacity() + offspring.capacity(); size_t total_capacity = _pop.capacity() + offspring.capacity();
@ -255,12 +229,13 @@ template<class EOT> class eoEasyEA: public eoAlgo<EOT>
eoPop<EOT> empty_pop; eoPop<EOT> empty_pop;
popEval(empty_pop, _pop); // A first eval of pop.
do do
{ {
try try
{ {
unsigned pSize = _pop.size(); unsigned pSize = _pop.size();
offspring.clear(); // new offspring offspring.clear(); // new offspring
breed(_pop, offspring); breed(_pop, offspring);
@ -273,6 +248,7 @@ template<class EOT> class eoEasyEA: public eoAlgo<EOT>
throw std::runtime_error("Population shrinking!"); throw std::runtime_error("Population shrinking!");
else if (pSize < _pop.size()) else if (pSize < _pop.size())
throw std::runtime_error("Population growing!"); throw std::runtime_error("Population growing!");
} }
catch (std::exception& e) catch (std::exception& e)
{ {