fix some errors in tests

- use eoEvalCounterThrowException
- use make_help
This commit is contained in:
Johann Dreo 2020-03-26 22:47:26 +01:00
commit 75ac37b02a
16 changed files with 25 additions and 19 deletions

View file

@ -28,7 +28,7 @@ Authors:
#include <eo> #include <eo>
//#include <mo> //#include <mo>
#include <eoEvalFuncCounterBounder.h> #include <eoEvalCounterThrowException.h>
#include <do/make_pop.h> #include <do/make_pop.h>
#include <do/make_run.h> #include <do/make_run.h>
@ -67,7 +67,7 @@ int main(int ac, char** av)
eoEvalFunc< RealVec >* plainEval = new Rosenbrock< RealVec >(); eoEvalFunc< RealVec >* plainEval = new Rosenbrock< RealVec >();
state.storeFunctor(plainEval); state.storeFunctor(plainEval);
eoEvalFuncCounterBounder< RealVec > eval(*plainEval, max_eval); eoEvalCounterThrowException< RealVec > eval(*plainEval, max_eval);
eoRndGenerator< double >* gen = new eoUniformGenerator< double >(-5, 5); eoRndGenerator< double >* gen = new eoUniformGenerator< double >(-5, 5);
state.storeFunctor(gen); state.storeFunctor(gen);
@ -145,7 +145,7 @@ int main(int ac, char** av)
eo::log << eo::progress << "Best solution after random init: " << pop.best_element().fitness() << std::endl; eo::log << eo::progress << "Best solution after random init: " << pop.best_element().fitness() << std::endl;
do_run(*algo, pop); do_run(*algo, pop);
} catch (eoEvalFuncCounterBounderException& e) { } catch (eoMaxEvalException& e) {
eo::log << eo::warnings << "warning: " << e.what() << std::endl; eo::log << eo::warnings << "warning: " << e.what() << std::endl;
} }

View file

@ -28,7 +28,7 @@ Authors:
#include <eo> #include <eo>
// #include <mo> // #include <mo>
#include <eoEvalFuncCounterBounder.h> #include <eoEvalCounterThrowException.h>
#include <do/make_pop.h> #include <do/make_pop.h>
#include <do/make_run.h> #include <do/make_run.h>
@ -69,7 +69,7 @@ int main(int ac, char** av)
state.storeFunctor(plainEval); state.storeFunctor(plainEval);
unsigned long max_eval = parser.getORcreateParam((unsigned long)0, "maxEval", "Maximum number of evaluations (0 = none)", 'E', "Stopping criterion").value(); // E unsigned long max_eval = parser.getORcreateParam((unsigned long)0, "maxEval", "Maximum number of evaluations (0 = none)", 'E', "Stopping criterion").value(); // E
eoEvalFuncCounterBounder< EOT > eval(*plainEval, max_eval); eoEvalCounterThrowException< EOT > eval(*plainEval, max_eval);
eoRndGenerator< double >* gen = new eoUniformGenerator< double >(-5, 5); eoRndGenerator< double >* gen = new eoUniformGenerator< double >(-5, 5);
state.storeFunctor(gen); state.storeFunctor(gen);
@ -169,7 +169,7 @@ int main(int ac, char** av)
try { try {
do_run(*algo, pop); do_run(*algo, pop);
} catch (eoEvalFuncCounterBounderException& e) { } catch (eoMaxEvalException& e) {
eo::log << eo::warnings << "warning: " << e.what() << std::endl; eo::log << eo::warnings << "warning: " << e.what() << std::endl;
} catch (std::exception& e) { } catch (std::exception& e) {

View file

@ -36,3 +36,9 @@
// --- Global variables - but don't know what else to do - MS --- // --- Global variables - but don't know what else to do - MS ---
bool existSIGContinue = false; bool existSIGContinue = false;
bool call_func = false; bool call_func = false;
void set_bool(int)
{
call_func = true;
}

View file

@ -42,10 +42,7 @@
extern bool existSIGContinue; extern bool existSIGContinue;
extern bool call_func; extern bool call_func;
void set_bool(int) void set_bool(int);
{
call_func = true;
}
/** /**
A continuator that stops if a given signal is received during the execution A continuator that stops if a given signal is received during the execution

View file

@ -145,7 +145,7 @@ void run_ea(eoAlgo<eoEsFull<eoMinimizingFitness> >& _ga, eoPop<eoEsFull<eoMinimi
// end of parameter input (+ .status + help) // end of parameter input (+ .status + help)
// that one is not templatized, but is here for completeness // that one is not templatized, but is here for completeness
void make_help(eoParser & _parser, bool exit_after = true); void make_help(eoParser & _parser, bool exit_after);
/** @} */ /** @} */
/** @} */ /** @} */

View file

@ -101,7 +101,7 @@ void run_ea(eoAlgo<eoReal<eoMinimizingFitness> >& _ga, eoPop<eoReal<eoMinimizing
// end of parameter input (+ .status + help) // end of parameter input (+ .status + help)
// that one is not templatized // that one is not templatized
// Because of that, the source is in src/utils dir // Because of that, the source is in src/utils dir
void make_help(eoParser & _parser, bool exit_after = true); void make_help(eoParser & _parser, bool exit_after);
/** @} */ /** @} */
#endif #endif

View file

@ -5,7 +5,7 @@
using namespace std; using namespace std;
int main(int /*argc*/, char* /*argv[]*/) int main(int /*argc*/, char** /*argv[]*/)
{ {
typedef eoReal<eoMinimizingFitness> EOT; typedef eoReal<eoMinimizingFitness> EOT;

View file

@ -95,7 +95,7 @@ public:
}; };
// checks for help demand, and writes the status file and make_help; in libutils // checks for help demand, and writes the status file and make_help; in libutils
void make_help(eoParser & _parser); // void make_help(eoParser & _parser);
// now use all of the above, + representation dependent things // now use all of the above, + representation dependent things
int main(int argc, char* argv[]){ int main(int argc, char* argv[]){

View file

@ -1,5 +1,6 @@
#include <iostream> #include <iostream>
#include <utils/checkpointing>
#include <ga/make_ga.h> #include <ga/make_ga.h>
#include <eoEvalFuncPtr.h> #include <eoEvalFuncPtr.h>
#include "binary_value.h" #include "binary_value.h"

View file

@ -1,5 +1,6 @@
#include <iostream> #include <iostream>
#include <utils/checkpointing>
#include <es/make_real.h> #include <es/make_real.h>
#include "real_value.h" #include "real_value.h"
#include <apply.h> #include <apply.h>

View file

@ -1,5 +1,6 @@
#include <iostream> #include <iostream>
#include <utils/checkpointing>
#include <es/make_real.h> #include <es/make_real.h>
#include "real_value.h" #include "real_value.h"
#include <apply.h> #include <apply.h>

View file

@ -116,7 +116,7 @@ void run_ea(eoAlgo<Indi>& _ga, eoPop<Indi>& _pop)
// checks for help demand, and writes the status file // checks for help demand, and writes the status file
// and make_help; in libutils // and make_help; in libutils
void make_help(eoParser & _parser); // void make_help(eoParser & _parser);
// now use all of the above, + representation dependent things // now use all of the above, + representation dependent things
int main(int argc, char* argv[]) int main(int argc, char* argv[])

View file

@ -89,7 +89,7 @@ void run_ea(eoAlgo<Indi>& _ga, eoPop<Indi>& _pop);
// checks for help demand, and writes the status file // checks for help demand, and writes the status file
// and make_help; in libutils - just a declaration, code in libeoutils.a // and make_help; in libutils - just a declaration, code in libeoutils.a
void make_help(eoParser & _parser); // void make_help(eoParser & _parser);
// now use all of the above, + representation dependent things // now use all of the above, + representation dependent things
// from here on, no difference with eoOneMax.cpp // from here on, no difference with eoOneMax.cpp

View file

@ -47,7 +47,7 @@
// how to initialize the population // how to initialize the population
#include <do/make_pop.h> #include <do/make_pop.h>
// checks for help demand, and writes the status file and make_help; in libutils // checks for help demand, and writes the status file and make_help; in libutils
void make_help(eoParser & _parser); // void make_help(eoParser & _parser);
// definition of the representation // definition of the representation
#include <FlowShop.h> #include <FlowShop.h>

View file

@ -55,7 +55,7 @@
// simple call to the algo // simple call to the algo
#include <do/make_run.h> #include <do/make_run.h>
// checks for help demand, and writes the status file and make_help; in libutils // checks for help demand, and writes the status file and make_help; in libutils
void make_help(eoParser & _parser); // void make_help(eoParser & _parser);
// definition of the representation // definition of the representation
#include <FlowShop.h> #include <FlowShop.h>

View file

@ -48,7 +48,7 @@
// how to initialize the population // how to initialize the population
#include <do/make_pop.h> #include <do/make_pop.h>
// checks for help demand, and writes the status file and make_help; in libutils // checks for help demand, and writes the status file and make_help; in libutils
void make_help(eoParser & _parser); // void make_help(eoParser & _parser);
// definition of the representation // definition of the representation
#include <FlowShop.h> #include <FlowShop.h>