GClasses
GClasses::GParticleSwarm Class Reference

An optimization algorithm inspired by flocking birds. More...

#include <GParticleSwarm.h>

Inheritance diagram for GClasses::GParticleSwarm:
GClasses::GOptimizer

Public Member Functions

 GParticleSwarm (GTargetFunction *pCritic, size_t nPopulation, double dMin, double dRange, GRand *pRand)
 
virtual ~GParticleSwarm ()
 
virtual double iterate ()
 Perform a little more optimization. More...
 
void setLearningRate (double d)
 Specify the learning rate. More...
 
- Public Member Functions inherited from GClasses::GOptimizer
 GOptimizer (GTargetFunction *pCritic)
 
virtual ~GOptimizer ()
 
virtual double * currentVector ()=0
 Returns the current vector of the optimizer. For greedy search methods, this will be the best vector yet found. More...
 
double searchUntil (size_t nBurnInIterations, size_t nIterations, double dImprovement)
 This will first call iterate() nBurnInIterations times, then it will repeatedly call iterate() in blocks of nIterations times. If the error heuristic has not improved by the specified ratio after a block of iterations, it will stop. (For example, if the error before the block of iterations was 50, and the error after is 49, then training will stop if dImprovement is > 0.02.) If the error heuristic is not stable, then the value of nIterations should be large. More...
 

Protected Member Functions

void reset ()
 

Protected Attributes

double m_dLearningRate
 
double m_dMin
 
double m_dRange
 
size_t m_nDimensions
 
size_t m_nGlobalBest
 
size_t m_nPopulation
 
double * m_pBests
 
double * m_pErrors
 
double * m_pPositions
 
GRandm_pRand
 
double * m_pVelocities
 
- Protected Attributes inherited from GClasses::GOptimizer
GTargetFunctionm_pCritic
 

Detailed Description

An optimization algorithm inspired by flocking birds.

Constructor & Destructor Documentation

GClasses::GParticleSwarm::GParticleSwarm ( GTargetFunction pCritic,
size_t  nPopulation,
double  dMin,
double  dRange,
GRand pRand 
)
virtual GClasses::GParticleSwarm::~GParticleSwarm ( )
virtual

Member Function Documentation

virtual double GClasses::GParticleSwarm::iterate ( )
virtual

Perform a little more optimization.

Implements GClasses::GOptimizer.

void GClasses::GParticleSwarm::reset ( )
protected
void GClasses::GParticleSwarm::setLearningRate ( double  d)
inline

Specify the learning rate.

Member Data Documentation

double GClasses::GParticleSwarm::m_dLearningRate
protected
double GClasses::GParticleSwarm::m_dMin
protected
double GClasses::GParticleSwarm::m_dRange
protected
size_t GClasses::GParticleSwarm::m_nDimensions
protected
size_t GClasses::GParticleSwarm::m_nGlobalBest
protected
size_t GClasses::GParticleSwarm::m_nPopulation
protected
double* GClasses::GParticleSwarm::m_pBests
protected
double* GClasses::GParticleSwarm::m_pErrors
protected
double* GClasses::GParticleSwarm::m_pPositions
protected
GRand* GClasses::GParticleSwarm::m_pRand
protected
double* GClasses::GParticleSwarm::m_pVelocities
protected