16 uint freq, maxGen, eval;
18 bool termEval, termFitness, termStagn, termGen;
24 termEval = termFitness = termStagn = termGen =
false;
26 if(state->getRegistry()->isModified(
"term.eval"))
28 if(state->getRegistry()->isModified(
"term.stagnation"))
30 if(state->getRegistry()->isModified(
"term.fitnessval"))
32 if(state->getRegistry()->isModified(
"term.maxgen"))
36 voidP sptr = state->getRegistry()->getEntry(
"term.stagnation");
37 freq = *((uint*)sptr.get());
39 sptr = state->getRegistry()->getEntry(
"term.maxgen");
40 maxGen = *((uint*)sptr.get());
42 sptr = state->getRegistry()->getEntry(
"term.eval");
43 eval = *((uint*)sptr.get());
45 sptr = state->getRegistry()->getEntry(
"term.fitnessval");
46 fitnessVal = *((
double*)sptr.get());
55 uint currentGen = state->getGenerationNo();
56 double minFitness = state->getStats()->getFitnessMin();
57 double maxFitness = state->getStats()->getFitnessMax();
59 if(termGen && currentGen >= maxGen)
62 if(termStagn && (currentGen - state->getPopulation()->getHof()->getLastChange()) > freq)
65 if(termEval && state->getEvaluations() >= eval)
68 if(termFitness && (fitnessVal >= minFitness && fitnessVal <= maxFitness))
77 std::vector<IndividualP> hof = state->getHoF()->getBest();
78 IndividualP ind = hof[0];
80 evaluateVerbose =
true;
81 state->getAlgorithm()->evaluate(ind);
82 evaluateVerbose =
false;
84 ECF_LOG(state, 1, ind->toString());
bool initialize(StateP state)
Perform initialization. Called before Operator::operate. By default, if the return value is false,...
bool operate(StateP state)
perform the designated operation