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
19namespace ROL {
20
21template<class Real>
22class PathBasedTargetLevel : public LineSearch<Real> {
23private:
24 ROL::Ptr<Vector<Real> > xnew_;
25
28 Real target_;
29 Real delta_;
30 Real sigma_;
31 Real bound_;
32
33public:
34
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
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
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.
Definition ROL_Types.hpp:68