GClasses

GClasses::GEvolutionaryOptimizer Class Reference

Uses an evolutionary process to optimize a vector. More...

#include <GEvolutionary.h>

Inheritance diagram for GClasses::GEvolutionaryOptimizer:
GClasses::GOptimizer

List of all members.

Public Member Functions

 GEvolutionaryOptimizer (GTargetFunction *pCritic, size_t population, GRand *pRand, double moreFitSurvivalRate)
 moreFitSurvivalRate is the probability that the more fit member (in a tournament selection) survives
virtual ~GEvolutionaryOptimizer ()
virtual double * currentVector ()
 Returns the best vector found in recent iterations.
virtual double iterate ()
 Do a little bit more optimization. (This method is typically called in a loop until satisfactory results are obtained.)

Protected Member Functions

size_t doTournament ()
 Returns the index of the tournament loser (who should typically die and be replaced).
void recomputeError (size_t index, GEvolutionaryOptimizerNode *pNode, const double *pVec)
GEvolutionaryOptimizerNode * node (size_t index)

Protected Attributes

double m_tournamentProbability
GRandm_pRand
std::vector
< GEvolutionaryOptimizerNode * > 
m_population
double m_bestErr
size_t m_bestIndex

Detailed Description

Uses an evolutionary process to optimize a vector.


Constructor & Destructor Documentation

GClasses::GEvolutionaryOptimizer::GEvolutionaryOptimizer ( GTargetFunction pCritic,
size_t  population,
GRand pRand,
double  moreFitSurvivalRate 
)

moreFitSurvivalRate is the probability that the more fit member (in a tournament selection) survives

virtual GClasses::GEvolutionaryOptimizer::~GEvolutionaryOptimizer ( ) [virtual]

Member Function Documentation

virtual double* GClasses::GEvolutionaryOptimizer::currentVector ( ) [virtual]

Returns the best vector found in recent iterations.

Implements GClasses::GOptimizer.

size_t GClasses::GEvolutionaryOptimizer::doTournament ( ) [protected]

Returns the index of the tournament loser (who should typically die and be replaced).

virtual double GClasses::GEvolutionaryOptimizer::iterate ( ) [virtual]

Do a little bit more optimization. (This method is typically called in a loop until satisfactory results are obtained.)

Implements GClasses::GOptimizer.

GEvolutionaryOptimizerNode* GClasses::GEvolutionaryOptimizer::node ( size_t  index) [protected]
void GClasses::GEvolutionaryOptimizer::recomputeError ( size_t  index,
GEvolutionaryOptimizerNode *  pNode,
const double *  pVec 
) [protected]

Member Data Documentation

std::vector<GEvolutionaryOptimizerNode*> GClasses::GEvolutionaryOptimizer::m_population [protected]