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