SG++-Doxygen-Documentation
sgpp::optimization::optimizer::LeastSquaresOptimizer Class Referenceabstract

Abstract class for solving non-linear least squares problems. More...

#include <LeastSquaresOptimizer.hpp>

Inheritance diagram for sgpp::optimization::optimizer::LeastSquaresOptimizer:
sgpp::optimization::optimizer::LevenbergMarquardt

Public Member Functions

virtual void clone (std::unique_ptr< LeastSquaresOptimizer > &clone) const =0
 Pure virtual method for cloning the optimizer. More...
 
const base::DataMatrixgetHistoryOfOptimalPoints () const
 
const base::DataVectorgetHistoryOfOptimalValues () const
 
size_t getN () const
 
const base::DataVectorgetOptimalPoint () const
 
double getOptimalValue () const
 
VectorFunctiongetPhiFunction () const
 
const base::DataVectorgetStartingPoint () const
 
 LeastSquaresOptimizer (const VectorFunction &phi, size_t N=DEFAULT_N)
 Constructor. More...
 
 LeastSquaresOptimizer (const LeastSquaresOptimizer &other)
 Copy constructor. More...
 
virtual void optimize ()=0
 Pure virtual method for optimization of the objective function. More...
 
void setN (size_t N)
 
void setStartingPoint (const base::DataVector &startingPoint)
 
virtual ~LeastSquaresOptimizer ()
 Destructor. More...
 

Static Public Attributes

static const size_t DEFAULT_N = 1000
 default maximal number of iterations or function evaluations More...
 

Protected Attributes

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...
 
std::unique_ptr< VectorFunctionphi
 phi function 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

Abstract class for solving non-linear least squares problems.

Constructor & Destructor Documentation

◆ LeastSquaresOptimizer() [1/2]

sgpp::optimization::optimizer::LeastSquaresOptimizer::LeastSquaresOptimizer ( const VectorFunction phi,
size_t  N = DEFAULT_N 
)
inlineexplicit

Constructor.

The starting point is set to \((0.5, \dotsc, 0.5)^{\mathrm{T}}\).

Parameters
phiphi function
Nmaximal number of iterations or function evaluations (depending on the implementation)

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

◆ LeastSquaresOptimizer() [2/2]

sgpp::optimization::optimizer::LeastSquaresOptimizer::LeastSquaresOptimizer ( const LeastSquaresOptimizer other)
inline

Copy constructor.

Parameters
otheroptimizer to be copied

References fHist, fOpt, x0, xHist, and xOpt.

◆ ~LeastSquaresOptimizer()

virtual sgpp::optimization::optimizer::LeastSquaresOptimizer::~LeastSquaresOptimizer ( )
inlinevirtual

Destructor.

References optimize().

Member Function Documentation

◆ clone()

virtual void sgpp::optimization::optimizer::LeastSquaresOptimizer::clone ( std::unique_ptr< LeastSquaresOptimizer > &  clone) const
pure virtual

Pure virtual method for cloning the optimizer.

It should generate a pointer to the cloned object and it's used for parallel computations.

Parameters
[out]clonepointer to cloned object

Implemented in sgpp::optimization::optimizer::LevenbergMarquardt.

Referenced by getHistoryOfOptimalValues().

◆ getHistoryOfOptimalPoints()

const base::DataMatrix& sgpp::optimization::optimizer::LeastSquaresOptimizer::getHistoryOfOptimalPoints ( ) const
inline
Returns
tall matrix (d columns) in which the k-th row indicates the best point after k iterations of the optimization, empty matrix on error or if not supported

References xHist.

◆ getHistoryOfOptimalValues()

const base::DataVector& sgpp::optimization::optimizer::LeastSquaresOptimizer::getHistoryOfOptimalValues ( ) const
inline
Returns
vector in which the k-th entry indicates the best function value after k iterations of the optimization, empty vector on error or if not supported

References clone(), and fHist.

◆ getN()

size_t sgpp::optimization::optimizer::LeastSquaresOptimizer::getN ( ) const
inline
Returns
maximal number of iterations or function evaluations

References N.

◆ getOptimalPoint()

const base::DataVector& sgpp::optimization::optimizer::LeastSquaresOptimizer::getOptimalPoint ( ) const
inline
Returns
result of optimization (location of optimum), empty vector on error

References xOpt.

◆ getOptimalValue()

double sgpp::optimization::optimizer::LeastSquaresOptimizer::getOptimalValue ( ) const
inline
Returns
result of optimization (optimal function value), NAN on error

References fOpt.

◆ getPhiFunction()

VectorFunction& sgpp::optimization::optimizer::LeastSquaresOptimizer::getPhiFunction ( ) const
inline
Returns
phi

References phi.

◆ getStartingPoint()

const base::DataVector& sgpp::optimization::optimizer::LeastSquaresOptimizer::getStartingPoint ( ) const
inline
Returns
starting point

References x0.

◆ optimize()

virtual void sgpp::optimization::optimizer::LeastSquaresOptimizer::optimize ( )
pure virtual

Pure virtual method for optimization of the objective function.

The result of the optimization process can be obtained by member functions, e.g., getOptimalPoint() and getOptimalValue().

Implemented in sgpp::optimization::optimizer::LevenbergMarquardt.

Referenced by ~LeastSquaresOptimizer().

◆ setN()

void sgpp::optimization::optimizer::LeastSquaresOptimizer::setN ( size_t  N)
inline
Parameters
Nmaximal number of iterations or function evaluations

References N.

◆ setStartingPoint()

void sgpp::optimization::optimizer::LeastSquaresOptimizer::setStartingPoint ( const base::DataVector startingPoint)
inline
Parameters
startingPointstarting point

References x0.

Member Data Documentation

◆ DEFAULT_N

const size_t sgpp::optimization::optimizer::LeastSquaresOptimizer::DEFAULT_N = 1000
static

default maximal number of iterations or function evaluations

◆ fHist

base::DataVector sgpp::optimization::optimizer::LeastSquaresOptimizer::fHist
protected

◆ fOpt

double sgpp::optimization::optimizer::LeastSquaresOptimizer::fOpt
protected

result of optimization (optimal function value)

Referenced by getOptimalValue(), LeastSquaresOptimizer(), and sgpp::optimization::optimizer::LevenbergMarquardt::optimize().

◆ N

size_t sgpp::optimization::optimizer::LeastSquaresOptimizer::N
protected

maximal number of iterations or function evaluations

Referenced by getN(), sgpp::optimization::optimizer::LevenbergMarquardt::optimize(), and setN().

◆ phi

std::unique_ptr<VectorFunction> sgpp::optimization::optimizer::LeastSquaresOptimizer::phi
protected

◆ x0

base::DataVector sgpp::optimization::optimizer::LeastSquaresOptimizer::x0
protected

◆ xHist

base::DataMatrix sgpp::optimization::optimizer::LeastSquaresOptimizer::xHist
protected

◆ xOpt

base::DataVector sgpp::optimization::optimizer::LeastSquaresOptimizer::xOpt
protected

result of optimization (location of optimum)

Referenced by getOptimalPoint(), LeastSquaresOptimizer(), and sgpp::optimization::optimizer::LevenbergMarquardt::optimize().


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