2 #include <boost/math/tools/roots.hpp> 10 if (numParameters > 1)
11 throw itk::ExceptionObject(__FILE__, __LINE__,
"Bracket and solve root algorithm does not implement multi-dimensional optimization. Only one parameter allowed.");
14 throw itk::ExceptionObject(__FILE__, __LINE__,
"You need to provide the function value in at least one of the bounds because the bracket and solve root algorithm needs to know whether the function is rising or falling.");
24 bool risingValue =
true;
31 std::pair <double,double> r = boost::math::tools::bracket_and_solve_root(boostFunction, (this->
GetLowerBound() + this->
GetUpperBound()) / 2.0, 2.0, risingValue, rootTolerance, maximumNumberOfIterations);
33 return (r.first + r.second) / 2.0;
double GetFunctionValueAtInitialLowerBound()
double Optimize() ITK_OVERRIDE
bool GetProvidedFunctionValueAtInitialLowerBound()
void SetRootFindingFunction(BaseCostFunctionType *f)
double GetRootRelativeTolerance()
void SetRootRelativeTolerance(const double &tol)
bool GetProvidedFunctionValueAtInitialUpperBound()
unsigned int GetMaximumNumberOfIterations()
double GetFunctionValueAtInitialUpperBound()
BaseCostFunctionType * GetRootFindingFunction()