44 #ifndef ROL_CUBICINTERP_H
45 #define ROL_CUBICINTERP_H
68 rho_ = parlist.sublist(
"Step").sublist(
"Line Search").sublist(
"Line-Search Method").get(
"Backtracking Rate",half);
77 void run( Real &alpha, Real &fval,
int &ls_neval,
int &ls_ngrad,
80 Real tol = std::sqrt(ROL_EPSILON<Real>());
93 Real fvalp(0), alpha1(0), alpha2(0), a(0), b(0), x1(0), x2(0);
94 const Real one(1), two(2), three(3), half(0.5), p1(0.1);
95 bool first_iter =
true;
97 while ( !
LineSearch<Real>::status(
LINESEARCH_CUBICINTERP,ls_neval,ls_ngrad,alpha,fold,gs,fval,x,s,obj,con) ) {
99 alpha1 = -gs*alpha*alpha/(two*(fval-fold-gs*alpha));
103 x1 = fval-fold-alpha*gs;
104 x2 = fvalp-fval-alpha2*gs;
105 a = (one/(alpha - alpha2))*( x1/(alpha*alpha) - x2/(alpha2*alpha2));
106 b = (one/(alpha - alpha2))*(-x1*alpha2/(alpha*alpha) + x2*alpha/(alpha2*alpha2));
107 if ( std::abs(a) < ROL_EPSILON<Real>() ) {
108 alpha1 = -gs/(two*b);
111 alpha1 = (-b+sqrt(b*b-three*a*gs))/(three*a);
113 if ( alpha1 > half*alpha ) {
120 if ( alpha1 <= p1*alpha ) {
123 else if ( alpha1 >= half*alpha ) {
Provides the interface to evaluate objective functions.
void updateIterate(Vector< Real > &xnew, const Vector< Real > &x, const Vector< Real > &s, Real alpha, BoundConstraint< Real > &con)
virtual Real getInitialAlpha(int &ls_neval, int &ls_ngrad, const Real fval, const Real gs, const Vector< Real > &x, const Vector< Real > &s, Objective< Real > &obj, BoundConstraint< Real > &con)
virtual ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
virtual Real value(const Vector< Real > &x, Real &tol)=0
Compute value.
void initialize(const Vector< Real > &x, const Vector< Real > &s, const Vector< Real > &g, Objective< Real > &obj, BoundConstraint< Real > &con)
CubicInterp(ROL::ParameterList &parlist)
Defines the linear algebra or vector space interface.
Provides interface for and implements line searches.
Implements cubic interpolation back tracking line search.
Provides the interface to apply upper and lower bound constraints.
void run(Real &alpha, Real &fval, int &ls_neval, int &ls_ngrad, const Real &gs, const Vector< Real > &s, const Vector< Real > &x, Objective< Real > &obj, BoundConstraint< Real > &con)
virtual void update(const Vector< Real > &x, bool flag=true, int iter=-1)
Update objective function.
ROL::Ptr< Vector< Real > > xnew_
virtual void initialize(const Vector< Real > &x, const Vector< Real > &s, const Vector< Real > &g, Objective< Real > &obj, BoundConstraint< Real > &con)