ROL
ROL_PathBasedTargetLevel.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_H
45#define ROL_PATHBASEDTARGETLEVEL_H
46
51#include "ROL_LineSearch.hpp"
52
53namespace ROL {
54
55template<class Real>
56class PathBasedTargetLevel : public LineSearch<Real> {
57private:
58 ROL::Ptr<Vector<Real> > xnew_;
59
62 Real target_;
63 Real delta_;
64 Real sigma_;
65 Real bound_;
66
67public:
68
70
71 // Constructor
72 PathBasedTargetLevel( ROL::ParameterList &parlist )
73 : LineSearch<Real>(parlist), min_value_(ROL::ROL_OVERFLOW<Real>()),
74 rec_value_(ROL::ROL_OVERFLOW<Real>()), target_(0.0), sigma_(0.0) {
75 Real p1(0.1), one(1);
76 delta_ = parlist.sublist("Step").sublist("Line Search").sublist("Line-Search Method").sublist("Path-Based Target Level").get("Target Relaxation Parameter",p1);
77 bound_ = parlist.sublist("Step").sublist("Line Search").sublist("Line-Search Method").sublist("Path-Based Target Level").get("Upper Bound on Path Length",one);
78 }
79
80 void initialize(const Vector<Real> &x, const Vector<Real> &s, const Vector<Real> &g,
82 LineSearch<Real>::initialize(x,s,g,obj,con);
83 xnew_ = x.clone();
84 }
85
86 // Run Iteration scaled line search
87 void run( Real &alpha, Real &fval, int &ls_neval, int &ls_ngrad,
88 const Real &gs, const Vector<Real> &s, const Vector<Real> &x,
90 Real tol = std::sqrt(ROL_EPSILON<Real>()), zero(0), half(0.5);
91 ls_neval = 0;
92 ls_ngrad = 0;
93 // Update target objective value
94 if ( fval < min_value_ ) {
95 min_value_ = fval;
96 }
97 target_ = rec_value_ - half*delta_;
98 if ( fval < target_ ) {
100 sigma_ = zero;
101 }
102 else {
103 if ( sigma_ > bound_ ) {
105 sigma_ = zero;
106 delta_ *= half;
107 }
108 }
110 // Get line-search parameter
111 alpha = (fval - target_)/std::abs(gs);
112 // Update iterate
114 // Compute objective function value
115 obj.update(*xnew_);
116 fval = obj.value(*xnew_,tol);
117 ls_neval++;
118 // Update sigma
119 sigma_ += alpha*std::sqrt(std::abs(gs));
120 }
121};
122
123}
124
125#endif
Objective_SerialSimOpt(const Ptr< Obj > &obj, const V &ui) z0 zero)()
Provides the interface to apply upper and lower bound constraints.
Provides interface for and implements line searches.
void updateIterate(Vector< Real > &xnew, const Vector< Real > &x, const Vector< Real > &s, Real alpha, BoundConstraint< Real > &con)
virtual void initialize(const Vector< Real > &x, const Vector< Real > &s, const Vector< Real > &g, Objective< Real > &obj, BoundConstraint< Real > &con)
Provides the interface to evaluate objective functions.
virtual Real value(const Vector< Real > &x, Real &tol)=0
Compute value.
virtual void update(const Vector< Real > &x, UpdateType type, int iter=-1)
Update objective function.
Provides an implementation of path-based target leve line search.
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)
PathBasedTargetLevel(ROL::ParameterList &parlist)
void initialize(const Vector< Real > &x, const Vector< Real > &s, const Vector< Real > &g, Objective< Real > &obj, BoundConstraint< Real > &con)
ROL::Ptr< Vector< Real > > xnew_
Defines the linear algebra or vector space interface.
virtual ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
Real ROL_OVERFLOW(void)
Platform-dependent maximum double.