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