diff --git a/eo/contrib/irace/fastga.cpp b/eo/contrib/irace/fastga.cpp index 410b1aaa4..52b8b3cbf 100644 --- a/eo/contrib/irace/fastga.cpp +++ b/eo/contrib/irace/fastga.cpp @@ -24,7 +24,8 @@ eoAlgoFoundryFastGA& make_foundry( ) { // FIXME using max_restarts>1 does not allow to honor max evals. - auto& foundry = store.pack< eoAlgoFoundryFastGA >(init, eval_onemax, max_evals, /*max_restarts=*/1); + // auto& foundry = store.pack< eoAlgoFoundryFastGA >(init, eval_onemax, max_evals, /*max_restarts=*/1); + auto& foundry = store.pack< eoAlgoFoundryFastGA >(init, eval_onemax, max_evals); /***** Continuators ****/ foundry.continuators.add< eoGenContinue >(generations); @@ -272,9 +273,9 @@ int main(int argc, char* argv[]) exit(NO_ERROR); } - const size_t generations = static_cast(std::floor( - static_cast(max_evals) / static_cast(pop_size))); - + // const size_t generations = static_cast(std::floor( + // static_cast(max_evals) / static_cast(pop_size))); + const size_t generations = std::numeric_limits::max(); // Problem configuration code. @@ -354,13 +355,18 @@ int main(int argc, char* argv[]) logger.track_problem(w_model_om); eoEvalIOHproblem onemax_pb(w_model_om, logger); - eoPopLoopEval onemax_eval(onemax_pb); + + eoEvalFuncCounter eval_count(onemax_pb); + + // eoPopLoopEval onemax_eval(onemax_pb); + eoPopLoopEval onemax_eval(eval_count); /***** Instanciate and run the algo *****/ eoUniformGenerator ugen(0, 1); eoInitFixedLength onemax_init(/*bitstring size=*/dimension, ugen); - auto& foundry = make_foundry(store, onemax_init, onemax_pb, max_evals, generations); + // auto& foundry = make_foundry(store, onemax_init, onemax_pb, max_evals, generations); + auto& foundry = make_foundry(store, onemax_init, eval_count, max_evals, generations); Ints encoded_algo(foundry.size()); @@ -379,15 +385,20 @@ int main(int argc, char* argv[]) foundry.select(encoded_algo); std::clog << foundry.name() << std::endl; - // Evaluation of a forged encoded_algo on the sub-problem - eoEvalFoundryFastGA eval_foundry( - foundry, pop_size, - onemax_init, onemax_eval, - /*penalization=*/ dimension, // Worst case penalization. - /*normalized=*/ false); // Use direct integer encoding. + // // Evaluation of a forged encoded_algo on the sub-problem + // eoEvalFoundryFastGA eval_foundry( + // foundry, pop_size, + // onemax_init, onemax_eval, + // /*penalization=*/ dimension, // Worst case penalization. + // /*normalized=*/ false); // Use direct integer encoding. + // + // // Actually instanciate and run the algorithm. + // eval_foundry(encoded_algo); - // Actually instanciate and run the algorithm. - eval_foundry(encoded_algo); + eoPop pop; + pop.append(pop_size, onemax_init); + onemax_eval(pop,pop); + foundry(pop); // Actually run the selected algorithm. /***** IOH perf stats *****/ IOHprofiler_ecdf_sum ecdf_sum; @@ -400,6 +411,8 @@ int main(int argc, char* argv[]) << ", check the bounds or the algorithm." << std::endl; } + std::clog << "After " << eval_count.getValue() << " / " << max_evals << " evaluations" << std::endl; + // Output std::cout << -1 * perf << std::endl;