fixed a bug with using of replacor, it didnt reduce the fitness

This commit is contained in:
Caner Candan 2010-08-30 16:20:55 +02:00
commit 08754eeaee

View file

@ -54,7 +54,7 @@ public:
eoSelectOne< EOT > & selectone, eoSelectOne< EOT > & selectone,
doModifierMass< D > & modifier, doModifierMass< D > & modifier,
doSampler< D > & sampler, doSampler< D > & sampler,
eoContinue< EOT > & monitoring_continue, // eoContinue< EOT > & monitoring_continue,
eoContinue< EOT > & pop_continue, eoContinue< EOT > & pop_continue,
doContinue< D > & distribution_continue, doContinue< D > & distribution_continue,
eoEvalFunc < EOT > & evaluation, eoEvalFunc < EOT > & evaluation,
@ -68,7 +68,7 @@ public:
_selectone(selectone), _selectone(selectone),
_modifier(modifier), _modifier(modifier),
_sampler(sampler), _sampler(sampler),
_monitoring_continue(monitoring_continue), // _monitoring_continue(monitoring_continue),
_pop_continue(pop_continue), _pop_continue(pop_continue),
_distribution_continue(distribution_continue), _distribution_continue(distribution_continue),
_evaluation(evaluation), _evaluation(evaluation),
@ -91,7 +91,7 @@ public:
double temperature = _initial_temperature; double temperature = _initial_temperature;
eoPop< EOT > current_pop = pop; eoPop< EOT > current_pop;
eoPop< EOT > selected_pop; eoPop< EOT > selected_pop;
@ -111,19 +111,12 @@ public:
do do
{ {
if (pop != current_pop)
{
_replacor(pop, current_pop);
}
current_pop.clear();
selected_pop.clear();
//------------------------------------------------------------- //-------------------------------------------------------------
// (3) Selection of the best points in the population // (3) Selection of the best points in the population
//------------------------------------------------------------- //-------------------------------------------------------------
selected_pop.clear();
_selector(pop, selected_pop); _selector(pop, selected_pop);
assert( selected_pop.size() > 0 ); assert( selected_pop.size() > 0 );
@ -172,6 +165,8 @@ public:
// Building of the sampler in current_pop // Building of the sampler in current_pop
//------------------------------------------------------------- //-------------------------------------------------------------
current_pop.clear();
do do
{ {
EOT candidate_solution = _sampler(distrib); EOT candidate_solution = _sampler(distrib);
@ -191,12 +186,18 @@ public:
} }
while ( _sa_continue( current_solution) ); while ( _sa_continue( current_solution) );
//selected_pop.sort();
_replacor(pop, current_pop);
if ( ! _cooling_schedule( temperature ) ){ eo::log << eo::debug << "_cooling_schedule" << std::endl; break; }
if ( ! _distribution_continue( distrib ) ){ eo::log << eo::debug << "_distribution_continue" << std::endl; break; }
if ( ! _pop_continue( pop ) ){ eo::log << eo::debug << "_pop_continue" << std::endl; break; }
} }
while ( _cooling_schedule( temperature ) && while ( 1 );
_distribution_continue( distrib ) &&
_pop_continue( current_pop ) &&
_monitoring_continue( selected_pop )
);
} }
private: private:
@ -217,7 +218,7 @@ private:
doSampler< D > & _sampler; doSampler< D > & _sampler;
//! A EOT monitoring continuator //! A EOT monitoring continuator
eoContinue < EOT > & _monitoring_continue; // eoContinue < EOT > & _monitoring_continue;
//! A EOT population continuator //! A EOT population continuator
eoContinue < EOT > & _pop_continue; eoContinue < EOT > & _pop_continue;