30 Size maxStationaryStateIterations,
33 Real gradientNormEpsilon)
34 : maxIterations_(maxIterations),
35 maxStationaryStateIterations_(maxStationaryStateIterations),
36 rootEpsilon_(rootEpsilon),
37 functionEpsilon_(functionEpsilon),
38 gradientNormEpsilon_(gradientNormEpsilon) {
42 static_cast<Size>(100));
44 "maxStationaryStateIterations_ (" <<
46 ") must be greater than one");
48 "maxStationaryStateIterations_ (" <<
50 ") must be less than maxIterations_ (" <<
66 Size& statStateIterations,
69 statStateIterations = 0;
72 ++statStateIterations;
82 Size& statStateIterations,
85 statStateIterations = 0;
88 ++statStateIterations;
97 const bool positiveOptimization,
99 if (!positiveOptimization)
126 Size& statStateIterations,
127 const bool positiveOptimization,
164 return out <<
"None";
166 return out <<
"MaxIterations";
168 return out <<
"StationaryPoint";
170 return out <<
"StationaryFunctionValue";
172 return out <<
"StationaryFunctionAccuracy";
174 return out <<
"ZeroGradientNorm";
176 return out <<
"Unknown";
bool operator()(Size iteration, Size &statState, bool positiveOptimization, Real fold, Real normgold, Real fnew, Real normgnew, EndCriteria::Type &ecType) const
@ StationaryFunctionValue
@ StationaryFunctionAccuracy
bool checkStationaryFunctionAccuracy(Real f, bool positiveOptimization, EndCriteria::Type &ecType) const
Real gradientNormEpsilon() const
bool checkZeroGradientNorm(Real gNorm, EndCriteria::Type &ecType) const
Real functionEpsilon() const
bool checkStationaryPoint(Real xOld, Real xNew, Size &statStateIterations, EndCriteria::Type &ecType) const
EndCriteria(Size maxIterations, Size maxStationaryStateIterations, Real rootEpsilon, Real functionEpsilon, Real gradientNormEpsilon)
Initialization constructor.
Size maxIterations() const
Size maxStationaryStateIterations_
Maximun number of iterations in stationary state.
bool checkStationaryFunctionValue(Real fxOld, Real fxNew, Size &statStateIterations, EndCriteria::Type &ecType) const
Real rootEpsilon_
root, function and gradient epsilons
Size maxStationaryStateIterations() const
Real gradientNormEpsilon_
Size maxIterations_
Maximum number of iterations.
bool checkMaxIterations(Size iteration, EndCriteria::Type &ecType) const
template class providing a null value for a given type.
Optimization criteria class.
Classes and functions for error handling.
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
#define QL_FAIL(message)
throw an error (possibly with file and line information)
QL_INTEGER Integer
integer number
std::size_t Size
size of a container
std::ostream & operator<<(std::ostream &out, GFunctionFactory::YieldCurveModel type)