Interior-point-optimisation  1.0-1
Interior-pointoptimisationlibrary
ipo_function::detail::PhaseIFunctionAndDerivatives Class Reference

Function for Phase I (feasibility) of interior-point optimisation. More...

#include <PhaseIFunctionAndDerivatives.hpp>

Inheritance diagram for ipo_function::detail::PhaseIFunctionAndDerivatives:
Inheritance graph
Collaboration diagram for ipo_function::detail::PhaseIFunctionAndDerivatives:
Collaboration graph

Public Member Functions

 PhaseIFunctionAndDerivatives (Function &function, double const b, bool const upperBound)
 Construct from a function and bound. More...
 
double operator() (gsl::vector const &vector)
 The function operator: computes $f(x)-s-b$ or $-f(x)-s-b$ according as $b$ is an upper or lower bound. More...
 
gsl::vector gradient (gsl::vector const &vector)
 The function operator: returns the gradient. More...
 
gsl::matrix hessian (gsl::vector const &vector)
 The function operator: returns the Hessian. More...
 
void setVector (gsl::vector const &vector)
 Set a vector and compute function value, gradient and Hessian efficiently. More...
 
- Public Member Functions inherited from ipo_function::Function
 Function (size_t const size=0)
 Constructor. 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...
 
- Public Member Functions inherited from ipo_function::DerivativesEstimates
 DerivativesEstimates (size_t const size=0)
 Constructor. More...
 
virtual gsl::matrix hessian () const
 
- Public Member Functions inherited from ipo_function::GradientEstimate
 GradientEstimate (size_t const size=0)
 Constructor. More...
 
virtual double value () const
 
virtual gsl::vector gradient () const
 

Private Attributes

Functionfunction
 The function. More...
 
double const b
 The bound. More...
 
bool const upperBound
 A boolean value: true or false according as b is an upper bound or lower. More...
 

Additional Inherited Members

- Protected Attributes inherited from ipo_function::Function
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...
 
- Protected Attributes inherited from ipo_function::DerivativesEstimates
gsl::matrix functionHessian
 The Hessian value. More...
 
- Protected Attributes inherited from ipo_function::GradientEstimate
double functionValue
 The function value. More...
 
gsl::vector functionGradient
 The gradient value. More...
 

Detailed Description

Function for Phase I (feasibility) of interior-point optimisation.

Take a Function object and upper or lower bound and construct a function whose argument takes one extra element at the end. If the original function is $f(x)$, the extra element is $s$ and the bound is $b$, the function is $f(x)-s-b$ or $b-f(x)-s$ according as $b$ is an upper or lower bound.

This class also computes derivatives.

Definition at line 38 of file PhaseIFunctionAndDerivatives.hpp.

Constructor & Destructor Documentation

PhaseIFunctionAndDerivatives::PhaseIFunctionAndDerivatives ( Function function,
double const  b,
bool const  upperBound 
)

Construct from a function and bound.

Parameters
functionThe function
bThe bound
upperBoundtrue or false according as b is an upper bound or lower

Definition at line 28 of file PhaseIFunctionAndDerivatives.cc.

References ipo_function::detail::FunctionBase::getSize().

Member Function Documentation

gsl::vector PhaseIFunctionAndDerivatives::gradient ( gsl::vector const &  vector)
virtual

The function operator: returns the gradient.

Parameters
vectorA vector argument
Returns
The gradient

Reimplemented from ipo_function::Function.

Definition at line 58 of file PhaseIFunctionAndDerivatives.cc.

References ipo_function::GradientEstimate::functionGradient, ipo_function::detail::FunctionBase::getSize(), and upperBound.

gsl::matrix PhaseIFunctionAndDerivatives::hessian ( gsl::vector const &  vector)
virtual

The function operator: returns the Hessian.

Parameters
vectorA vector argument
Returns
The Hessian

Reimplemented from ipo_function::Function.

Definition at line 87 of file PhaseIFunctionAndDerivatives.cc.

References ipo_function::DerivativesEstimates::functionHessian, ipo_function::detail::FunctionBase::getSize(), ipo_function::Function::h, upperBound, and ipo_function::GradientEstimate::value().

double PhaseIFunctionAndDerivatives::operator() ( gsl::vector const &  vector)
virtual

The function operator: computes $f(x)-s-b$ or $-f(x)-s-b$ according as $b$ is an upper or lower bound.

Parameters
vectorA vector argument
Returns
The phase I function.

Implements ipo_function::Function.

Definition at line 39 of file PhaseIFunctionAndDerivatives.cc.

References b, ipo_function::detail::FunctionBase::getSize(), and upperBound.

void PhaseIFunctionAndDerivatives::setVector ( gsl::vector const &  vector)
virtual

Member Data Documentation

double const ipo_function::detail::PhaseIFunctionAndDerivatives::b
private

The bound.

Definition at line 83 of file PhaseIFunctionAndDerivatives.hpp.

Referenced by operator()(), and setVector().

Function& ipo_function::detail::PhaseIFunctionAndDerivatives::function
private

The function.

Definition at line 79 of file PhaseIFunctionAndDerivatives.hpp.

Referenced by setVector().

bool const ipo_function::detail::PhaseIFunctionAndDerivatives::upperBound
private

A boolean value: true or false according as b is an upper bound or lower.

Definition at line 88 of file PhaseIFunctionAndDerivatives.hpp.

Referenced by gradient(), hessian(), operator()(), and setVector().


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