Interior-point-optimisation  1.0-1
Interior-pointoptimisationlibrary
ipo_function::Function Class Referenceabstract

This class computes a function at a vector. More...

#include <Function.hpp>

Inheritance diagram for ipo_function::Function:
Inheritance graph
Collaboration diagram for ipo_function::Function:
Collaboration graph

Public Member Functions

 Function (size_t const size=0)
 Constructor. More...
 
virtual double operator() (gsl::vector const &vector)=0
 Compute a function value. More...
 
virtual gsl::vector gradient (gsl::vector const &vector)
 Compute or estimate a gradient value. More...
 
virtual gsl::matrix hessian (gsl::vector const &vector)
 Compute or estimate a Hessian value. More...
 
virtual std::tuple
< gsl::vector, gsl::matrix > 
derivatives (gsl::vector const &vector)
 Compute or estimate derivative values. More...
 
- Public Member Functions inherited from ipo_function::detail::FunctionBase
 FunctionBase (size_t const size=0)
 Constructor. More...
 
virtual ~FunctionBase ()=0
 Make the class abstract. More...
 
size_t getSize () const
 Get size of vector for function arguments or zero for arbitrary size. More...
 

Protected Attributes

double h = std::sqrt( std::numeric_limits<double>::epsilon() )
 Value used for default gradient estimates. More...
 
double h2 = std::sqrt( h )
 Value used for default Hessian estimates. More...
 
- Protected Attributes inherited from ipo_function::detail::FunctionBase
size_t const size
 Size of vector arguments to supply to subclass functions. More...
 

Detailed Description

This class computes a function at a vector.

It is an abstract base class and so you derive from this class to create classes to implement the function objects needed for interior-point optimisation.

The constructor subclass of Function should use FunctionBase( size ) to specify the size of vectors it uses unless these are arbitrary.

When creating a subclass, do not forget to initialise FunctionBase explicitly in the constructor.

Definition at line 38 of file Function.hpp.

Constructor & Destructor Documentation

Function::Function ( size_t const  size = 0)

Constructor.

Parameters
sizeThe size of vector for member functions that take a vector
See also
FunctionBase

Definition at line 28 of file Function.cc.

Member Function Documentation

std::tuple< gsl::vector, gsl::matrix > Function::derivatives ( gsl::vector const &  vector)
virtual

Compute or estimate derivative values.

The default is to compute central difference quotient graient and Hessian estimates. The virtual base function just calls gradient and hessian. So it is not necessary to define derivatives in addition to gradient and hessian in subclasses. But it is possible if there is some benefit to be gained.

Parameters
vectorThe vector at which to evaluate the function
Returns
The gradient and Hessian values

Definition at line 109 of file Function.cc.

References gradient(), and hessian().

gsl::vector Function::gradient ( gsl::vector const &  vector)
virtual
gsl::matrix Function::hessian ( gsl::vector const &  vector)
virtual
virtual double ipo_function::Function::operator() ( gsl::vector const &  vector)
pure virtual

Member Data Documentation

double ipo_function::Function::h = std::sqrt( std::numeric_limits<double>::epsilon() )
protected

Value used for default gradient estimates.

The default value is the square root of machine epsilon.

Definition at line 82 of file Function.hpp.

Referenced by gradient(), ipo_function::detail::PhaseIFunctionAndDerivatives::hessian(), and ipo_function::detail::PhaseIFunctionAndDerivatives::setVector().

double ipo_function::Function::h2 = std::sqrt( h )
protected

Value used for default Hessian estimates.

The default value is the fourth root of machine epsilon.

Definition at line 87 of file Function.hpp.

Referenced by hessian().


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