QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Attributes | List of all members
EndCriteria Class Reference

Criteria to end optimization process: More...

#include <ql/math/optimization/endcriteria.hpp>

+ Collaboration diagram for EndCriteria:

Public Types

enum  Type {
  None , MaxIterations , StationaryPoint , StationaryFunctionValue ,
  StationaryFunctionAccuracy , ZeroGradientNorm , Unknown
}
 

Public Member Functions

 EndCriteria (Size maxIterations, Size maxStationaryStateIterations, Real rootEpsilon, Real functionEpsilon, Real gradientNormEpsilon)
 Initialization constructor. More...
 
Size maxIterations () const
 
Size maxStationaryStateIterations () const
 
Real rootEpsilon () const
 
Real functionEpsilon () const
 
Real gradientNormEpsilon () const
 
bool operator() (Size iteration, Size &statState, bool positiveOptimization, Real fold, Real normgold, Real fnew, Real normgnew, EndCriteria::Type &ecType) const
 
bool checkMaxIterations (Size iteration, EndCriteria::Type &ecType) const
 
bool checkStationaryPoint (Real xOld, Real xNew, Size &statStateIterations, EndCriteria::Type &ecType) const
 
bool checkStationaryFunctionValue (Real fxOld, Real fxNew, Size &statStateIterations, EndCriteria::Type &ecType) const
 
bool checkStationaryFunctionAccuracy (Real f, bool positiveOptimization, EndCriteria::Type &ecType) const
 
bool checkZeroGradientNorm (Real gNorm, EndCriteria::Type &ecType) const
 

Protected Attributes

Size maxIterations_
 Maximum number of iterations. More...
 
Size maxStationaryStateIterations_
 Maximun number of iterations in stationary state. More...
 
Real rootEpsilon_
 root, function and gradient epsilons More...
 
Real functionEpsilon_
 
Real gradientNormEpsilon_
 

Detailed Description

Criteria to end optimization process:

Examples
BermudanSwaption.cpp, Gaussian1dModels.cpp, and GlobalOptimizer.cpp.

Definition at line 40 of file endcriteria.hpp.

Member Enumeration Documentation

◆ Type

enum Type
Enumerator
None 
MaxIterations 
StationaryPoint 
StationaryFunctionValue 
StationaryFunctionAccuracy 
ZeroGradientNorm 
Unknown 

Definition at line 42 of file endcriteria.hpp.

Constructor & Destructor Documentation

◆ EndCriteria()

EndCriteria ( Size  maxIterations,
Size  maxStationaryStateIterations,
Real  rootEpsilon,
Real  functionEpsilon,
Real  gradientNormEpsilon 
)

Initialization constructor.

Definition at line 29 of file endcriteria.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ maxIterations()

Size maxIterations ( ) const

Definition at line 141 of file endcriteria.cpp.

+ Here is the caller graph for this function:

◆ maxStationaryStateIterations()

Size maxStationaryStateIterations ( ) const

Definition at line 145 of file endcriteria.cpp.

+ Here is the caller graph for this function:

◆ rootEpsilon()

Real rootEpsilon ( ) const

Definition at line 149 of file endcriteria.cpp.

+ Here is the caller graph for this function:

◆ functionEpsilon()

Real functionEpsilon ( ) const

Definition at line 153 of file endcriteria.cpp.

+ Here is the caller graph for this function:

◆ gradientNormEpsilon()

Real gradientNormEpsilon ( ) const

Definition at line 157 of file endcriteria.cpp.

◆ operator()()

bool operator() ( Size  iteration,
Size statState,
bool  positiveOptimization,
Real  fold,
Real  normgold,
Real  fnew,
Real  normgnew,
EndCriteria::Type ecType 
) const

Test if the number of iterations is not too big and if a minimum point is not reached

Definition at line 125 of file endcriteria.cpp.

+ Here is the call graph for this function:

◆ checkMaxIterations()

bool checkMaxIterations ( Size  iteration,
EndCriteria::Type ecType 
) const

Test if the number of iteration is below MaxIterations

Definition at line 56 of file endcriteria.cpp.

+ Here is the caller graph for this function:

◆ checkStationaryPoint()

bool checkStationaryPoint ( Real  xOld,
Real  xNew,
Size statStateIterations,
EndCriteria::Type ecType 
) const

Test if the root variation is below rootEpsilon

Definition at line 64 of file endcriteria.cpp.

+ Here is the caller graph for this function:

◆ checkStationaryFunctionValue()

bool checkStationaryFunctionValue ( Real  fxOld,
Real  fxNew,
Size statStateIterations,
EndCriteria::Type ecType 
) const

Test if the function variation is below functionEpsilon

Definition at line 79 of file endcriteria.cpp.

+ Here is the caller graph for this function:

◆ checkStationaryFunctionAccuracy()

bool checkStationaryFunctionAccuracy ( Real  f,
bool  positiveOptimization,
EndCriteria::Type ecType 
) const

Test if the function value is below functionEpsilon

Definition at line 95 of file endcriteria.cpp.

+ Here is the caller graph for this function:

◆ checkZeroGradientNorm()

bool checkZeroGradientNorm ( Real  gNorm,
EndCriteria::Type ecType 
) const

Test if the gradient norm variation is below gradientNormEpsilon

Test if the gradient norm value is below gradientNormEpsilon

Definition at line 117 of file endcriteria.cpp.

+ Here is the caller graph for this function:

Member Data Documentation

◆ maxIterations_

Size maxIterations_
protected

Maximum number of iterations.

Definition at line 100 of file endcriteria.hpp.

◆ maxStationaryStateIterations_

Size maxStationaryStateIterations_
mutableprotected

Maximun number of iterations in stationary state.

Definition at line 102 of file endcriteria.hpp.

◆ rootEpsilon_

Real rootEpsilon_
protected

root, function and gradient epsilons

Definition at line 104 of file endcriteria.hpp.

◆ functionEpsilon_

Real functionEpsilon_
protected

Definition at line 104 of file endcriteria.hpp.

◆ gradientNormEpsilon_

Real gradientNormEpsilon_
protected

Definition at line 104 of file endcriteria.hpp.