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

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

#include <PhaseIBoundedVariableFunctionAndDerivatives.hpp>

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

Public Member Functions

 PhaseIBoundedVariableFunctionAndDerivatives (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.

This represents a variable with an upper or lower bound b. The function takes as an argument a vector of size 2 whose first element represents the variable $x$ and whose second represents the variable $s$ used in phase I. If the variable has bound $b$, the function is $x-s-b$ or $-x-s-b$ according as $b$ is an upper or lower bound.

The variable $x$ is not supplied, but should be assigned in a Constraint object. The extra cost of creating a vector of size 2 to supply as an argument to setVector() should normally be low in comparison to the cost of copying large vectors and matrices. And, if we passed a vector of all the variables of a PhaseIModel object as argument to setVector, we would have to copy a large vector and matrix. Hence, this class is designed for a reasonable compromise. It gives better efficiency for larger problems.

This class also computes derivatives.

Definition at line 47 of file PhaseIBoundedVariableFunctionAndDerivatives.hpp.

Constructor & Destructor Documentation

PhaseIBoundedVariableFunctionAndDerivatives::PhaseIBoundedVariableFunctionAndDerivatives ( double const  b,
bool const  upperBound 
)

Construct from a function and bound.

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

Definition at line 29 of file PhaseIBoundedVariableFunctionAndDerivatives.cc.

Member Function Documentation

gsl::vector PhaseIBoundedVariableFunctionAndDerivatives::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 55 of file PhaseIBoundedVariableFunctionAndDerivatives.cc.

References ipo_function::GradientEstimate::functionGradient.

gsl::matrix PhaseIBoundedVariableFunctionAndDerivatives::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 60 of file PhaseIBoundedVariableFunctionAndDerivatives.cc.

References ipo_function::DerivativesEstimates::functionHessian.

double PhaseIBoundedVariableFunctionAndDerivatives::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 43 of file PhaseIBoundedVariableFunctionAndDerivatives.cc.

References b, and upperBound.

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

Set a vector and compute function value, gradient and Hessian efficiently.

Parameters
vectorA vector argument

Implements ipo_function::GradientEstimate.

Definition at line 65 of file PhaseIBoundedVariableFunctionAndDerivatives.cc.

References b, ipo_function::GradientEstimate::functionValue, and upperBound.

Member Data Documentation

double const ipo_function::detail::PhaseIBoundedVariableFunctionAndDerivatives::b
private

The bound.

Definition at line 92 of file PhaseIBoundedVariableFunctionAndDerivatives.hpp.

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

Function& ipo_function::detail::PhaseIBoundedVariableFunctionAndDerivatives::function
private

The function.

Definition at line 88 of file PhaseIBoundedVariableFunctionAndDerivatives.hpp.

bool const ipo_function::detail::PhaseIBoundedVariableFunctionAndDerivatives::upperBound
private

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

Definition at line 97 of file PhaseIBoundedVariableFunctionAndDerivatives.hpp.

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


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