declutch restart in FastGA foundry
This commit is contained in:
parent
ffafaa5b40
commit
5cb7bfd317
2 changed files with 15 additions and 13 deletions
|
|
@ -24,7 +24,7 @@ eoAlgoFoundryFastGA<Bits>& make_foundry(
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// FIXME using max_restarts>1 does not allow to honor max evals.
|
// FIXME using max_restarts>1 does not allow to honor max evals.
|
||||||
auto& foundry = store.pack< eoAlgoFoundryFastGA<Bits> >(init, eval_onemax, generations, max_evals, /*max_restarts=*/1);
|
auto& foundry = store.pack< eoAlgoFoundryFastGA<Bits> >(init, eval_onemax, max_evals, /*max_restarts=*/1);
|
||||||
|
|
||||||
/***** Continuators ****/
|
/***** Continuators ****/
|
||||||
foundry.continuators.add< eoGenContinue<Bits> >(generations);
|
foundry.continuators.add< eoGenContinue<Bits> >(generations);
|
||||||
|
|
|
||||||
|
|
@ -142,6 +142,7 @@ class eoAlgoFoundryFastGA : public eoAlgoFoundry<EOT>
|
||||||
|
|
||||||
// Objective function calls counter
|
// Objective function calls counter
|
||||||
eoEvalCounterThrowException<EOT> eval(_eval, _max_evals);
|
eoEvalCounterThrowException<EOT> eval(_eval, _max_evals);
|
||||||
|
eo::log << eo::xdebug << "Evaluations: " << eval.value() << " / " << _max_evals << std::endl;
|
||||||
eoPopLoopEval<EOT> pop_eval(eval);
|
eoPopLoopEval<EOT> pop_eval(eval);
|
||||||
|
|
||||||
// Algorithm itself
|
// Algorithm itself
|
||||||
|
|
@ -160,12 +161,13 @@ class eoAlgoFoundryFastGA : public eoAlgoFoundry<EOT>
|
||||||
);
|
);
|
||||||
|
|
||||||
// Restart wrapper
|
// Restart wrapper
|
||||||
eoAlgoPopReset<EOT> reset_pop(_init, pop_eval);
|
// eoAlgoPopReset<EOT> reset_pop(_init, pop_eval);
|
||||||
eoGenContinue<EOT> restart_cont(_max_restarts);
|
// eoGenContinue<EOT> restart_cont(_max_restarts);
|
||||||
eoAlgoRestart<EOT> restart(eval, algo, restart_cont, reset_pop);
|
// eoAlgoRestart<EOT> restart(eval, algo, restart_cont, reset_pop);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
restart(pop);
|
// restart(pop);
|
||||||
|
algo(pop);
|
||||||
} catch(eoMaxEvalException e) {
|
} catch(eoMaxEvalException e) {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
eo::log << eo::debug << "Reached maximum evaluations: " << eval.getValue() << " / " << _max_evals << std::endl;
|
eo::log << eo::debug << "Reached maximum evaluations: " << eval.getValue() << " / " << _max_evals << std::endl;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue