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

Line search parameters. More...

#include <LineSearch.hpp>

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

Public Member Functions

 Parameters (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 some default parameters. More...
 
void setAlpha (double alpha)
 Set the value of alpha. More...
 
void setBeta (double beta)
 Set the value of beta. More...
 
void setEpsilon (double epsilon)
 Set the value of epsilon. More...
 
void setMaxNoImproveSteps (size_t maxNoImproveSteps)
 Set the value of maxNoImproveSteps. More...
 
double getAlpha () const
 Get the value of alpha. More...
 
double getBeta () const
 Get the value of beta. More...
 
double getEpsilon () const
 Get the value of epsilon. More...
 
size_t getMaxNoImproveSteps () const
 Get the value of maxNoImproveSteps. More...
 
void setVectorDigits (size_t const vectorDigits)
 Set the number of significant digits of entries of vector to show in each step. More...
 
size_t getVectorDigits () const
 Get the value of vectorDigits. More...
 
void setOutputStream (std::ostream *outputStream)
 Set outputStream. More...
 
std::ostream * getOutputStream () const
 Get the current value of outputStream. More...
 

Private Attributes

double alpha
 A value in (0,0.5): usually quite small 0.0001–0.3 (default 1e-3 though 1e-4 is suggested in Dennis and Schnabel Numerical Mehods for Unconstrained Optimization and Nonlinear Equations, SIAM, 1996, Chapter 6). More...
 
double beta
 A value in (0,1): usually quite big (0.1–0.8). More...
 
double epsilon
 A value for forward difference gradient estimates. More...
 
size_t maxNoImproveSteps
 Maximum number of nonimproving steps (default is 10). More...
 
size_t vectorDigits
 If this value is set to zero and outputStream is not null then vector arguments are not shown (more useful if the argument is large). More...
 
std::ostream * outputStream
 A stream (default is nullptr) for sending output to. More...
 

Detailed Description

Line search parameters.

These control how line search works in detail and whether and where any output is produced.

Definition at line 42 of file LineSearch.hpp.

Constructor & Destructor Documentation

LineSearch::Parameters::Parameters ( 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 some default parameters.

Parameters
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 28 of file LineSearch.cc.

References setAlpha(), setBeta(), setEpsilon(), setMaxNoImproveSteps(), setOutputStream(), and setVectorDigits().

Member Function Documentation

double LineSearch::Parameters::getAlpha ( ) const

Get the value of alpha.

Returns
alpha

Definition at line 67 of file LineSearch.cc.

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

double LineSearch::Parameters::getBeta ( ) const

Get the value of beta.

Returns
beta

Definition at line 72 of file LineSearch.cc.

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

double LineSearch::Parameters::getEpsilon ( ) const

Get the value of epsilon.

Returns
epsilon

Definition at line 77 of file LineSearch.cc.

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

size_t LineSearch::Parameters::getMaxNoImproveSteps ( ) const

Get the value of maxNoImproveSteps.

Returns
maxNoImproveSteps

Definition at line 218 of file LineSearch.cc.

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

std::ostream* ipo::detail::LineSearch::Parameters::getOutputStream ( ) const
inline

Get the current value of outputStream.

Returns
The current value of outputStream

Definition at line 121 of file LineSearch.hpp.

References outputStream.

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

size_t ipo::detail::LineSearch::Parameters::getVectorDigits ( ) const
inline

Get the value of vectorDigits.

See also
setVectorDigits
Returns
The value of vectorDigits

Definition at line 110 of file LineSearch.hpp.

References vectorDigits.

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

void LineSearch::Parameters::setAlpha ( double  alpha)

Set the value of alpha.

Parameters
alphaThe new value

Definition at line 47 of file LineSearch.cc.

References alpha.

Referenced by Parameters().

void LineSearch::Parameters::setBeta ( double  beta)

Set the value of beta.

Parameters
betaThe new value

Definition at line 54 of file LineSearch.cc.

Referenced by Parameters().

void LineSearch::Parameters::setEpsilon ( double  epsilon)

Set the value of epsilon.

Parameters
epsilonThe new value

Definition at line 61 of file LineSearch.cc.

Referenced by Parameters().

void LineSearch::Parameters::setMaxNoImproveSteps ( size_t  maxNoImproveSteps)

Set the value of maxNoImproveSteps.

Parameters
maxNoImproveStepsThe new value

Definition at line 213 of file LineSearch.cc.

Referenced by Parameters().

void ipo::detail::LineSearch::Parameters::setOutputStream ( std::ostream *  outputStream)
inline

Set outputStream.

Set this to point to an output stream to record progress.

Parameters
outputStreamThe new value

Definition at line 115 of file LineSearch.hpp.

References outputStream.

Referenced by Parameters().

void ipo::detail::LineSearch::Parameters::setVectorDigits ( size_t const  vectorDigits)
inline

Set the number of significant digits of entries of vector to show in each step.

If this is set to zero or outputStream is null then no vector output is shown.

Parameters
vectorDigitsThe new value for vector significant digits

Definition at line 103 of file LineSearch.hpp.

References vectorDigits.

Referenced by Parameters().

Member Data Documentation

double ipo::detail::LineSearch::Parameters::alpha
private

A value in (0,0.5): usually quite small 0.0001–0.3 (default 1e-3 though 1e-4 is suggested in Dennis and Schnabel Numerical Mehods for Unconstrained Optimization and Nonlinear Equations, SIAM, 1996, Chapter 6).

For further details, see Boyd and Vandenberghe, Convex Optimization, Cambridge University Press, 2004.

Definition at line 132 of file LineSearch.hpp.

Referenced by setAlpha().

double ipo::detail::LineSearch::Parameters::beta
private

A value in (0,1): usually quite big (0.1–0.8).

The default is 0.8, which corresponds to a crude search.

For further details, see Boyd and Vandenberghe, Convex Optimization, Cambridge University Press, 2004.

Definition at line 140 of file LineSearch.hpp.

double ipo::detail::LineSearch::Parameters::epsilon
private

A value for forward difference gradient estimates.

This is only used if the gradient() or hessian() function is not supplied. Then the linesearch needs to estimate a gradient and uses epsilon. The default value is machine epsilon. Typically this should not be changed and ideally gradient approximations should be avoided.

Definition at line 148 of file LineSearch.hpp.

size_t ipo::detail::LineSearch::Parameters::maxNoImproveSteps
private

Maximum number of nonimproving steps (default is 10).

Definition at line 152 of file LineSearch.hpp.

std::ostream* ipo::detail::LineSearch::Parameters::outputStream
private

A stream (default is nullptr) for sending output to.

If this is set then the value of the objective function at each step of the backtracking line search algorithm is shown, together with the vector at which the objective obtains this value if vectorDigits is set to a positive value.

Note that NaN (nan or not-a-number) values may appear on the output because the initial Newton step may be large enough to produce an infeasible vector. The line search continues to reduce the step size until it finds a feasible one.

Definition at line 169 of file LineSearch.hpp.

Referenced by getOutputStream(), and setOutputStream().

size_t ipo::detail::LineSearch::Parameters::vectorDigits
private

If this value is set to zero and outputStream is not null then vector arguments are not shown (more useful if the argument is large).

Otherwise this value determines the number of significant digits that are shown with each vector entry.

Definition at line 158 of file LineSearch.hpp.

Referenced by getVectorDigits(), and setVectorDigits().


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