44 #ifndef ROL_SPGTRUSTREGION_U_H
45 #define ROL_SPGTRUSTREGION_U_H
58 template<
typename Real>
77 ParameterList &list = parlist.sublist(
"Step").sublist(
"Trust Region").sublist(
"SPG");
79 lambdaMin_ = list.sublist(
"Solver").get(
"Minimum Spectral Step Size", 1e-8);
80 lambdaMax_ = list.sublist(
"Solver").get(
"Maximum Spectral Step Size", 1e8);
81 gamma_ = list.sublist(
"Solver").get(
"Sufficient Decrease Tolerance", 1e-4);
82 maxSize_ = list.sublist(
"Solver").get(
"Maximum Storage Size", 10);
83 maxit_ = list.sublist(
"Solver").get(
"Iteration Limit", 25);
84 tol1_ = list.sublist(
"Solver").get(
"Absolute Tolerance", 1e-4);
85 tol2_ = list.sublist(
"Solver").get(
"Relative Tolerance", 1e-2);
86 useMin_ = list.sublist(
"Solver").get(
"Use Smallest Model Iterate",
true);
87 useNMSP_ = list.sublist(
"Solver").get(
"Use Nonmonotone Search",
false);
105 const Real
zero(0), half(0.5), one(1), two(2), eps(std::sqrt(ROL_EPSILON<Real>()));
106 Real tol(eps), alpha(1), sHs(0), alphaTmp(1), mmax(0), qmin(0), q(0);
107 Real gnorm(0), ss(0), gs(0);
108 std::deque<Real> mqueue; mqueue.push_back(0);
115 gs =
gmod_->apply(s);
116 sHs =
dwa_->apply(s);
117 snorm = std::sqrt(std::abs(gs));
119 if (alpha*snorm >= del || sHs <=
zero) alpha = del/snorm;
120 q = alpha*(gs+half*alpha*sHs);
129 snorm =
pwa_->norm();
130 if (snorm > del)
pwa_->scale(del/snorm);
132 gnorm =
pwa_->norm();
138 const Real gtol = std::min(
tol1_,
tol2_*gnorm);
143 snorm =
pwa_->norm();
144 if (snorm > del)
pwa_->scale(del/snorm);
149 for (iter = 0; iter <
maxit_; iter++) {
155 mmax = *std::max_element(mqueue.begin(),mqueue.end());
156 alphaTmp = (-(one-
gamma_)*gs + std::sqrt(std::pow((one-
gamma_)*gs,two)-two*sHs*(q-mmax)))/sHs;
161 alpha = (sHs >
zero ? std::min(one,std::max(
zero,alphaTmp)) : one);
163 q += alpha*(gs+half*alpha*sHs);
168 if (static_cast<int>(mqueue.size())==
maxSize_) mqueue.pop_front();
175 snorm =
pwa_->norm();
176 if (snorm > del)
pwa_->scale(del/snorm);
178 gnorm =
pwa_->norm();
179 if (gnorm < gtol)
break;
183 snorm =
pwa_->norm();
184 if (snorm > del)
pwa_->scale(del/snorm);
190 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 .