SG++-Doxygen-Documentation
sgpp::optimization::optimizer::NLCG Class Reference

Gradient-based nonlinear conjugate gradient method. More...

#include <NLCG.hpp>

Inheritance diagram for sgpp::optimization::optimizer::NLCG:
sgpp::optimization::optimizer::UnconstrainedOptimizer

Public Member Functions

void clone (std::unique_ptr< UnconstrainedOptimizer > &clone) const override
 
double getBeta () const
 
double getEpsilon () const
 
double getGamma () const
 
ScalarFunctionGradientgetObjectiveGradient () const
 
double getRestartThreshold () const
 
double getTolerance () const
 
 NLCG (const ScalarFunction &f, const ScalarFunctionGradient &fGradient, size_t maxItCount=DEFAULT_N, double beta=DEFAULT_BETA, double gamma=DEFAULT_GAMMA, double tolerance=DEFAULT_TOLERANCE, double epsilon=DEFAULT_EPSILON, double restartThreshold=DEFAULT_RESTART_THRESHOLD)
 Constructor. More...
 
 NLCG (const NLCG &other)
 Copy constructor. More...
 
void optimize () override
 Pure virtual method for optimization of the objective function. More...
 
void setBeta (double beta)
 
void setEpsilon (double epsilon)
 
void setGamma (double gamma)
 
void setRestartThreshold (double restartThreshold)
 
void setTolerance (double tolerance)
 
 ~NLCG () override
 Destructor. More...
 
- Public Member Functions inherited from sgpp::optimization::optimizer::UnconstrainedOptimizer
const base::DataMatrixgetHistoryOfOptimalPoints () const
 
const base::DataVectorgetHistoryOfOptimalValues () const
 
size_t getN () const
 
ScalarFunctiongetObjectiveFunction () const
 
const base::DataVectorgetOptimalPoint () const
 
double getOptimalValue () const
 
const base::DataVectorgetStartingPoint () const
 
void setN (size_t N)
 
void setStartingPoint (const base::DataVector &startingPoint)
 
 UnconstrainedOptimizer (const ScalarFunction &f, size_t N=DEFAULT_N)
 Constructor. More...
 
 UnconstrainedOptimizer (const UnconstrainedOptimizer &other)
 Copy constructor. More...
 
virtual ~UnconstrainedOptimizer ()
 Destructor. More...
 

Static Public Attributes

static constexpr double DEFAULT_BETA = 0.5
 default beta (parameter for Armijo's rule) More...
 
static constexpr double DEFAULT_EPSILON = 1e-18
 default epsilon (parameter for Armijo's rule) More...
 
static constexpr double DEFAULT_GAMMA = 1e-2
 default gamma (parameter for Armijo's rule) More...
 
static constexpr double DEFAULT_RESTART_THRESHOLD = 0.1
 default restart threshold More...
 
static constexpr double DEFAULT_TOLERANCE = 1e-8
 default tolerance (parameter for Armijo's rule) More...
 
- Static Public Attributes inherited from sgpp::optimization::optimizer::UnconstrainedOptimizer
static const size_t DEFAULT_N = 1000
 default maximal number of iterations or function evaluations More...
 

Protected Attributes

double alpha
 restart threshold More...
 
double beta
 beta (parameter for Armijo's rule) More...
 
double eps
 epsilon (parameter for Armijo's rule) More...
 
std::unique_ptr< ScalarFunctionGradientfGradient
 objective function gradient More...
 
double gamma
 gamma (parameter for Armijo's rule) More...
 
double tol
 tolerance (parameter for Armijo's rule) More...
 
- Protected Attributes inherited from sgpp::optimization::optimizer::UnconstrainedOptimizer
std::unique_ptr< ScalarFunctionf
 objective function More...
 
base::DataVector fHist
 search history vector (optimal values) More...
 
double fOpt
 result of optimization (optimal function value) More...
 
size_t N
 maximal number of iterations or function evaluations More...
 
base::DataVector x0
 starting point More...
 
base::DataMatrix xHist
 search history matrix (optimal points) More...
 
base::DataVector xOpt
 result of optimization (location of optimum) More...
 

Detailed Description

Gradient-based nonlinear conjugate gradient method.

The method is restarted with the steepest descent direction if the normalized absolute value of the inner product of two successive gradients exceeds a "restart threshold" \(\alpha\).

Constructor & Destructor Documentation

◆ NLCG() [1/2]

sgpp::optimization::optimizer::NLCG::NLCG ( const ScalarFunction f,
const ScalarFunctionGradient fGradient,
size_t  maxItCount = DEFAULT_N,
double  beta = DEFAULT_BETA,
double  gamma = DEFAULT_GAMMA,
double  tolerance = DEFAULT_TOLERANCE,
double  epsilon = DEFAULT_EPSILON,
double  restartThreshold = DEFAULT_RESTART_THRESHOLD 
)

Constructor.

Parameters
fobjective function
fGradientobjective function gradient
maxItCountmaximal number of iterations
betabeta (parameter for Armijo's rule)
gammagamma (parameter for Armijo's rule)
tolerancetolerance (parameter for Armijo's rule)
epsilonepsilon (parameter for Armijo's rule)
restartThresholdrestart threshold

References sgpp::optimization::ScalarFunctionGradient::clone().

Referenced by clone().

◆ NLCG() [2/2]

sgpp::optimization::optimizer::NLCG::NLCG ( const NLCG other)

Copy constructor.

Parameters
otheroptimizer to be copied

References fGradient.

◆ ~NLCG()

sgpp::optimization::optimizer::NLCG::~NLCG ( )
override

Destructor.

Member Function Documentation

◆ clone()

void sgpp::optimization::optimizer::NLCG::clone ( std::unique_ptr< UnconstrainedOptimizer > &  clone) const
overridevirtual
Parameters
[out]clonepointer to cloned object

Implements sgpp::optimization::optimizer::UnconstrainedOptimizer.

References NLCG().

◆ getBeta()

double sgpp::optimization::optimizer::NLCG::getBeta ( ) const
Returns
beta (parameter for Armijo's rule)

References beta.

◆ getEpsilon()

double sgpp::optimization::optimizer::NLCG::getEpsilon ( ) const
Returns
epsilon (parameter for Armijo's rule)

References eps.

◆ getGamma()

double sgpp::optimization::optimizer::NLCG::getGamma ( ) const
Returns
gamma (parameter for Armijo's rule)

References gamma.

◆ getObjectiveGradient()

ScalarFunctionGradient & sgpp::optimization::optimizer::NLCG::getObjectiveGradient ( ) const
Returns
objective function gradient

References fGradient.

◆ getRestartThreshold()

double sgpp::optimization::optimizer::NLCG::getRestartThreshold ( ) const
Returns
restart threshold

References alpha.

◆ getTolerance()

double sgpp::optimization::optimizer::NLCG::getTolerance ( ) const
Returns
tolerance (parameter for Armijo's rule)

References tol.

◆ optimize()

◆ setBeta()

void sgpp::optimization::optimizer::NLCG::setBeta ( double  beta)
Parameters
betabeta (parameter for Armijo's rule)

References beta.

◆ setEpsilon()

void sgpp::optimization::optimizer::NLCG::setEpsilon ( double  epsilon)
Parameters
epsilonepsilon (parameter for Armijo's rule)

References eps.

◆ setGamma()

void sgpp::optimization::optimizer::NLCG::setGamma ( double  gamma)
Parameters
gammagamma (parameter for Armijo's rule)

References gamma.

◆ setRestartThreshold()

void sgpp::optimization::optimizer::NLCG::setRestartThreshold ( double  restartThreshold)
Parameters
restartThresholdrestart threshold

References alpha.

◆ setTolerance()

void sgpp::optimization::optimizer::NLCG::setTolerance ( double  tolerance)
Parameters
tolerancetolerance (parameter for Armijo's rule)

References tol.

Member Data Documentation

◆ alpha

double sgpp::optimization::optimizer::NLCG::alpha
protected

◆ beta

double sgpp::optimization::optimizer::NLCG::beta
protected

beta (parameter for Armijo's rule)

Referenced by getBeta(), optimize(), and setBeta().

◆ DEFAULT_BETA

constexpr double sgpp::optimization::optimizer::NLCG::DEFAULT_BETA = 0.5
static

default beta (parameter for Armijo's rule)

◆ DEFAULT_EPSILON

constexpr double sgpp::optimization::optimizer::NLCG::DEFAULT_EPSILON = 1e-18
static

default epsilon (parameter for Armijo's rule)

◆ DEFAULT_GAMMA

constexpr double sgpp::optimization::optimizer::NLCG::DEFAULT_GAMMA = 1e-2
static

default gamma (parameter for Armijo's rule)

◆ DEFAULT_RESTART_THRESHOLD

constexpr double sgpp::optimization::optimizer::NLCG::DEFAULT_RESTART_THRESHOLD = 0.1
static

default restart threshold

◆ DEFAULT_TOLERANCE

constexpr double sgpp::optimization::optimizer::NLCG::DEFAULT_TOLERANCE = 1e-8
static

default tolerance (parameter for Armijo's rule)

◆ eps

double sgpp::optimization::optimizer::NLCG::eps
protected

epsilon (parameter for Armijo's rule)

Referenced by getEpsilon(), optimize(), and setEpsilon().

◆ fGradient

std::unique_ptr<ScalarFunctionGradient> sgpp::optimization::optimizer::NLCG::fGradient
protected

objective function gradient

Referenced by getObjectiveGradient(), NLCG(), and optimize().

◆ gamma

double sgpp::optimization::optimizer::NLCG::gamma
protected

gamma (parameter for Armijo's rule)

Referenced by getGamma(), optimize(), and setGamma().

◆ tol

double sgpp::optimization::optimizer::NLCG::tol
protected

tolerance (parameter for Armijo's rule)

Referenced by getTolerance(), optimize(), and setTolerance().


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