ECF 1.5
WriteBest.h
1//
2// pomocni operator za ispis trenutno najboljeg rjesenja
3//
4class WriteBest : public Operator
5{
6private:
7 StateP state_;
8 std::string logfilename;
9 SchedulingEvalOpP testEvalOp;
10public:
11
12 bool initialize(StateP state)
13 {
14 state_ = state;
15 return true;
16 }
17
18 bool operate(StateP state)
19 {
20 ECF_LOG(state, 3, "Best in " + uint2str(state->getGenerationNo()));
21 IndividualP bestInd = state->getPopulation()->getHof()->getBest().at(0);
22 ECF_LOG(state, 3, bestInd->toString());
23
24 return true;
25 }
26};
Abstract operator class.
Definition: Operator.h:11
bool operate(StateP state)
perform the designated operation
Definition: WriteBest.h:18
bool initialize(StateP state)
Perform initialization. Called before Operator::operate. By default, if the return value is false,...
Definition: WriteBest.h:12