ROL
ROL_TrustRegionStep.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_TRUSTREGIONSTEP_H
11 #define ROL_TRUSTREGIONSTEP_H
12 
13 #include "ROL_Step.hpp"
14 #include "ROL_Types.hpp"
15 #include "ROL_Secant.hpp"
16 #include "ROL_TrustRegion.hpp"
17 #include <sstream>
18 #include <iomanip>
19 
92 namespace ROL {
93 
94 template <class Real>
95 class TrustRegionStep : public Step<Real> {
96 private:
97 
98  // ADDITIONAL VECTOR STORAGE
99  Ptr<Vector<Real>> xnew_;
100  Ptr<Vector<Real>> xold_;
101  Ptr<Vector<Real>> gp_;
102 
103  // TRUST REGION INFORMATION
104  Ptr<TrustRegion<Real>> trustRegion_;
105  Ptr<TrustRegionModel<Real>> model_;
108  Real delMax_;
110  int SPflag_;
111  int SPiter_;
112  bool bndActive_;
113 
114  // SECANT INFORMATION
115  Ptr<Secant<Real>> secant_;
119 
120  // BOUND CONSTRAINED PARAMETERS
121  Real scaleEps_;
123 
124  // POST SMOOTHING PARAMETERS
125  Real alpha_init_;
126  int max_fval_;
127  Real mu_;
128  Real beta_;
129 
130  // COLEMAN-LI PARAMETERS
134 
135  // INEXACT COMPUTATION PARAMETERS
136  std::vector<bool> useInexact_;
137  Real scale0_;
138  Real scale1_;
139 
140  // VERBOSITY SETTING
142 
149  void parseParameterList(ROL::ParameterList &parlist) {
150  ROL::Ptr<StepState<Real>> step_state = Step<Real>::getState();
151  // Trust-Region Parameters
152  ROL::ParameterList &slist = parlist.sublist("Step");
153  ROL::ParameterList &list = slist.sublist("Trust Region");
154  step_state->searchSize = list.get("Initial Radius", static_cast<Real>(-1));
155  delMax_ = list.get("Maximum Radius", static_cast<Real>(1.e8));
156  // Inexactness Information
157  ROL::ParameterList &glist = parlist.sublist("General");
158  useInexact_.clear();
159  bool inexactObj = glist.get("Inexact Objective Function", false);
160  bool inexactGrad = glist.get("Inexact Gradient", false);
161  bool inexactHessVec = glist.get("Inexact Hessian-Times-A-Vector", false);
162  useInexact_.push_back(inexactObj );
163  useInexact_.push_back(inexactGrad );
164  useInexact_.push_back(inexactHessVec);
165  // Trust-Region Inexactness Parameters
166  ROL::ParameterList &ilist = list.sublist("Inexact").sublist("Gradient");
167  scale0_ = ilist.get("Tolerance Scaling", static_cast<Real>(0.1));
168  scale1_ = ilist.get("Relative Tolerance", static_cast<Real>(2));
169  // Initialize Trust Region Subproblem Solver Object
170  std::string solverName = list.get("Subproblem Solver", "Dogleg");
171  etr_ = StringToETrustRegion(solverName);
172  std::string modelName = list.get("Subproblem Model", "Kelley-Sachs");
173  TRmodel_ = StringToETrustRegionModel(modelName);
174  useProjectedGrad_ = glist.get("Projected Gradient Criticality Measure", false);
175  trustRegion_ = TrustRegionFactory<Real>(parlist);
176  // Scale for epsilon active sets
177  scaleEps_ = glist.get("Scale for Epsilon Active Sets", static_cast<Real>(1));
178  verbosity_ = glist.get("Print Verbosity", 0);
179  // Post-smoothing parameters
180  max_fval_ = list.sublist("Post-Smoothing").get("Function Evaluation Limit", 20);
181  alpha_init_ = list.sublist("Post-Smoothing").get("Initial Step Size", static_cast<Real>(1));
182  mu_ = list.sublist("Post-Smoothing").get("Tolerance", static_cast<Real>(0.9999));
183  beta_ = list.sublist("Post-Smoothing").get("Rate", static_cast<Real>(0.01));
184  // Coleman-Li parameters
185  stepBackMax_ = list.sublist("Coleman-Li").get("Maximum Step Back", static_cast<Real>(0.9999));
186  stepBackScale_ = list.sublist("Coleman-Li").get("Maximum Step Scale", static_cast<Real>(1));
187  singleReflect_ = list.sublist("Coleman-Li").get("Single Reflection", true);
188  }
189 
205  AlgorithmState<Real> &algo_state ) {
206  Ptr<StepState<Real>> state = Step<Real>::getState();
207  if ( useInexact_[1] ) {
208  const Real one(1);
209  //const Real oem2(1.e-2), oe4(1.e4);
210  //Real c = scale0_*std::max(oem2,std::min(one,oe4*algo_state.gnorm));
211  //Real gtol1 = c*std::min(algo_state.gnorm,state->searchSize);
212  //Real gtol0 = scale1_*gtol1 + one;
213  //while ( gtol0 > gtol1*scale1_ ) {
214  // obj.gradient(*(state->gradientVec),x,gtol1);
215  // algo_state.gnorm = computeCriticalityMeasure(*(state->gradientVec),x,bnd);
216  // gtol0 = gtol1;
217  // c = scale0_*std::max(oem2,std::min(one,oe4*algo_state.gnorm));
218  // gtol1 = c*std::min(algo_state.gnorm,state->searchSize);
219  //}
220  //algo_state.ngrad++;
221  Real gtol1 = scale0_*state->searchSize;
222  //Real gtol1 = scale0_*std::min(algo_state.gnorm,state->searchSize);
223  Real gtol0 = gtol1 + one;
224  while ( gtol0 > gtol1 ) {
225  obj.gradient(*(state->gradientVec),x,gtol1);
226  algo_state.gnorm = computeCriticalityMeasure(*(state->gradientVec),x,bnd);
227  gtol0 = gtol1;
228  gtol1 = scale0_*std::min(algo_state.gnorm,state->searchSize);
229  }
230  algo_state.ngrad++;
231  }
232  else {
233  Real gtol = std::sqrt(ROL_EPSILON<Real>());
234  obj.gradient(*(state->gradientVec),x,gtol);
235  algo_state.ngrad++;
236  algo_state.gnorm = computeCriticalityMeasure(*(state->gradientVec),x,bnd);
237  }
238  }
239 
249  if ( bnd.isActivated() ) {
250  if ( useProjectedGrad_ ) {
251  gp_->set(g);
252  bnd.computeProjectedGradient( *gp_, x );
253  return gp_->norm();
254  }
255  else {
256  Real one(1);
257  xnew_->set(x);
258  xnew_->axpy(-one,g.dual());
259  bnd.project(*xnew_);
260  xnew_->axpy(-one,x);
261  return xnew_->norm();
262  }
263  }
264  else {
265  return g.norm();
266  }
267  }
268 
269 public:
270 
272  using Step<Real>::compute;
273  using Step<Real>::update;
274 
275  virtual ~TrustRegionStep() {}
276 
284  TrustRegionStep( ROL::ParameterList & parlist )
285  : Step<Real>(),
286  xnew_(nullPtr), xold_(nullPtr), gp_(nullPtr),
287  trustRegion_(nullPtr), model_(nullPtr),
290  SPflag_(0), SPiter_(0), bndActive_(false),
291  secant_(nullPtr), esec_(SECANT_LBFGS),
292  useSecantHessVec_(false), useSecantPrecond_(false),
293  scaleEps_(1), useProjectedGrad_(false),
294  alpha_init_(1), max_fval_(20), mu_(0.9999), beta_(0.01),
295  stepBackMax_(0.9999), stepBackScale_(1), singleReflect_(true),
296  scale0_(1), scale1_(1),
297  verbosity_(0) {
298  // Parse input parameterlist
299  parseParameterList(parlist);
300  // Create secant object
301  ROL::ParameterList &glist = parlist.sublist("General");
302  std::string secantName = glist.sublist("Secant").get("Type","Limited-Memory BFGS");
303  esec_ = StringToESecant(secantName);
304  useSecantPrecond_ = glist.sublist("Secant").get("Use as Preconditioner", false);
305  useSecantHessVec_ = glist.sublist("Secant").get("Use as Hessian", false);
306  secant_ = SecantFactory<Real>(parlist);
307  }
308 
318  TrustRegionStep( ROL::Ptr<Secant<Real> > &secant, ROL::ParameterList &parlist )
319  : Step<Real>(),
320  xnew_(nullPtr), xold_(nullPtr), gp_(nullPtr),
321  trustRegion_(nullPtr), model_(nullPtr),
324  SPflag_(0), SPiter_(0), bndActive_(false),
325  secant_(nullPtr), esec_(SECANT_LBFGS),
326  useSecantHessVec_(false), useSecantPrecond_(false),
327  scaleEps_(1), useProjectedGrad_(false),
328  alpha_init_(1), max_fval_(20), mu_(0.9999), beta_(0.01),
329  stepBackMax_(0.9999), stepBackScale_(1), singleReflect_(true),
330  scale0_(1), scale1_(1),
331  verbosity_(0) {
332  // Parse input parameterlist
333  parseParameterList(parlist);
334  // Create secant object
335  ROL::ParameterList &glist = parlist.sublist("General");
336  useSecantPrecond_ = glist.sublist("Secant").get("Use as Preconditioner", false);
337  useSecantHessVec_ = glist.sublist("Secant").get("Use as Hessian", false);
338  if ( ROL::is_nullPtr(secant_) ) {
339  ROL::ParameterList Slist;
340  Slist.sublist("General").sublist("Secant").set("Type","Limited-Memory BFGS");
341  Slist.sublist("General").sublist("Secant").set("Maximum Storage",10);
342  secant_ = SecantFactory<Real>(Slist);
343  }
344  }
345 
354  void initialize( Vector<Real> &x, const Vector<Real> &s, const Vector<Real> &g,
356  AlgorithmState<Real> &algo_state ) {
358  throw Exception::NotImplemented(">>> ROL::TrustRegionStep : Invalid Trust Region Solver and Model pair!");
359  }
360  Real p1(0.1), oe10(1.e10), zero(0), one(1), half(0.5), three(3), two(2), six(6);
361  Ptr<StepState<Real>> step_state = Step<Real>::getState();
362  bndActive_ = bnd.isActivated();
363 
364  trustRegion_->initialize(x,s,g);
365 
366  Real htol = std::sqrt(ROL_EPSILON<Real>());
367  Real ftol = p1*ROL_OVERFLOW<Real>();
368 
369  step_state->descentVec = s.clone();
370  step_state->gradientVec = g.clone();
371 
372  if ( bnd.isActivated() ) {
373  // Make initial guess feasible
375  bnd.projectInterior(x);
376  }
377  else {
378  bnd.project(x);
379  }
380  xnew_ = x.clone();
381  xold_ = x.clone();
382  }
383  gp_ = g.clone();
384 
385  // Update approximate gradient and approximate objective function.
386  obj.update(x,true,algo_state.iter);
387  algo_state.snorm = oe10;
388  algo_state.value = obj.value(x,ftol);
389  algo_state.nfval++;
390  algo_state.gnorm = ROL_INF<Real>();
391  updateGradient(x,obj,bnd,algo_state);
392 
393  // Try to apply inverse Hessian
394  if ( !useSecantHessVec_ &&
396  try {
397  Ptr<Vector<Real>> v = g.clone();
398  Ptr<Vector<Real>> hv = x.clone();
399  obj.invHessVec(*hv,*v,x,htol);
400  }
401  catch (std::exception &e) {
402  useSecantHessVec_ = true;
403  }
404  }
405 
406  // Evaluate Objective Function at Cauchy Point
407  bool autoRad = false;
408  if ( step_state->searchSize <= zero ) {
409  autoRad = true;
410  Ptr<Vector<Real>> Bg = g.clone();
411  if ( useSecantHessVec_ ) {
412  secant_->applyB(*Bg,(step_state->gradientVec)->dual());
413  }
414  else {
415  obj.hessVec(*Bg,(step_state->gradientVec)->dual(),x,htol);
416  }
417  Real gBg = Bg->dot(*(step_state->gradientVec));
418  Real alpha = one;
419  if ( gBg > ROL_EPSILON<Real>() ) {
420  alpha = algo_state.gnorm*algo_state.gnorm/gBg;
421  }
422  // Evaluate the objective function at the Cauchy point
423  Ptr<Vector<Real>> cp = s.clone();
424  cp->set((step_state->gradientVec)->dual());
425  cp->scale(-alpha);
426  Ptr<Vector<Real>> xcp = x.clone();
427  xcp->set(x);
428  xcp->plus(*cp);
429  if ( bnd.isActivated() ) {
430  bnd.project(*xcp);
431  }
432  obj.update(*xcp);
433  Real fnew = obj.value(*xcp,ftol); // MUST DO SOMETHING HERE WITH FTOL
434  algo_state.nfval++;
435  // Perform cubic interpolation to determine initial trust region radius
436  Real gs = cp->dot((step_state->gradientVec)->dual());
437  Real a = fnew - algo_state.value - gs - half*alpha*alpha*gBg;
438  if ( std::abs(a) < ROL_EPSILON<Real>() ) {
439  // a = 0 implies the objective is quadratic in the negative gradient direction
440  step_state->searchSize = std::min(alpha*algo_state.gnorm,delMax_);
441  }
442  else {
443  Real b = half*alpha*alpha*gBg;
444  Real c = gs;
445  if ( b*b-three*a*c > ROL_EPSILON<Real>() ) {
446  // There is at least one critical point
447  Real t1 = (-b-std::sqrt(b*b-three*a*c))/(three*a);
448  Real t2 = (-b+std::sqrt(b*b-three*a*c))/(three*a);
449  if ( six*a*t1 + two*b > zero ) {
450  // t1 is the minimizer
451  step_state->searchSize = std::min(t1*alpha*algo_state.gnorm,delMax_);
452  }
453  else {
454  // t2 is the minimizer
455  step_state->searchSize = std::min(t2*alpha*algo_state.gnorm,delMax_);
456  }
457  }
458  else {
459  step_state->searchSize = std::min(alpha*algo_state.gnorm,delMax_);
460  }
461  }
462  if (step_state->searchSize <= ROL_EPSILON<Real>()*algo_state.gnorm && autoRad) {
463  step_state->searchSize = one;
464  }
465  obj.update(x,true,algo_state.iter);
466  }
467  // Build trust-region model
468  if (bnd.isActivated()) {
470  model_ = makePtr<KelleySachsModel<Real>>(obj,
471  bnd,
472  x,
473  *(step_state->gradientVec),
474  secant_,
477  }
478  else if ( TRmodel_ == TRUSTREGION_MODEL_COLEMANLI ) {
479  model_ = makePtr<ColemanLiModel<Real>>(obj,
480  bnd,
481  x,
482  *(step_state->gradientVec),
483  stepBackMax_,
486  secant_,
489  }
490  else if ( TRmodel_ == TRUSTREGION_MODEL_LINMORE ) {
491  model_ = makePtr<LinMoreModel<Real>>(obj,
492  bnd,
493  x,
494  *(step_state->gradientVec),
495  secant_,
498  }
499  else {
500  ROL_TEST_FOR_EXCEPTION( true, std::invalid_argument,
501  ">>> ERROR (TrustRegionStep): Invalid trust-region model!");
502  }
503  }
504  else {
505  model_ = makePtr<TrustRegionModel<Real>>(obj,
506  bnd,
507  x,
508  *(step_state->gradientVec),
509  secant_,
512  }
513  }
514 
525  void compute( Vector<Real> &s, const Vector<Real> &x,
527  AlgorithmState<Real> &algo_state ) {
528  // Get step state
529  Ptr<StepState<Real>> step_state = Step<Real>::getState();
530  // Build trust-region model
531  model_->update(obj,bnd,x,*step_state->gradientVec,secant_);
532  if (bnd.isActivated()) {
534 // Real eps = scaleEps_*algo_state.gnorm;
535  Real eps = scaleEps_ * std::min(std::pow(algo_state.gnorm,static_cast<Real>(0.75)),
536  static_cast<Real>(0.001));
537  dynamicPtrCast<KelleySachsModel<Real>>(model_)->setEpsilon(eps);
538  }
539  else if ( TRmodel_ == TRUSTREGION_MODEL_COLEMANLI ) {
540  dynamicPtrCast<ColemanLiModel<Real>>(model_)->setRadius(step_state->searchSize);
541  }
542  }
543  // Minimize trust-region model over trust-region constraint
544  SPflag_ = 0; SPiter_ = 0;
545  trustRegion_->run(s,algo_state.snorm,SPflag_,SPiter_,step_state->searchSize,*model_);
546  }
547 
560  const Vector<Real> &s,
561  Objective<Real> &obj,
563  AlgorithmState<Real> &algo_state ) {
564  // Get step state
565  Ptr<StepState<Real>> state = Step<Real>::getState();
566  // Store previous step for constraint computations
567  if ( bnd.isActivated() ) {
568  xold_->set(x);
569  }
570  // Update trust-region information;
571  // Performs a hard update on the objective function
573  state->nfval = 0;
574  state->ngrad = 0;
575  Real fold = algo_state.value;
576  Real fnew(0);
577  algo_state.iter++;
578  trustRegion_->update(x,fnew,state->searchSize,state->nfval,state->ngrad,TRflag_,
579  s,algo_state.snorm,fold,*(state->gradientVec),algo_state.iter,
580  obj,bnd,*model_);
581  algo_state.nfval += state->nfval;
582  algo_state.ngrad += state->ngrad;
583  state->flag = static_cast<int>(TRflag_);
584  state->SPiter = SPiter_;
585  state->SPflag = SPflag_;
586  // If step is accepted ...
587  // Compute new gradient and update secant storage
590  // Store previous gradient for secant update
592  gp_->set(*(state->gradientVec));
593  }
594  // Update objective function and approximate model
595  updateGradient(x,obj,bnd,algo_state);
596  // Update secant information
598  if ( bnd.isActivated() ) { // Compute new constrained step
599  xnew_->set(x);
600  xnew_->axpy(-static_cast<Real>(1),*xold_);
601  secant_->updateStorage(x,*(state->gradientVec),*gp_,*xnew_,algo_state.snorm,algo_state.iter+1);
602  }
603  else {
604  secant_->updateStorage(x,*(state->gradientVec),*gp_,s,algo_state.snorm,algo_state.iter+1);
605  }
606  }
607  // Update algorithm state
608  (algo_state.iterateVec)->set(x);
609  }
610  else {
611  if ( useInexact_[1] ) {
612  // Update objective function and approximate model
613  updateGradient(x,obj,bnd,algo_state);
614  }
615  }
616  // Update algorithm state
617  algo_state.value = fnew;
618  }
619 
624  std::string printHeader( void ) const {
625  std::stringstream hist;
626 
627  if(verbosity_>0) {
628  hist << std::string(114,'-') << "\n";
629 
630  hist << "Trust-Region status output definitions\n\n";
631 
632  hist << " iter - Number of iterates (steps taken) \n";
633  hist << " value - Objective function value \n";
634  hist << " gnorm - Norm of the gradient\n";
635  hist << " snorm - Norm of the step (update to optimization vector)\n";
636  hist << " delta - Trust-Region radius\n";
637  hist << " #fval - Number of times the objective function was evaluated\n";
638  hist << " #grad - Number of times the gradient was computed\n";
639 
640 
641 
642  hist << "\n";
643  hist << " tr_flag - Trust-Region flag" << "\n";
644  for( int flag = TRUSTREGION_FLAG_SUCCESS; flag != TRUSTREGION_FLAG_UNDEFINED; ++flag ) {
645  hist << " " << NumberToString(flag) << " - "
646  << ETrustRegionFlagToString(static_cast<ETrustRegionFlag>(flag)) << "\n";
647 
648  }
649 
650  if( etr_ == TRUSTREGION_TRUNCATEDCG ) {
651  hist << "\n";
652  hist << " iterCG - Number of Truncated CG iterations\n\n";
653  hist << " flagGC - Trust-Region Truncated CG flag" << "\n";
654  for( int flag = CG_FLAG_SUCCESS; flag != CG_FLAG_UNDEFINED; ++flag ) {
655  hist << " " << NumberToString(flag) << " - "
656  << ECGFlagToString(static_cast<ECGFlag>(flag)) << "\n";
657  }
658  }
659 
660  hist << std::string(114,'-') << "\n";
661  }
662 
663  hist << " ";
664  hist << std::setw(6) << std::left << "iter";
665  hist << std::setw(15) << std::left << "value";
666  hist << std::setw(15) << std::left << "gnorm";
667  hist << std::setw(15) << std::left << "snorm";
668  hist << std::setw(15) << std::left << "delta";
669  hist << std::setw(10) << std::left << "#fval";
670  hist << std::setw(10) << std::left << "#grad";
671  hist << std::setw(10) << std::left << "tr_flag";
673  hist << std::setw(10) << std::left << "iterCG";
674  hist << std::setw(10) << std::left << "flagCG";
675  }
676  hist << "\n";
677  return hist.str();
678  }
679 
684  std::string printName( void ) const {
685  std::stringstream hist;
686  hist << "\n" << ETrustRegionToString(etr_) << " Trust-Region Solver";
689  hist << " with " << ESecantToString(esec_) << " Preconditioning\n";
690  }
691  else if ( !useSecantPrecond_ && useSecantHessVec_ ) {
692  hist << " with " << ESecantToString(esec_) << " Hessian Approximation\n";
693  }
694  else {
695  hist << " with " << ESecantToString(esec_) << " Preconditioning and Hessian Approximation\n";
696  }
697  }
698  else {
699  hist << "\n";
700  }
701  if ( bndActive_ ) {
702  hist << "Trust-Region Model: " << ETrustRegionModelToString(TRmodel_) << "\n";
703  }
704  return hist.str();
705  }
706 
714  std::string print( AlgorithmState<Real> & algo_state, bool print_header = false ) const {
715  const Ptr<const StepState<Real>>& step_state = Step<Real>::getStepState();
716 
717  std::stringstream hist;
718  hist << std::scientific << std::setprecision(6);
719  if ( algo_state.iter == 0 ) {
720  hist << printName();
721  }
722  if ( print_header ) {
723  hist << printHeader();
724  }
725  if ( algo_state.iter == 0 ) {
726  hist << " ";
727  hist << std::setw(6) << std::left << algo_state.iter;
728  hist << std::setw(15) << std::left << algo_state.value;
729  hist << std::setw(15) << std::left << algo_state.gnorm;
730  hist << std::setw(15) << std::left << " ";
731  hist << std::setw(15) << std::left << step_state->searchSize;
732  hist << "\n";
733  }
734  else {
735  hist << " ";
736  hist << std::setw(6) << std::left << algo_state.iter;
737  hist << std::setw(15) << std::left << algo_state.value;
738  hist << std::setw(15) << std::left << algo_state.gnorm;
739  hist << std::setw(15) << std::left << algo_state.snorm;
740  hist << std::setw(15) << std::left << step_state->searchSize;
741  hist << std::setw(10) << std::left << algo_state.nfval;
742  hist << std::setw(10) << std::left << algo_state.ngrad;
743  hist << std::setw(10) << std::left << TRflag_;
745  hist << std::setw(10) << std::left << SPiter_;
746  hist << std::setw(10) << std::left << SPflag_;
747  }
748  hist << "\n";
749  }
750  return hist.str();
751  }
752 
753 }; // class Step
754 
755 } // namespace ROL
756 
757 #endif
std::string ECGFlagToString(ECGFlag cgf)
Definition: ROL_Types.hpp:801
Provides the interface to evaluate objective functions.
ESecant esec_
Secant type.
virtual const Vector & dual() const
Return dual representation of , for example, the result of applying a Riesz map, or change of basis...
Definition: ROL_Vector.hpp:192
bool bndActive_
Flag whether bound is activated.
std::string ETrustRegionModelToString(ETrustRegionModel tr)
Real mu_
Post-Smoothing tolerance for projected methods.
virtual ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
virtual void projectInterior(Vector< Real > &x)
Project optimization variables into the interior of the feasible set.
bool useSecantPrecond_
Flag whether to use a secant preconditioner.
bool isActivated(void) const
Check if bounds are on.
virtual Real value(const Vector< Real > &x, Real &tol)=0
Compute value.
Provides the interface to compute optimization steps.
Definition: ROL_Step.hpp:34
TrustRegionStep(ROL::Ptr< Secant< Real > > &secant, ROL::ParameterList &parlist)
Constructor.
void initialize(Vector< Real > &x, const Vector< Real > &s, const Vector< Real > &g, Objective< Real > &obj, BoundConstraint< Real > &bnd, AlgorithmState< Real > &algo_state)
Initialize step.
virtual void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply Hessian approximation to vector.
Contains definitions of custom data types in ROL.
bool isValidTrustRegionSubproblem(ETrustRegion etr, ETrustRegionModel etrm, bool isBnd)
Real alpha_init_
Initial line-search parameter for projected methods.
ESecant StringToESecant(std::string s)
Definition: ROL_Types.hpp:513
Defines the linear algebra or vector space interface.
Definition: ROL_Vector.hpp:46
virtual void update(const Vector< Real > &x, UpdateType type, int iter=-1)
Update objective function.
Objective_SerialSimOpt(const Ptr< Obj > &obj, const V &ui) z0_ zero()
std::string printName(void) const
Print step name.
TrustRegionStep(ROL::ParameterList &parlist)
Constructor.
Real computeCriticalityMeasure(const Vector< Real > &g, const Vector< Real > &x, BoundConstraint< Real > &bnd)
Compute the criticality measure.
ETrustRegionModel TRmodel_
Trust-region subproblem model type.
State for algorithm class. Will be used for restarts.
Definition: ROL_Types.hpp:109
Real scaleEps_
Scaling for epsilon-active sets.
virtual void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol)
Compute gradient.
std::string NumberToString(T Number)
Definition: ROL_Types.hpp:47
ETrustRegion etr_
Trust-region subproblem solver type.
std::string printHeader(void) const
Print iterate header.
void compute(Vector< Real > &s, const Vector< Real > &x, Objective< Real > &obj, BoundConstraint< Real > &bnd, AlgorithmState< Real > &algo_state)
Compute step.
ESecant
Enumeration of secant update algorithms.
Definition: ROL_Types.hpp:456
ETrustRegionModel StringToETrustRegionModel(std::string s)
int SPflag_
Subproblem solver termination flag.
ROL::Ptr< StepState< Real > > getState(void)
Definition: ROL_Step.hpp:39
ETrustRegionFlag TRflag_
Trust-region exit flag.
bool useSecantHessVec_
Flag whether to use a secant Hessian.
int SPiter_
Subproblem solver iteration count.
std::vector< bool > useInexact_
Flags for inexact (0) objective function, (1) gradient, (2) Hessian.
Provides interface for and implements limited-memory secant operators.
Definition: ROL_Secant.hpp:45
Real scale0_
Scale for inexact gradient computation.
Ptr< TrustRegionModel< Real > > model_
Container for trust-region model.
ROL::Ptr< Vector< Real > > iterateVec
Definition: ROL_Types.hpp:123
Real delMax_
Maximum trust-region radius.
virtual void invHessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply inverse Hessian approximation to vector.
Ptr< Vector< Real > > xnew_
Container for updated iteration vector.
virtual void project(Vector< Real > &x)
Project optimization variables onto the bounds.
std::string print(AlgorithmState< Real > &algo_state, bool print_header=false) const
Print iterate status.
ETrustRegionModel
Enumeration of trust-region model types.
Provides the interface to apply upper and lower bound constraints.
void computeProjectedGradient(Vector< Real > &g, const Vector< Real > &x)
Compute projected gradient.
int verbosity_
Print additional information to screen if &gt; 0.
Ptr< TrustRegion< Real > > trustRegion_
Container for trust-region solver object.
ETrustRegion StringToETrustRegion(std::string s)
Ptr< Vector< Real > > xold_
Container for previous iteration vector.
void update(Vector< Real > &x, const Vector< Real > &s, Objective< Real > &obj, BoundConstraint< Real > &bnd, AlgorithmState< Real > &algo_state)
Update step, if successful.
virtual Real norm() const =0
Returns where .
int max_fval_
Maximum function evaluations in line-search for projected methods.
Ptr< Secant< Real > > secant_
Container for secant approximation.
ETrustRegion
Enumeration of trust-region solver types.
std::string ETrustRegionFlagToString(ETrustRegionFlag trf)
ETrustRegionFlag
Enumation of flags used by trust-region solvers.
std::string ETrustRegionToString(ETrustRegion tr)
std::string ESecantToString(ESecant tr)
Definition: ROL_Types.hpp:465
bool useProjectedGrad_
Flag whether to use the projected gradient criticality measure.
Real beta_
Post-Smoothing rate for projected methods.
Real scale1_
Scale for inexact gradient computation.
void parseParameterList(ROL::ParameterList &parlist)
Parse input ParameterList.
void updateGradient(Vector< Real > &x, Objective< Real > &obj, BoundConstraint< Real > &bnd, AlgorithmState< Real > &algo_state)
Update gradient to iteratively satisfy inexactness condition.
Provides the interface to compute optimization steps with trust regions.
const ROL::Ptr< const StepState< Real > > getStepState(void) const
Get state for step object.
Definition: ROL_Step.hpp:177
Ptr< Vector< Real > > gp_
Container for previous gradient vector.