ROL
ROL_PathBasedTargetLevel_U.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ************************************************************************
3 //
4 // Rapid Optimization Library (ROL) Package
5 // Copyright (2014) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact lead developers:
38 // Drew Kouri (dpkouri@sandia.gov) and
39 // Denis Ridzal (dridzal@sandia.gov)
40 //
41 // ************************************************************************
42 // @HEADER
43 
44 #ifndef ROL_PATHBASEDTARGETLEVEL_U_H
45 #define ROL_PATHBASEDTARGETLEVEL_U_H
46 
51 #include "ROL_LineSearch_U.hpp"
52 
53 namespace ROL {
54 
55 template<typename Real>
56 class PathBasedTargetLevel_U : public LineSearch_U<Real> {
57 private:
58  Ptr<Vector<Real>> xnew_;
59 
60  Real min_value_;
61  Real rec_value_;
62  Real target_;
63  Real delta_;
64  Real sigma_;
65  Real bound_;
66 
67 public:
68 
69  PathBasedTargetLevel_U( ParameterList &parlist )
70  : LineSearch_U<Real>(parlist),
71  min_value_(ROL_OVERFLOW<Real>()),
72  rec_value_(ROL_OVERFLOW<Real>()), target_(0.0), sigma_(0.0) {
73  Real p1(0.1), one(1);
74  delta_ = parlist.sublist("Step").sublist("Line Search").sublist("Line-Search Method").sublist("Path-Based Target Level").get("Target Relaxation Parameter",p1);
75  bound_ = parlist.sublist("Step").sublist("Line Search").sublist("Line-Search Method").sublist("Path-Based Target Level").get("Upper Bound on Path Length",one);
76  }
77 
78  void initialize(const Vector<Real> &x, const Vector<Real> &g) override {
80  xnew_ = x.clone();
81  }
82 
83  // Run Iteration scaled line search
84  void run( Real &alpha, Real &fval, int &ls_neval, int &ls_ngrad,
85  const Real &gs, const Vector<Real> &s, const Vector<Real> &x,
86  Objective<Real> &obj ) override {
87  Real tol = std::sqrt(ROL_EPSILON<Real>()), zero(0), half(0.5);
88  ls_neval = 0;
89  ls_ngrad = 0;
90  // Update target objective value
91  if ( fval < min_value_ ) {
92  min_value_ = fval;
93  }
94  target_ = rec_value_ - half*delta_;
95  if ( fval < target_ ) {
97  sigma_ = zero;
98  }
99  else {
100  if ( sigma_ > bound_ ) {
102  sigma_ = zero;
103  delta_ *= half;
104  }
105  }
107  // Get line-search parameter
108  alpha = (fval - target_)/std::abs(gs);
109  // Update iterate
110  xnew_->set(x); xnew_->axpy(alpha,s);
111  // Compute objective function value
113  fval = obj.value(*xnew_,tol);
114  ls_neval++;
115  // Update sigma
116  sigma_ += alpha*std::sqrt(std::abs(gs));
117  }
118 }; // class ROL::PathBasedTargetValue_U
119 
120 } // namespace ROL
121 
122 #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:80
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:102
PathBasedTargetLevel_U(ParameterList &parlist)