remove FastGA foundry last evals, more logs, fix some typos
This commit is contained in:
parent
e975f0f388
commit
7ca5b6c0d0
4 changed files with 11 additions and 6 deletions
|
|
@ -138,7 +138,7 @@ class eoAlgoFoundryFastGA : public eoAlgoFoundry<EOT>
|
||||||
assert( mutations.size() > 0); assert(this->at( mutations.index()) < mutations.size());
|
assert( mutations.size() > 0); assert(this->at( mutations.index()) < mutations.size());
|
||||||
assert( replacements.size() > 0); assert(this->at( replacements.index()) < replacements.size());
|
assert( replacements.size() > 0); assert(this->at( replacements.index()) < replacements.size());
|
||||||
assert( continuators.size() > 0); assert(this->at( continuators.index()) < continuators.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
|
// Objective function calls counter
|
||||||
eoEvalCounterThrowException<EOT> eval(_eval, _max_evals);
|
eoEvalCounterThrowException<EOT> eval(_eval, _max_evals);
|
||||||
|
|
@ -167,10 +167,13 @@ class eoAlgoFoundryFastGA : public eoAlgoFoundry<EOT>
|
||||||
try {
|
try {
|
||||||
restart(pop);
|
restart(pop);
|
||||||
} catch(eoMaxEvalException e) {
|
} 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.
|
// In case some solutions were not evaluated when max eval occured.
|
||||||
// FIXME can this even be considered legal?
|
// FIXME can this even be considered legal?
|
||||||
eoPopLoopEval<EOT> pop_last_eval(_eval);
|
// eoPopLoopEval<EOT> pop_last_eval(_eval);
|
||||||
pop_last_eval(pop,pop);
|
// pop_last_eval(pop,pop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,9 @@ public:
|
||||||
virtual void operator()(eoPop<EOT> & pop)
|
virtual void operator()(eoPop<EOT> & pop)
|
||||||
{
|
{
|
||||||
do {
|
do {
|
||||||
|
#ifndef NDEBUG
|
||||||
eo::log << eo::debug << "Restart" << std::endl;
|
eo::log << eo::debug << "Restart" << std::endl;
|
||||||
|
#endif
|
||||||
_reseter(pop);
|
_reseter(pop);
|
||||||
_algo(pop);
|
_algo(pop);
|
||||||
} while( _continue(pop) );
|
} while( _continue(pop) );
|
||||||
|
|
|
||||||
|
|
@ -189,7 +189,7 @@ public:
|
||||||
sol.fitness( pop.best_element().fitness() );
|
sol.fitness( pop.best_element().fitness() );
|
||||||
|
|
||||||
} else {
|
} 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
|
sol.fitness( _penalization ); // penalization
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -101,8 +101,8 @@ public:
|
||||||
EOT sol1 = _select_cross(pop);
|
EOT sol1 = _select_cross(pop);
|
||||||
EOT sol2 = _select_cross(pop);
|
EOT sol2 = _select_cross(pop);
|
||||||
|
|
||||||
// If the operator returns true,
|
// If the operator returns true,
|
||||||
// olutions have been altered.
|
// solutions have been altered.
|
||||||
if(_crossover(sol1, sol2)) {
|
if(_crossover(sol1, sol2)) {
|
||||||
sol1.invalidate();
|
sol1.invalidate();
|
||||||
sol2.invalidate();
|
sol2.invalidate();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue