ECF 1.7

Records a set of best-so-far individuals. More...

#include <HallOfFame.h>

Inheritance diagram for HallOfFame:
Operator

Public Member Functions

bool initialize (StateP)
 Perform initialization. Called before Operator::operate. By default, if the return value is false, the operator will not be used!
bool operate (StateP)
 Collect best individuals of the whole Population.
bool operate (const std::vector< IndividualP > &)
 Collect best individuals of the given vector.
void write (XMLNode &)
 Write operator state to XMLNode or the Registry. Called after Operator::initialize.
void read (XMLNode &)
 Read operator state from XMLNode or the Registry. Called after Operator::initialize.
std::vector< IndividualP > getBest ()
 Get HoF contents (vector of best-so-far individuals).
uint getLastChange ()
 Return generation of last update (of newest individual in HoF).
Public Member Functions inherited from Operator
virtual void registerParameters (StateP)
 Register parameters with the Registry. Called before Operator::initialize.

Protected Attributes

bool bEmpty_
 is HoF empty
StateP state_
uint lastChangeGen_
 generation of last update
uint hofSize_
 no. of individuals in HoF
std::vector< IndividualP > bestIndividuals_
 vector of individuals in HoF
std::vector< uint > bestGenerations_
SelBestOpP selectBest_

Detailed Description

Records a set of best-so-far individuals.

Currently only one individual is kept. Each Deme contains a HoF object.

Definition at line 13 of file HallOfFame.h.

Constructor & Destructor Documentation

◆ HallOfFame()

HallOfFame::HallOfFame ( )

Definition at line 7 of file HallOfFame.cpp.

Member Function Documentation

◆ getBest()

std::vector< IndividualP > HallOfFame::getBest ( )
inline

Get HoF contents (vector of best-so-far individuals).

Definition at line 33 of file HallOfFame.h.

◆ getLastChange()

uint HallOfFame::getLastChange ( )
inline

Return generation of last update (of newest individual in HoF).

Definition at line 37 of file HallOfFame.h.

◆ initialize()

bool HallOfFame::initialize ( StateP state)
virtual

Perform initialization. Called before Operator::operate. By default, if the return value is false, the operator will not be used!

Returns
initialization success

Reimplemented from Operator.

Definition at line 16 of file HallOfFame.cpp.

◆ operate() [1/2]

bool HallOfFame::operate ( const std::vector< IndividualP > & individuals)

Collect best individuals of the given vector.

Definition at line 48 of file HallOfFame.cpp.

◆ operate() [2/2]

bool HallOfFame::operate ( StateP state)
virtual

Collect best individuals of the whole Population.

Implements Operator.

Definition at line 33 of file HallOfFame.cpp.

◆ read()

void HallOfFame::read ( XMLNode & xHof)
virtual

Read operator state from XMLNode or the Registry. Called after Operator::initialize.

Reimplemented from Operator.

Definition at line 87 of file HallOfFame.cpp.

◆ write()

void HallOfFame::write ( XMLNode & xHoF)
virtual

Write operator state to XMLNode or the Registry. Called after Operator::initialize.

Reimplemented from Operator.

Definition at line 71 of file HallOfFame.cpp.

Member Data Documentation

◆ bEmpty_

bool HallOfFame::bEmpty_
protected

is HoF empty

Definition at line 16 of file HallOfFame.h.

◆ bestGenerations_

std::vector<uint> HallOfFame::bestGenerations_
protected

Definition at line 21 of file HallOfFame.h.

◆ bestIndividuals_

std::vector<IndividualP> HallOfFame::bestIndividuals_
protected

vector of individuals in HoF

Definition at line 20 of file HallOfFame.h.

◆ hofSize_

uint HallOfFame::hofSize_
protected

no. of individuals in HoF

Definition at line 19 of file HallOfFame.h.

◆ lastChangeGen_

uint HallOfFame::lastChangeGen_
protected

generation of last update

Definition at line 18 of file HallOfFame.h.

◆ selectBest_

SelBestOpP HallOfFame::selectBest_
protected

Definition at line 22 of file HallOfFame.h.

◆ state_

StateP HallOfFame::state_
protected

Definition at line 17 of file HallOfFame.h.


The documentation for this class was generated from the following files: