GClasses

GClasses::GSampleClimber Class Reference

This is a variant of empirical gradient descent that tries to estimate the gradient using a minimal number of samples. It is more efficient than empirical gradient descent, but it only works well if the optimization surface is quite locally linear. More...

#include <GHillClimber.h>

Inheritance diagram for GClasses::GSampleClimber:
GClasses::GOptimizer

List of all members.

Public Member Functions

 GSampleClimber (GTargetFunction *pCritic, GRand *pRand)
virtual ~GSampleClimber ()
virtual double * currentVector ()
 Returns the best vector yet found.
virtual double iterate ()
 Performs a little more optimization. (Call this in a loop until acceptable results are found.)
void setStepSize (double d)
 Sets the current step size.
void setAlpha (double d)
 Sets the alpha value. It should be small (like 0.01) A very small value updates the gradient estimate slowly, but precisely. A bigger value updates the estimate quickly, but never converges very close to the precise gradient.

Protected Member Functions

void reset ()

Protected Attributes

GRandm_pRand
double m_dStepSize
double m_alpha
double m_error
size_t m_dims
double * m_pVector
double * m_pDir
double * m_pCand
double * m_pGradient

Detailed Description

This is a variant of empirical gradient descent that tries to estimate the gradient using a minimal number of samples. It is more efficient than empirical gradient descent, but it only works well if the optimization surface is quite locally linear.


Constructor & Destructor Documentation

GClasses::GSampleClimber::GSampleClimber ( GTargetFunction pCritic,
GRand pRand 
)
virtual GClasses::GSampleClimber::~GSampleClimber ( ) [virtual]

Member Function Documentation

virtual double* GClasses::GSampleClimber::currentVector ( ) [inline, virtual]

Returns the best vector yet found.

Implements GClasses::GOptimizer.

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

Performs a little more optimization. (Call this in a loop until acceptable results are found.)

Implements GClasses::GOptimizer.

void GClasses::GSampleClimber::reset ( ) [protected]
void GClasses::GSampleClimber::setAlpha ( double  d) [inline]

Sets the alpha value. It should be small (like 0.01) A very small value updates the gradient estimate slowly, but precisely. A bigger value updates the estimate quickly, but never converges very close to the precise gradient.

void GClasses::GSampleClimber::setStepSize ( double  d) [inline]

Sets the current step size.


Member Data Documentation

double* GClasses::GSampleClimber::m_pCand [protected]
double* GClasses::GSampleClimber::m_pDir [protected]