From 64e14e09dfb11a2c3e6ce8fd36fd6fd62fe505ad Mon Sep 17 00:00:00 2001 From: nojhan Date: Tue, 17 Mar 2020 12:04:02 +0100 Subject: [PATCH] move the distrib continue in EDO adaptive algos - Call the continuator right after the distribution update, because we may have generated an ill-conditioned distribution, which would lead to bad solution sampling. - Reserve mem of sampled vector. --- edo/src/edoAlgoAdaptive.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/edo/src/edoAlgoAdaptive.h b/edo/src/edoAlgoAdaptive.h index 5ee0f359a..7de567eee 100644 --- a/edo/src/edoAlgoAdaptive.h +++ b/edo/src/edoAlgoAdaptive.h @@ -160,13 +160,26 @@ public: // (2) Estimation of the distribution parameters _distrib = _estimator(selected_pop); + // TODO modularization: the estimator and the continuator perform + // the same decomposition twice, see how to decompose those operators + + // Call the continuator right after the distribution update, + // because we may have generated an ill-conditioned distribution, + // which would lead to bad solution sampling. + if(not _distribution_continuator(_distrib)) { + break; + } + // (3) sampling // The sampler produces feasible solutions (@see edoSampler that // encapsulate an edoBounder) - current_pop.clear(); + current_pop.clear(); current_pop.reserve(pop.size()); for( unsigned int i = 0; i < pop.size(); ++i ) { current_pop.push_back( _sampler(_distrib) ); } + // TODO modluraziation: the sampler may generate solution that are + // not finite. See how to stop right from there instead of + // performing useless evaluations. // (4) Evaluate new solutions _evaluator( pop, current_pop ); @@ -174,7 +187,7 @@ public: // (5) Replace old solutions by new ones _replacor(pop, current_pop); // e.g. copy current_pop in pop - } while( _distribution_continuator( _distrib ) && _pop_continuator( pop ) ); + } while( _pop_continuator( pop ) ); } // operator()