ROL
ROL_PathBasedTargetLevel_U.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_U_H
11 #define ROL_PATHBASEDTARGETLEVEL_U_H
12 
17 #include "ROL_LineSearch_U.hpp"
18 
19 namespace ROL {
20 
21 template<typename Real>
22 class PathBasedTargetLevel_U : public LineSearch_U<Real> {
23 private:
24  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  PathBasedTargetLevel_U( ParameterList &parlist )
36  : LineSearch_U<Real>(parlist),
37  min_value_(ROL_OVERFLOW<Real>()),
38  rec_value_(ROL_OVERFLOW<Real>()), target_(0.0), sigma_(0.0) {
39  Real p1(0.1), one(1);
40  delta_ = parlist.sublist("Step").sublist("Line Search").sublist("Line-Search Method").sublist("Path-Based Target Level").get("Target Relaxation Parameter",p1);
41  bound_ = parlist.sublist("Step").sublist("Line Search").sublist("Line-Search Method").sublist("Path-Based Target Level").get("Upper Bound on Path Length",one);
42  }
43 
44  void initialize(const Vector<Real> &x, const Vector<Real> &g) override {
46  xnew_ = x.clone();
47  }
48 
49  // Run Iteration scaled line search
50  void run( Real &alpha, Real &fval, int &ls_neval, int &ls_ngrad,
51  const Real &gs, const Vector<Real> &s, const Vector<Real> &x,
52  Objective<Real> &obj ) override {
53  Real tol = std::sqrt(ROL_EPSILON<Real>()), zero(0), half(0.5);
54  ls_neval = 0;
55  ls_ngrad = 0;
56  // Update target objective value
57  if ( fval < min_value_ ) {
58  min_value_ = fval;
59  }
60  target_ = rec_value_ - half*delta_;
61  if ( fval < target_ ) {
63  sigma_ = zero;
64  }
65  else {
66  if ( sigma_ > bound_ ) {
68  sigma_ = zero;
69  delta_ *= half;
70  }
71  }
73  // Get line-search parameter
74  alpha = (fval - target_)/std::abs(gs);
75  // Update iterate
76  xnew_->set(x); xnew_->axpy(alpha,s);
77  // Compute objective function value
79  fval = obj.value(*xnew_,tol);
80  ls_neval++;
81  // Update sigma
82  sigma_ += alpha*std::sqrt(std::abs(gs));
83  }
84 }; // class ROL::PathBasedTargetValue_U
85 
86 } // namespace ROL
87 
88 #endif
Provides interface for and implements line searches.
virtual void initialize(const Vector< Real > &x, const Vector< Real > &g)
Provides the interface to evaluate objective functions.
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 > &g) override
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) override
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 an implementation of path-based target leve line search.
Real ROL_OVERFLOW(void)
Platform-dependent maximum double.
Definition: ROL_Types.hpp:68
PathBasedTargetLevel_U(ParameterList &parlist)