ECF 1.5
HallOfFame.h
1#ifndef HALLOFFAME_H_
2#define HALLOFFAME_H_
3
4#include "SelBestOp.h"
5#include "Operator.h"
6
13class HallOfFame : public Operator
14{
15protected:
16 bool bEmpty_;
17 StateP state_;
19 uint hofSize_;
20 std::vector<IndividualP> bestIndividuals_;
21 std::vector<uint> bestGenerations_;
22 SelBestOpP selectBest_;
23
24public:
25 bool initialize(StateP);
26 bool operate(StateP);
27 bool operate(const std::vector<IndividualP>&);
28 void write(XMLNode&);
29 void read(XMLNode&);
30 HallOfFame();
31
33 std::vector<IndividualP> getBest()
34 { return bestIndividuals_; }
35
38 { return lastChangeGen_; }
39};
40typedef boost::shared_ptr<HallOfFame> HallOfFameP;
41#endif /* HALLOFFAME_H_ */
Records a set of best-so-far individuals.
Definition: HallOfFame.h:14
std::vector< IndividualP > getBest()
Get HoF contents (vector of best-so-far individuals)
Definition: HallOfFame.h:33
uint hofSize_
no. of individuals in HoF
Definition: HallOfFame.h:19
void read(XMLNode &)
Read operator state from XMLNode or the Registry. Called after Operator::initialize.
Definition: HallOfFame.cpp:87
bool bEmpty_
is HoF empty
Definition: HallOfFame.h:16
void write(XMLNode &)
Write operator state to XMLNode or the Registry. Called after Operator::initialize.
Definition: HallOfFame.cpp:71
uint getLastChange()
Return generation of last update (of newest individual in HoF)
Definition: HallOfFame.h:37
std::vector< IndividualP > bestIndividuals_
vector of individuals in HoF
Definition: HallOfFame.h:20
uint lastChangeGen_
generation of last update
Definition: HallOfFame.h:18
bool initialize(StateP)
Perform initialization. Called before Operator::operate. By default, if the return value is false,...
Definition: HallOfFame.cpp:16
bool operate(StateP)
Collect best individuals of the whole Population.
Definition: HallOfFame.cpp:33
Abstract operator class.
Definition: Operator.h:11