44 #ifndef ROL_TRUSTREGION_H 45 #define ROL_TRUSTREGION_H 61 Teuchos::RCP<Vector<Real> >
Hs_;
107 delmax_ = parlist.sublist(
"Step").sublist(
"Trust Region").get(
"Maximum Radius",5000.0);
108 eta0_ = parlist.sublist(
"Step").sublist(
"Trust Region").get(
"Step Acceptance Threshold",0.05);
109 eta1_ = parlist.sublist(
"Step").sublist(
"Trust Region").get(
"Radius Shrinking Threshold",0.05);
110 eta2_ = parlist.sublist(
"Step").sublist(
"Trust Region").get(
"Radius Growing Threshold",0.9);
111 gamma0_ = parlist.sublist(
"Step").sublist(
"Trust Region").get(
"Radius Shrinking Rate (Negative rho)",0.0625);
112 gamma1_ = parlist.sublist(
"Step").sublist(
"Trust Region").get(
"Radius Shrinking Rate (Positive rho)",0.25);
113 gamma2_ = parlist.sublist(
"Step").sublist(
"Trust Region").get(
"Radius Growing Rate",2.5);
114 TRsafe_ = parlist.sublist(
"Step").sublist(
"Trust Region").get(
"Safeguard Size",100.0);
119 useInexact_.push_back(parlist.sublist(
"General").get(
"Inexact Objective Function",
false));
120 useInexact_.push_back(parlist.sublist(
"General").get(
"Inexact Gradient",
false));
121 useInexact_.push_back(parlist.sublist(
"General").get(
"Inexact Hessian-Times-A-Vector",
false));
122 scale_ = parlist.sublist(
"Step").sublist(
"Trust Region").sublist(
"Inexact").sublist(
"Value").get(
"Tolerance Scaling",1.e-1);
123 omega_ = parlist.sublist(
"Step").sublist(
"Trust Region").sublist(
"Inexact").sublist(
"Value").get(
"Exponent",0.9);
124 force_ = parlist.sublist(
"Step").sublist(
"Trust Region").sublist(
"Inexact").sublist(
"Value").get(
"Forcing Sequence Initial Value",1.0);
125 updateIter_ = parlist.sublist(
"Step").sublist(
"Trust Region").sublist(
"Inexact").sublist(
"Value").get(
"Forcing Sequence Update Frequency",10);
126 forceFactor_ = parlist.sublist(
"Step").sublist(
"Trust Region").sublist(
"Inexact").sublist(
"Value").get(
"Forcing Sequence Reduction Factor",0.1);
129 softUp_ = parlist.sublist(
"General").get(
"Variable Objective Function",
false);
133 xupdate_ = x.
clone();
138 int &nfval,
int &ngrad,
int &flagTR,
146 xupdate_->axpy(1.0,s);
151 Real fold1 = fold, ftol = tol;
152 if ( useInexact_[0] ) {
153 if ( !(cnt_%updateIter_) && (cnt_ != 0) ) {
156 Real c = scale_*std::max(1.e-2,std::min(1.0,1.e4*std::max(pRed_,std::sqrt(
ROL_EPSILON))));
157 ftol = c*std::pow(std::min(eta1_,1.0-eta2_)
158 *std::min(std::max(pRed_,std::sqrt(
ROL_EPSILON)),force_),1.0/omega_);
159 if ( ftol_old_ > ftol || cnt_ == 0 ) {
161 fold1 = pObj.
value(x,ftol_old_);
169 fnew = pObj.
value(*xupdate_,ftol);
173 Real aRed = fold1 - fnew;
180 xupdate_->axpy(-1.0,g.
dual());
182 xupdate_->axpy(-1.0,x);
183 xupdate_->scale(-1.0);
186 pRed_ = -0.5*s.
dot(Hs_->dual());
190 pRed_ -= s.
dot(Hs_->dual());
194 aRed -= eps_*((1.0 > std::abs(fold1)) ? 1.0 : std::abs(fold1));
195 pRed_ -= eps_*((1.0 > std::abs(fold1)) ? 1.0 : std::abs(fold1));
197 if ((std::abs(aRed) <
eps_) && (std::abs(pRed_) <
eps_)) {
203 if (pRed_ < 0 && aRed > 0) {
206 else if (aRed <= 0 && pRed_ > 0) {
209 else if (aRed <= 0 && pRed_ < 0) {
222 xupdate_->axpy(-1.0,g.
dual());
224 xupdate_->scale(-1.0);
226 Real pgnorm = xupdate_->norm();
228 xupdate_->set(g.
dual());
230 Real lam = std::min(1.0, del/xupdate_->norm());
231 xupdate_->scale(-lam);
234 xupdate_->scale(-1.0);
236 pgnorm *= xupdate_->norm();
238 decr = ( aRed >= 0.1*eta0_*pgnorm );
239 flagTR = (!decr ? 4 : flagTR);
243 if ((rho < eta0_ && flagTR == 0) || flagTR >= 2 || !decr ) {
250 Real modelVal = s.
dot(Hs_->dual());
252 modelVal += gs + fold1;
253 Real theta = (1.0-
eta2_)*gs/((1.0-eta2_)*(fold1+gs)+eta2_*modelVal-fnew);
254 del = std::min(gamma1_*snorm,std::max(gamma0_,theta)*del);
260 else if ((rho >= eta0_ && flagTR != 3) || flagTR == 1) {
264 del = std::min(gamma2_*del,delmax_);
288 Teuchos::RCP<Vector<Real> > stmp = x.
clone();
292 Teuchos::RCP<Vector<Real> > xtmp = x.
clone();
294 xtmp->axpy(1.0,*stmp);
297 Teuchos::RCP<Vector<Real> > Bs = x.
clone();
299 Real sBs = Bs->dot(*stmp);
300 Real gs = grad.
dot(*stmp);
301 Real val = gs + 0.5*sBs;
306 while ( val > val0 || !pObj.
isFeasible(*xtmp) ) {
314 xtmp->axpy(1.0,*stmp);
318 sBs = Bs->dot(*stmp);
319 gs = grad.
dot(*stmp);
323 if ( cnt >= maxit ) {
break; }
virtual const Vector & dual() const
Return dual representation of , for example, the result of applying a Riesz map, or change of basis...
Real value(const Vector< Real > &x, Real &tol)
Compute value.
bool isConActivated(void)
TrustRegion(Teuchos::ParameterList &parlist)
Teuchos::RCP< Vector< Real > > xupdate_
virtual void axpy(const Real alpha, const Vector &x)
Compute where .
virtual void initialize(const Vector< Real > &x, const Vector< Real > &s, const Vector< Real > &g)
void reducedHessVec(Vector< Real > &Hv, const Vector< Real > &v, const Vector< Real > &p, const Vector< Real > &d, const Vector< Real > &x, Real &tol)
Apply the reduced Hessian to a vector, v. The reduced Hessian first removes elements of v correspondi...
Contains definitions of custom data types in ROL.
virtual Teuchos::RCP< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
Provides interface for and implements trust-region subproblem solvers.
bool isFeasible(const Vector< Real > &v)
void pruneActive(Vector< Real > &v, const Vector< Real > &g, const Vector< Real > &x)
Contains definitions for helper functions in ROL.
Defines the linear algebra or vector space interface.
void hessVec(Vector< Real > &Hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply Hessian approximation to vector.
virtual Real dot(const Vector &x) const =0
Compute where .
virtual void run(Vector< Real > &s, Real &snorm, Real &del, int &iflag, int &iter, const Vector< Real > &x, const Vector< Real > &grad, const Real &gnorm, ProjectedObjective< Real > &pObj)=0
Real getPredictedReduction(void) const
Teuchos::RCP< Vector< Real > > Hs_
void updateObj(Vector< Real > &x, int iter, ProjectedObjective< Real > &pObj)
virtual void update(Vector< Real > &x, Real &fnew, Real &del, int &nfval, int &ngrad, int &flagTR, const Vector< Real > &s, const Real snorm, const Real fold, const Vector< Real > &g, int iter, ProjectedObjective< Real > &pObj)
void setPredictedReduction(const Real pRed)
void update(const Vector< Real > &x, bool flag=true, int iter=-1)
Update objective function.
virtual void set(const Vector &x)
Set where .
void computeProjectedStep(Vector< Real > &v, const Vector< Real > &x)
void project(Vector< Real > &x)
static const double ROL_OVERFLOW
Platform-dependent maximum double.
std::vector< bool > useInexact_
static const double ROL_EPSILON
Platform-dependent machine epsilon.