45 #include "GlobiPack_TestLagrPolyMeritFunc1D.hpp"
46 #include "GlobiPack_BrentsLineSearch.hpp"
63 using GlobiPack::brentsLineSearch;
64 using GlobiPack::computeValue;
66 using Teuchos::inOutArg;
67 using Teuchos::outArg;
70 using Teuchos::rcpFromRef;
74 using Teuchos::parameterList;
77 double g_tol_scale = 100.0;
83 "tol", &g_tol_scale,
"Floating point tolerance scaling of eps." );
101 typedef typename ST::magnitudeType ScalarMag;
103 const RCP<TestLagrPolyMeritFunc1D<Scalar> > phi = quadPhi<Scalar>();
105 RCP<BrentsLineSearch<Scalar> > linesearch = brentsLineSearch<Scalar>();
107 linesearch->setOStream(rcpFromRef(out));
109 const PointEval1D<Scalar> point_k =
computePoint(*phi, ST::zero());
110 PointEval1D<Scalar> point_kp1 =
computePoint(*phi, as<Scalar>(8.0));
113 const bool linesearchResult = linesearch->doLineSearch(
114 *phi, point_k, inOutArg(point_kp1), outArg(numIters) );
118 as<Scalar>(g_tol_scale*ST::squareroot(ST::eps())));
120 as<Scalar>(g_tol_scale)*ST::eps());
131 TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL( BrentsLineSearch, cubicApprox, Scalar )
135 typedef typename ST::magnitudeType ScalarMag;
137 const RCP<TestLagrPolyMeritFunc1D<Scalar> > phi = quadPhi<Scalar>();
139 RCP<BrentsLineSearch<Scalar> > linesearch = brentsLineSearch<Scalar>();
141 const RCP<ParameterList> pl = parameterList();
142 pl->sublist(
"Minimize").set(
"Relative Tol", as<double>(g_tol_scale*ST::eps()));
143 pl->sublist(
"Minimize").set(
"Bracket Tol", as<double>(ST::eps()));
144 linesearch->setParameterList(pl);
146 linesearch->setOStream(rcpFromRef(out));
148 const PointEval1D<Scalar> point_k =
computePoint(*phi, ST::zero());
149 PointEval1D<Scalar> point_kp1 =
computePoint(*phi, as<Scalar>(8.0));
152 const bool linesearchResult = linesearch->doLineSearch(
153 *phi, point_k, inOutArg(point_kp1), outArg(numIters) );
157 as<Scalar>(g_tol_scale*ST::squareroot(ST::eps())));
159 as<Scalar>(g_tol_scale)*ST::eps());
TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL(Teuchos_Conditions, NumberConditionSerialization, T)
static CommandLineProcessor & getCLP()
void setOption(const char option_true[], const char option_false[], bool *option_val, const char documentation[]=NULL)
PointEval1D< Scalar > computePoint(const MeritFunc1DBase< Scalar > &phi, const Scalar &alpha, const bool compute_phi=true, const bool compute_Dphi=false)
Compute a point as an object.
Linesearch subclass implementing a function-value-only approximate minimization algorithm using brack...
TypeTo as(const TypeFrom &t)
#define TEST_FLOATING_EQUALITY(v1, v2, tol)
TEST_ASSERT(castedDep1->getValuesAndValidators().size()==2)
#define TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT_REAL_SCALAR_TYPES(TEST_GROUP, TEST_NAME)