From 7ca5b6c0d0b298e16b82f62899a36983eb2c8501 Mon Sep 17 00:00:00 2001 From: Johann Dreo Date: Thu, 8 Oct 2020 15:26:07 +0200 Subject: [PATCH] remove FastGA foundry last evals, more logs, fix some typos --- eo/src/eoAlgoFoundryFastGA.h | 9 ++++++--- eo/src/eoAlgoRestart.h | 2 ++ eo/src/eoEvalFoundryFastGA.h | 2 +- eo/src/eoFastGA.h | 4 ++-- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/eo/src/eoAlgoFoundryFastGA.h b/eo/src/eoAlgoFoundryFastGA.h index 3766b8a44..5125d4c95 100644 --- a/eo/src/eoAlgoFoundryFastGA.h +++ b/eo/src/eoAlgoFoundryFastGA.h @@ -138,7 +138,7 @@ class eoAlgoFoundryFastGA : public eoAlgoFoundry assert( mutations.size() > 0); assert(this->at( mutations.index()) < mutations.size()); assert( replacements.size() > 0); assert(this->at( replacements.index()) < replacements.size()); assert( continuators.size() > 0); assert(this->at( continuators.index()) < continuators.size()); - assert( offspring_sizes.size() > 0); assert(this->at( offspring_sizes.index()) < offspring_sizes.size()); + assert( offspring_sizes.size() > 0); assert(this->at( offspring_sizes.index()) < offspring_sizes.size()); // Objective function calls counter eoEvalCounterThrowException eval(_eval, _max_evals); @@ -167,10 +167,13 @@ class eoAlgoFoundryFastGA : public eoAlgoFoundry try { restart(pop); } catch(eoMaxEvalException e) { +#ifndef NDEBUG + eo::log << eo::debug << "Reached maximum evaluations: " << eval.getValue() << " / " << _max_evals << std::endl; +#endif // In case some solutions were not evaluated when max eval occured. // FIXME can this even be considered legal? - eoPopLoopEval pop_last_eval(_eval); - pop_last_eval(pop,pop); + // eoPopLoopEval pop_last_eval(_eval); + // pop_last_eval(pop,pop); } } diff --git a/eo/src/eoAlgoRestart.h b/eo/src/eoAlgoRestart.h index 690a27ccb..ebea3aec5 100644 --- a/eo/src/eoAlgoRestart.h +++ b/eo/src/eoAlgoRestart.h @@ -147,7 +147,9 @@ public: virtual void operator()(eoPop & pop) { do { +#ifndef NDEBUG eo::log << eo::debug << "Restart" << std::endl; +#endif _reseter(pop); _algo(pop); } while( _continue(pop) ); diff --git a/eo/src/eoEvalFoundryFastGA.h b/eo/src/eoEvalFoundryFastGA.h index b85561d1a..349fa6aad 100644 --- a/eo/src/eoEvalFoundryFastGA.h +++ b/eo/src/eoEvalFoundryFastGA.h @@ -189,7 +189,7 @@ public: sol.fitness( pop.best_element().fitness() ); } else { - eo::log << eo::warnings << "WARNING: encoded algo is out of bounds" << std::endl; + eo::log << eo::warnings << "WARNING: encoded algo is out of bounds, penalize to: " << _penalization << std::endl; sol.fitness( _penalization ); // penalization } } diff --git a/eo/src/eoFastGA.h b/eo/src/eoFastGA.h index ac38f2532..bf4374d87 100644 --- a/eo/src/eoFastGA.h +++ b/eo/src/eoFastGA.h @@ -101,8 +101,8 @@ public: EOT sol1 = _select_cross(pop); EOT sol2 = _select_cross(pop); - // If the operator returns true, - // olutions have been altered. + // If the operator returns true, + // solutions have been altered. if(_crossover(sol1, sol2)) { sol1.invalidate(); sol2.invalidate();