44 #ifndef GLOBIPACK_BRENTS_LINE_SEARCH_DEF_HPP
45 #define GLOBIPACK_BRENTS_LINE_SEARCH_DEF_HPP
48 #include "GlobiPack_BrentsLineSearch_decl.hpp"
49 #include "Teuchos_TabularOutputter.hpp"
58 template<
typename Scalar>
63 template<
typename Scalar>
71 template<
typename Scalar>
82 template<
class Scalar>
88 namespace BLSU = BrentsLineSearchUtils;
89 using Teuchos::sublist;
91 bracket_.setParameterList(sublist(paramList, BLSU::bracket_name,
true));
92 brentsMin_.setParameterList(sublist(paramList, BLSU::minimize_name,
true));
93 setMyParamList(paramList);
97 template<
class Scalar>
101 namespace BLSU = BrentsLineSearchUtils;
107 *bracket_.getValidParameters()
108 ).disableRecursiveValidation();
110 *brentsMin_.getValidParameters()
111 ).disableRecursiveValidation();
121 template<
typename Scalar>
128 template<
typename Scalar>
135 template<
typename Scalar>
146 using Teuchos::outArg;
147 using Teuchos::inOutArg;
163 bracket_.setOStream(out);
164 brentsMin_.setOStream(out);
166 *out <<
"\nStarting bracketing and brents 1D minimization linesearch ...\n";
170 int totalNumIters = 0;
180 int numBracketIters = -1;
182 const bool bracketSuccess = bracket_.bracketMinimum(
183 phi, inOutArg(p_l), inOutArg(p_m), outArg(p_u), outArg(numBracketIters) );
185 if (!bracketSuccess) success =
false;
187 totalNumIters += numBracketIters;
191 if (bracketSuccess) {
193 int numBrentsIters = -1;
195 const bool brentsSuccess = brentsMin_.approxMinimize(
196 phi, p_l, inOutArg(p_m), p_u, outArg(numBrentsIters) );
198 if (!brentsSuccess) success =
false;
200 totalNumIters += numBrentsIters;
207 *numIters = totalNumIters;
217 #endif // GLOBIPACK_BRENTS_LINE_SEARCH_DEF_HPP
virtual bool requiresBaseDeriv() const
Returns true.
Scalar phi
The value of the merit function phi(alpha).
void setParameterList(RCP< ParameterList > const ¶mList)
bool is_null(const boost::shared_ptr< T > &p)
Scalar Dphi
The value of the derivative of the merit function Dphi(alpha).
basic_OSTab< char > OSTab
Simple concrete class that implements a 1D algorithm to mimimize a 1D function.
Simple concrete class that implements a 1D algorithm to bracket the minimum of a 1D merit function...
virtual bool doLineSearch(const MeritFunc1DBase< Scalar > &phi, const PointEval1D< Scalar > &point_k, const Ptr< PointEval1D< Scalar > > &point_kp1, const Ptr< int > &numIters) const
const Brents1DMinimization< Scalar > & brentsMin() const
For unit testing only .
#define TEUCHOS_ASSERT_INEQUALITY(val1, comp, val2)
Scalar alpha
The value of the unknown alpha.
Represents the evaluation point of the merit function phi(alpha) and/or is derivative Dphi(alpha)...
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
void validateParametersAndSetDefaults(ParameterList const &validParamList, int const depth=1000)
ParameterList & setParameters(const ParameterList &source)
const GoldenQuadInterpBracket< Scalar > & bracket() const
For unit testing only .
TypeTo as(const TypeFrom &t)
Base class for 1D merit fucntions used in globalization methods.
ParameterList & sublist(const std::string &name, bool mustAlreadyExist=false, const std::string &docString="")
RCP< const ParameterList > getValidParameters() const
virtual bool requiresDerivEvals() const
Returns false.
#define TEUCHOS_ASSERT(assertion_test)
#define TEUCHOS_ASSERT_EQUALITY(val1, val2)
BrentsLineSearch()
Construct with default parameters.