44 #ifndef ROL_GOLDENSECTION_H
45 #define ROL_GOLDENSECTION_H
61 ROL::Ptr<LineSearch<Real> >
btls_;
70 tol_ = parlist.sublist(
"Step").sublist(
"Line Search").sublist(
"Line-Search Method").get(
"Bracketing Tolerance",oem8);
71 btls_ = ROL::makePtr<BackTracking<Real>>(parlist);
78 btls_->initialize(x,s,g,obj,con);
81 void run( Real &alpha, Real &fval,
int &ls_neval,
int &ls_ngrad,
84 Real tol = std::sqrt(ROL_EPSILON<Real>()),
zero(0), one(1), two(2), five(5);
91 Real c = two/(one+sqrt(five));
105 if ( val_tr < val_tl ) {
106 if (
LineSearch<Real>::status(
LINESEARCH_GOLDENSECTION,ls_neval,ls_ngrad,tr,fval,gs,val_tr,x,s,obj,con) ) {
116 if ( val_tl < val_tr ) {
126 Real tc1 = c*tl + (one-c)*tr;
133 Real tc2 = (one-c)*tl + c*tr;
140 if ( val_tl <= val_tc1 && val_tl <= val_tc2 && val_tl <= val_tr ) {
144 else if ( val_tc1 <= val_tl && val_tc1 <= val_tc2 && val_tc1 <= val_tr ) {
148 else if ( val_tc2 <= val_tl && val_tc2 <= val_tc1 && val_tc2 <= val_tr ) {
157 while ( !
LineSearch<Real>::status(
LINESEARCH_GOLDENSECTION,ls_neval,ls_ngrad,t,fval,gs,val_t,x,s,obj,con)
158 && (std::abs(tl-tr) >=
tol_) ) {
159 if ( val_tc1 > val_tc2 ) {
165 tc2 = (one-c)*tl + c*tr;
177 tc1 = c*tl + (one-c)*tr;
184 if ( val_tl <= val_tc1 && val_tl <= val_tc2 && val_tl <= val_tr ) {
188 else if ( val_tc1 <= val_tl && val_tc1 <= val_tc2 && val_tc1 <= val_tr ) {
192 else if ( val_tc2 <= val_tl && val_tc2 <= val_tc1 && val_tc2 <= val_tr ) {
204 if ( alpha < ROL_EPSILON<Real>() ) {
205 btls_->run(alpha,fval,ls_neval,ls_ngrad,gs,s,x,obj,con);
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.
void initialize(const Vector< Real > &x, const Vector< Real > &s, const Vector< Real > &g, Objective< Real > &obj, BoundConstraint< Real > &con)
ROL::Ptr< LineSearch< Real > > btls_
ROL::Ptr< Vector< Real > > xnew_
Implements a golden section line search.
virtual Real value(const Vector< Real > &x, Real &tol)=0
Compute value.
Defines the linear algebra or vector space interface.
Objective_SerialSimOpt(const Ptr< Obj > &obj, const V &ui) z0_ zero()
Provides interface for and implements line searches.
GoldenSection(ROL::ParameterList &parlist)
Provides the interface to apply upper and lower bound constraints.
virtual void update(const Vector< Real > &x, bool flag=true, int iter=-1)
Update objective function.
virtual void initialize(const Vector< Real > &x, const Vector< Real > &s, const Vector< Real > &g, Objective< Real > &obj, BoundConstraint< Real > &con)
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)