26#ifndef quantlib_optimization_criteria_hpp
27#define quantlib_optimization_criteria_hpp
48 StationaryFunctionValue,
49 StationaryFunctionAccuracy,
55 EndCriteria(
size_t maxIterations,
size_t maxStationaryStateIterations,
56 RealType rootEpsilon, RealType functionEpsilon,
57 RealType gradientNormEpsilon);
60 size_t maxIterations()
const;
61 size_t maxStationaryStateIterations()
const;
62 RealType rootEpsilon()
const;
63 RealType functionEpsilon()
const;
64 RealType gradientNormEpsilon()
const;
68 bool operator()(
const size_t iteration,
size_t& statState,
69 const bool positiveOptimization,
const RealType fold,
70 const RealType normgold,
const RealType fnew,
71 const RealType normgnew, EndCriteria::Type& ecType)
const;
75 EndCriteria::Type& ecType)
const;
78 size_t& statStateIterations,
79 EndCriteria::Type& ecType)
const;
83 size_t& statStateIterations,
84 EndCriteria::Type& ecType)
const;
87 const bool positiveOptimization,
88 EndCriteria::Type& ecType)
const;
91 EndCriteria::Type& ecType)
const;
102 std::ostream& operator<<(std::ostream& out, EndCriteria::Type ecType);
Criteria to end optimization process:
bool checkStationaryPoint(const RealType xOld, const RealType xNew, size_t &statStateIterations, EndCriteria::Type &ecType) const
Test if the root variation is below rootEpsilon.
RealType rootEpsilon_
root, function and gradient epsilons
bool checkStationaryFunctionAccuracy(const RealType f, const bool positiveOptimization, EndCriteria::Type &ecType) const
Test if the function value is below functionEpsilon.
bool operator()(const size_t iteration, size_t &statState, const bool positiveOptimization, const RealType fold, const RealType normgold, const RealType fnew, const RealType normgnew, EndCriteria::Type &ecType) const
Test if the number of iterations is not too big and if a minimum point is not reached.
size_t maxStationaryStateIterations_
Maximun number of iterations in stationary state.
bool checkStationaryFunctionValue(const RealType fxOld, const RealType fxNew, size_t &statStateIterations, EndCriteria::Type &ecType) const
Test if the function variation is below functionEpsilon.
bool checkZeroGradientNorm(const RealType gNorm, EndCriteria::Type &ecType) const
Test if the gradient norm value is below gradientNormEpsilon.
bool checkMaxIterations(const size_t iteration, EndCriteria::Type &ecType) const
Test if the number of iteration is below MaxIterations.
EndCriteria(size_t maxIterations, size_t maxStationaryStateIterations, RealType rootEpsilon, RealType functionEpsilon, RealType gradientNormEpsilon)
Initialization constructor.
size_t maxIterations_
Maximum number of iterations.