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
20namespace ROL {
21
22template<class Real>
23class CauchyPoint_U : public TrustRegion_U<Real> {
24private:
25
26 Ptr<Vector<Real>> dual_;
27
28public:
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,
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
Objective_SerialSimOpt(const Ptr< Obj > &obj, const V &ui) z0_ zero()
Contains definitions of custom data types in ROL.
Provides interface for the Cauchy point trust-region subproblem solver.
void initialize(const Vector< Real > &x, const Vector< Real > &g)
void solve(Vector< Real > &s, Real &snorm, Real &pRed, int &iflag, int &iter, const Real del, TrustRegionModel_U< Real > &model)
Ptr< Vector< Real > > dual_
Provides the interface to evaluate trust-region model functions.
virtual void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &s, Real &tol) override
Apply Hessian approximation to vector.
virtual const Ptr< const Vector< Real > > getGradient(void) const
Provides interface for and implements trust-region subproblem solvers.
Defines the linear algebra or vector space interface.
virtual Real norm() const =0
Returns where .
virtual void set(const Vector &x)
Set where .
virtual void scale(const Real alpha)=0
Compute where .
virtual ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector.