8 std::string logfilename;
9 SchedulingEvalOpP testEvalOp;
13 state->getRegistry()->registerEntry(
"test_cases2", (voidP) (
new std::string(
"fitness2.txt")), ECF::STRING);
19 voidP sptr = state->getRegistry()->getEntry(
"log.filename");
20 logfilename = *((std::string*) sptr.get());
24 sptr = state->getRegistry()->getEntry(
"test_cases");
25 voidP sptr2 = state->getRegistry()->getEntry(
"test_cases2");
27 state->getRegistry()->modifyEntry(
"test_cases", sptr2);
28 testEvalOp->initialize(state);
29 state->getRegistry()->modifyEntry(
"test_cases", sptr);
36 ECF_LOG(state, 1,
"Podaci\t" + uint2str(state->getGenerationNo()));
37 IndividualP bestInd = state->getPopulation()->getHof()->getBest().at(0);
38 ECF_LOG(state, 1, bestInd->toString());
40 TreeP bestTree = boost::dynamic_pointer_cast<Tree::Tree> (bestInd->getGenotype(0));
41 uint sizeOfBest = (uint) bestTree->size();
43 DemeP deme = state->getPopulation()->getLocalDeme();
44 uint popSize = (uint) deme->size();
46 for(uint i = 0; i < popSize; i++) {
47 TreeP tree = boost::dynamic_pointer_cast<Tree::Tree> (deme->at(i)->getGenotype(0));
48 totalSize += (uint) tree->size();
50 uint averageSize = (uint) (1. * totalSize / popSize);
53 double bestValue = testEvalOp->evaluate(bestInd)->getValue();
55 ECF_LOG(state, 1, uint2str(sizeOfBest) +
"\t" + uint2str(averageSize) +
"\t" + dbl2str(bestValue));
bool operate(StateP state)
perform the designated operation
bool initialize(StateP state)
Perform initialization. Called before Operator::operate. By default, if the return value is false,...
void registerParameters(StateP state)
Register parameters with the Registry. Called before Operator::initialize.