ROL
ROL_CauchyPoint_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_CAUCHYPOINT_U_H
11 #define ROL_CAUCHYPOINT_U_H
12 
17 #include "ROL_TrustRegion_U.hpp"
18 #include "ROL_Types.hpp"
19 
20 namespace ROL {
21 
22 template<class Real>
23 class CauchyPoint_U : public TrustRegion_U<Real> {
24 private:
25 
26  Ptr<Vector<Real>> dual_;
27 
28 public:
29 
31 
32  void initialize(const Vector<Real> &x, const Vector<Real> &g) {
33  dual_ = g.clone();
34  }
35 
36  void solve( Vector<Real> &s, Real &snorm, Real &pRed,
37  int &iflag, int &iter, const Real del,
38  TrustRegionModel_U<Real> &model) {
39  const Real zero(0), half(0.5);
40  Real tol = std::sqrt(ROL_EPSILON<Real>());
41  // Set step to (projected) gradient
42  s.set(model.getGradient()->dual());
43  // Apply (reduced) Hessian to (projected) gradient
44  model.hessVec(*dual_,s,s,tol);
45  Real gnorm = s.norm();
46  Real gnorm2 = gnorm*gnorm;
47  //Real gBg = dual_->dot(s.dual());
48  Real gBg = dual_->apply(s);
49  Real alpha = gnorm2/gBg;
50  if ( alpha*gnorm >= del || gBg <= zero ) {
51  alpha = del/gnorm;
52  }
53  s.scale(-alpha);
54  snorm = alpha*gnorm;
55  iflag = 0;
56  iter = 0;
57  pRed = alpha*(gnorm2 - half*alpha*gBg);
58  }
59 };
60 
61 } // namespace ROL
62 
63 #endif
virtual void scale(const Real alpha)=0
Compute where .
virtual ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
Contains definitions of custom data types in ROL.
Defines the linear algebra or vector space interface.
Definition: ROL_Vector.hpp:46
Objective_SerialSimOpt(const Ptr< Obj > &obj, const V &ui) z0_ zero()
virtual void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &s, Real &tol) override
Apply Hessian approximation to vector.
Provides the interface to evaluate trust-region model functions.
virtual const Ptr< const Vector< Real > > getGradient(void) const
void initialize(const Vector< Real > &x, const Vector< Real > &g)
Provides interface for the Cauchy point trust-region subproblem solver.
Provides interface for and implements trust-region subproblem solvers.
Ptr< Vector< Real > > dual_
virtual void set(const Vector &x)
Set where .
Definition: ROL_Vector.hpp:175
virtual Real norm() const =0
Returns where .
void solve(Vector< Real > &s, Real &snorm, Real &pRed, int &iflag, int &iter, const Real del, TrustRegionModel_U< Real > &model)