ROL
ROL_PathBasedTargetLevel.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Rapid Optimization Library (ROL) Package
4 //
5 // Copyright 2014 NTESS and the ROL contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef ROL_PATHBASEDTARGETLEVEL_H
11 #define ROL_PATHBASEDTARGETLEVEL_H
12 
17 #include "ROL_LineSearch.hpp"
18 
19 namespace ROL {
20 
21 template<class Real>
22 class PathBasedTargetLevel : public LineSearch<Real> {
23 private:
24  ROL::Ptr<Vector<Real> > xnew_;
25 
26  Real min_value_;
27  Real rec_value_;
28  Real target_;
29  Real delta_;
30  Real sigma_;
31  Real bound_;
32 
33 public:
34 
35  virtual ~PathBasedTargetLevel() {}
36 
37  // Constructor
38  PathBasedTargetLevel( ROL::ParameterList &parlist )
39  : LineSearch<Real>(parlist), min_value_(ROL::ROL_OVERFLOW<Real>()),
40  rec_value_(ROL::ROL_OVERFLOW<Real>()), target_(0.0), sigma_(0.0) {
41  Real p1(0.1), one(1);
42  delta_ = parlist.sublist("Step").sublist("Line Search").sublist("Line-Search Method").sublist("Path-Based Target Level").get("Target Relaxation Parameter",p1);
43  bound_ = parlist.sublist("Step").sublist("Line Search").sublist("Line-Search Method").sublist("Path-Based Target Level").get("Upper Bound on Path Length",one);
44  }
45 
46  void initialize(const Vector<Real> &x, const Vector<Real> &s, const Vector<Real> &g,
48  LineSearch<Real>::initialize(x,s,g,obj,con);
49  xnew_ = x.clone();
50  }
51 
52  // Run Iteration scaled line search
53  void run( Real &alpha, Real &fval, int &ls_neval, int &ls_ngrad,
54  const Real &gs, const Vector<Real> &s, const Vector<Real> &x,
56  Real tol = std::sqrt(ROL_EPSILON<Real>()), zero(0), half(0.5);
57  ls_neval = 0;
58  ls_ngrad = 0;
59  // Update target objective value
60  if ( fval < min_value_ ) {
61  min_value_ = fval;
62  }
63  target_ = rec_value_ - half*delta_;
64  if ( fval < target_ ) {
66  sigma_ = zero;
67  }
68  else {
69  if ( sigma_ > bound_ ) {
71  sigma_ = zero;
72  delta_ *= half;
73  }
74  }
76  // Get line-search parameter
77  alpha = (fval - target_)/std::abs(gs);
78  // Update iterate
79  LineSearch<Real>::updateIterate(*xnew_,x,s,alpha,con);
80  // Compute objective function value
81  obj.update(*xnew_);
82  fval = obj.value(*xnew_,tol);
83  ls_neval++;
84  // Update sigma
85  sigma_ += alpha*std::sqrt(std::abs(gs));
86  }
87 };
88 
89 }
90 
91 #endif
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 ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
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)
ROL::Ptr< Vector< Real > > xnew_
virtual Real value(const Vector< Real > &x, Real &tol)=0
Compute value.
Defines the linear algebra or vector space interface.
Definition: ROL_Vector.hpp:46
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.
Provides an implementation of path-based target leve line search.
Real ROL_OVERFLOW(void)
Platform-dependent maximum double.
Definition: ROL_Types.hpp:68
Provides the interface to apply upper and lower bound constraints.
PathBasedTargetLevel(ROL::ParameterList &parlist)
virtual void initialize(const Vector< Real > &x, const Vector< Real > &s, const Vector< Real > &g, Objective< Real > &obj, BoundConstraint< Real > &con)
void initialize(const Vector< Real > &x, const Vector< Real > &s, const Vector< Real > &g, Objective< Real > &obj, BoundConstraint< Real > &con)