GClasses
|
Uses an evolutionary process to optimize a vector. More...
#include <GEvolutionary.h>
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 |
GRand * | m_pRand |
std::vector < GEvolutionaryOptimizerNode * > | m_population |
double | m_bestErr |
size_t | m_bestIndex |
Uses an evolutionary process to optimize a vector.
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] |
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] |
double GClasses::GEvolutionaryOptimizer::m_bestErr [protected] |
size_t GClasses::GEvolutionaryOptimizer::m_bestIndex [protected] |
std::vector<GEvolutionaryOptimizerNode*> GClasses::GEvolutionaryOptimizer::m_population [protected] |
GRand* GClasses::GEvolutionaryOptimizer::m_pRand [protected] |
double GClasses::GEvolutionaryOptimizer::m_tournamentProbability [protected] |