Interior-point-optimisation  1.0-1
Interior-pointoptimisationlibrary
ipo::detail::LineSearch Class Reference

Backtracking line search. More...

#include <LineSearch.hpp>

Collaboration diagram for ipo::detail::LineSearch:
Collaboration graph

Classes

class  Parameters
 Line search parameters. More...
 

Public Member Functions

 LineSearch (ipo_function::Function &function, double const alpha=1e-3, double const beta=0.8, double const epsilon=std::sqrt(std::numeric_limits< double >::epsilon()), size_t const maxNoImproveSteps=10)
 Set up the line search function object with a function and some default parameters. More...
 
double operator() (gsl::vector &vector, gsl::vector const direction, double const functionValue=-std::numeric_limits< double >::infinity(), gsl::vector const gradientValue=gsl::vector(nullptr))
 Carry out the line search. More...
 
void setFunctionScale (double const functionScale)
 Set the scaling factor for output of function values. More...
 
ParametersgetParameters ()
 Get parameters by reference. More...
 

Protected Attributes

ipo_function::Functionfunction
 The function. More...
 
double functionScale { 1.0 }
 Scaling factor for output of function values. More...
 

Private Attributes

Parameters parameters
 

Detailed Description

Backtracking line search.

This class defines function objects to carry out backtracking line search assuming a good step size and a nearly locally quadratic function.

Definition at line 36 of file LineSearch.hpp.

Constructor & Destructor Documentation

LineSearch::LineSearch ( ipo_function::Function function,
double const  alpha = 1e-3,
double const  beta = 0.8,
double const  epsilon = std::sqrt( std::numeric_limits<double>::epsilon() ),
size_t const  maxNoImproveSteps = 10 
)

Set up the line search function object with a function and some default parameters.

Parameters
functionThe function
alphaA value in (0,0.5)
betaA value in (0,1)
epsilonA value to be used if the gradient is not supplied in the function operator call
maxNoImproveStepsThe maximum number of backtracing steps to accept with no consecutive improvements

Definition at line 41 of file LineSearch.cc.

Member Function Documentation

LineSearch::Parameters & LineSearch::getParameters ( )

Get parameters by reference.

Returns
parameters

Definition at line 39 of file LineSearch.cc.

References parameters.

Referenced by ipo::detail::NewtonDescent::getLineSearchParameters().

double LineSearch::operator() ( gsl::vector &  vector,
gsl::vector const  direction,
double const  functionValue = -std::numeric_limits<double>::infinity(),
gsl::vector const  gradientValue = gsl::vector( nullptr ) 
)

Carry out the line search.

Note that if values are supplied for function and gradient, they are not checked.

Parameters
vectorThe vector: on return this is the updated value.
directionThe direction of search
functionValueThe function evaluated at vector: if no value is supplied a value is computed
gradientValueThe gradient evaluated at vector: if no value is supplied a forward difference estimate is computed
Returns
The multiple of direction that can be added to vector for an improving step

Definition at line 82 of file LineSearch.cc.

References functionScale, ipo::detail::LineSearch::Parameters::getAlpha(), ipo::detail::LineSearch::Parameters::getBeta(), ipo::detail::LineSearch::Parameters::getEpsilon(), ipo::detail::LineSearch::Parameters::getMaxNoImproveSteps(), ipo::detail::LineSearch::Parameters::getOutputStream(), ipo::detail::LineSearch::Parameters::getVectorDigits(), ipo_function::GradientEstimate::gradient(), ipo::format::infinity, parameters, and ipo_function::detail::ForwardDifferenceGradientEstimate::setVector().

void ipo::detail::LineSearch::setFunctionScale ( double const  functionScale)
inline

Set the scaling factor for output of function values.

This is used in InteriorPoint to show the value of the original function.

Parameters
functionScaleThe new value

Definition at line 209 of file LineSearch.hpp.

References functionScale.

Referenced by ipo::detail::NewtonDescent::operator()().

Member Data Documentation

ipo_function::Function& ipo::detail::LineSearch::function
protected

The function.

Definition at line 220 of file LineSearch.hpp.

double ipo::detail::LineSearch::functionScale { 1.0 }
protected

Scaling factor for output of function values.

Definition at line 224 of file LineSearch.hpp.

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

Parameters ipo::detail::LineSearch::parameters
private

Definition at line 172 of file LineSearch.hpp.

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


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