10 #ifndef ROL_GOLDENSECTION_H
11 #define ROL_GOLDENSECTION_H
27 ROL::Ptr<LineSearch<Real> >
btls_;
36 tol_ = parlist.sublist(
"Step").sublist(
"Line Search").sublist(
"Line-Search Method").get(
"Bracketing Tolerance",oem8);
37 btls_ = ROL::makePtr<BackTracking<Real>>(parlist);
44 btls_->initialize(x,s,g,obj,con);
47 void run( Real &alpha, Real &fval,
int &ls_neval,
int &ls_ngrad,
50 Real tol = std::sqrt(ROL_EPSILON<Real>()),
zero(0), one(1), two(2), five(5);
57 Real c = two/(one+sqrt(five));
71 if ( val_tr < val_tl ) {
72 if (
LineSearch<Real>::status(
LINESEARCH_GOLDENSECTION,ls_neval,ls_ngrad,tr,fval,gs,val_tr,x,s,obj,con) ) {
82 if ( val_tl < val_tr ) {
92 Real tc1 = c*tl + (one-c)*tr;
99 Real tc2 = (one-c)*tl + c*tr;
106 if ( val_tl <= val_tc1 && val_tl <= val_tc2 && val_tl <= val_tr ) {
110 else if ( val_tc1 <= val_tl && val_tc1 <= val_tc2 && val_tc1 <= val_tr ) {
114 else if ( val_tc2 <= val_tl && val_tc2 <= val_tc1 && val_tc2 <= val_tr ) {
123 while ( !
LineSearch<Real>::status(
LINESEARCH_GOLDENSECTION,ls_neval,ls_ngrad,t,fval,gs,val_t,x,s,obj,con)
124 && (std::abs(tl-tr) >=
tol_) ) {
125 if ( val_tc1 > val_tc2 ) {
131 tc2 = (one-c)*tl + c*tr;
143 tc1 = c*tl + (one-c)*tr;
150 if ( val_tl <= val_tc1 && val_tl <= val_tc2 && val_tl <= val_tr ) {
154 else if ( val_tc1 <= val_tl && val_tc1 <= val_tc2 && val_tc1 <= val_tr ) {
158 else if ( val_tc2 <= val_tl && val_tc2 <= val_tc1 && val_tc2 <= val_tr ) {
170 if ( alpha < ROL_EPSILON<Real>() ) {
171 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.
virtual void update(const Vector< Real > &x, UpdateType type, int iter=-1)
Update objective function.
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 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)