10 #ifndef ROL_SPGTRUSTREGION_U_H
11 #define ROL_SPGTRUSTREGION_U_H
24 template<
typename Real>
43 ParameterList &list = parlist.sublist(
"Step").sublist(
"Trust Region").sublist(
"SPG");
45 lambdaMin_ = list.sublist(
"Solver").get(
"Minimum Spectral Step Size", 1e-8);
46 lambdaMax_ = list.sublist(
"Solver").get(
"Maximum Spectral Step Size", 1e8);
47 gamma_ = list.sublist(
"Solver").get(
"Sufficient Decrease Tolerance", 1e-4);
48 maxSize_ = list.sublist(
"Solver").get(
"Maximum Storage Size", 10);
49 maxit_ = list.sublist(
"Solver").get(
"Iteration Limit", 25);
50 tol1_ = list.sublist(
"Solver").get(
"Absolute Tolerance", 1e-4);
51 tol2_ = list.sublist(
"Solver").get(
"Relative Tolerance", 1e-2);
52 useMin_ = list.sublist(
"Solver").get(
"Use Smallest Model Iterate",
true);
53 useNMSP_ = list.sublist(
"Solver").get(
"Use Nonmonotone Search",
false);
71 const Real
zero(0), half(0.5), one(1), two(2), eps(std::sqrt(ROL_EPSILON<Real>()));
72 Real tol(eps), alpha(1), sHs(0), alphaTmp(1), mmax(0), qmin(0), q(0);
73 Real gnorm(0), ss(0), gs(0);
74 std::deque<Real> mqueue; mqueue.push_back(0);
83 snorm = std::sqrt(std::abs(gs));
85 if (alpha*snorm >= del || sHs <=
zero) alpha = del/snorm;
86 q = alpha*(gs+half*alpha*sHs);
96 if (snorm > del)
pwa_->scale(del/snorm);
104 const Real gtol = std::min(
tol1_,
tol2_*gnorm);
109 snorm =
pwa_->norm();
110 if (snorm > del)
pwa_->scale(del/snorm);
115 for (iter = 0; iter <
maxit_; iter++) {
121 mmax = *std::max_element(mqueue.begin(),mqueue.end());
122 alphaTmp = (-(one-
gamma_)*gs + std::sqrt(std::pow((one-
gamma_)*gs,two)-two*sHs*(q-mmax)))/sHs;
127 alpha = (sHs >
zero ? std::min(one,std::max(
zero,alphaTmp)) : one);
129 q += alpha*(gs+half*alpha*sHs);
134 if (static_cast<int>(mqueue.size())==
maxSize_) mqueue.pop_front();
141 snorm =
pwa_->norm();
142 if (snorm > del)
pwa_->scale(del/snorm);
144 gnorm =
pwa_->norm();
145 if (gnorm < gtol)
break;
149 snorm =
pwa_->norm();
150 if (snorm > del)
pwa_->scale(del/snorm);
156 iflag = (iter==maxit_ ? 1 : 0);
virtual void scale(const Real alpha)=0
Compute where .
virtual ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
virtual void axpy(const Real alpha, const Vector &x)
Compute where .
SPGTrustRegion_U(ParameterList &parlist)
Contains definitions of custom data types in ROL.
Ptr< Vector< Real > > pwa1_
Ptr< Vector< Real > > pwa_
void initialize(const Vector< Real > &x, const Vector< Real > &g)
Defines the linear algebra or vector space interface.
Provides interface for truncated CG trust-region subproblem solver.
Objective_SerialSimOpt(const Ptr< Obj > &obj, const V &ui) z0_ zero()
void solve(Vector< Real > &s, Real &snorm, Real &pRed, int &iflag, int &iter, const Real del, TrustRegionModel_U< Real > &model)
virtual void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &s, Real &tol) override
Apply Hessian approximation to vector.
Ptr< Vector< Real > > gmod_
Provides the interface to evaluate trust-region model functions.
virtual const Ptr< const Vector< Real > > getGradient(void) const
Ptr< Vector< Real > > smin_
Ptr< Vector< Real > > dwa_
Provides interface for and implements trust-region subproblem solvers.
virtual void set(const Vector &x)
Set where .
virtual Real norm() const =0
Returns where .