ROL
ROL_TypeB_ColemanLiAlgorithm_Def.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ************************************************************************
3 //
4 // Rapid Optimization Library (ROL) Package
5 // Copyright (2014) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact lead developers:
38 // Drew Kouri (dpkouri@sandia.gov) and
39 // Denis Ridzal (dridzal@sandia.gov)
40 //
41 // ************************************************************************
42 // @HEADER
43 
44 #ifndef ROL_TYPEB_COLEMANLIALGORITHM_DEF_HPP
45 #define ROL_TYPEB_COLEMANLIALGORITHM_DEF_HPP
46 
47 namespace ROL {
48 namespace TypeB {
49 
50 template<typename Real>
52  const Ptr<Secant<Real>> &secant) {
53  // Set status test
54  status_->reset();
55  status_->add(makePtr<StatusTest<Real>>(list));
56 
57  ParameterList &trlist = list.sublist("Step").sublist("Trust Region");
58  // Trust-Region Parameters
59  state_->searchSize = trlist.get("Initial Radius", -1.0);
60  delMax_ = trlist.get("Maximum Radius", ROL_INF<Real>());
61  eta0_ = trlist.get("Step Acceptance Threshold", 0.05);
62  eta1_ = trlist.get("Radius Shrinking Threshold", 0.05);
63  eta2_ = trlist.get("Radius Growing Threshold", 0.9);
64  gamma0_ = trlist.get("Radius Shrinking Rate (Negative rho)", 0.0625);
65  gamma1_ = trlist.get("Radius Shrinking Rate (Positive rho)", 0.25);
66  gamma2_ = trlist.get("Radius Growing Rate", 2.5);
67  TRsafe_ = trlist.get("Safeguard Size", 100.0);
68  eps_ = TRsafe_*ROL_EPSILON<Real>();
69  interpRad_ = trlist.get("Use Radius Interpolation", false);
70  // Nonmonotone Parameters
71  storageNM_ = trlist.get("Nonmonotone Storage Size", 0);
72  useNM_ = (storageNM_ <= 0 ? false : true);
73  // Krylov Parameters
74  maxit_ = list.sublist("General").sublist("Krylov").get("Iteration Limit", 20);
75  tol1_ = list.sublist("General").sublist("Krylov").get("Absolute Tolerance", 1e-4);
76  tol2_ = list.sublist("General").sublist("Krylov").get("Relative Tolerance", 1e-2);
77  // Algorithm-Specific Parameters
78  ROL::ParameterList &lmlist = trlist.sublist("Coleman-Li");
79  mu0_ = lmlist.get("Sufficient Decrease Parameter", 1e-2);
80  spexp_ = lmlist.get("Relative Tolerance Exponent", 1.0);
81  spexp_ = std::max(static_cast<Real>(1),std::min(spexp_,static_cast<Real>(2)));
82  alphaMax_ = lmlist.get("Relaxation Safeguard", 0.999);
83  alphaMax_ = (alphaMax_ >= static_cast<Real>(1) ? static_cast<Real>(0.5) : alphaMax_);
84  // Output Parameters
85  verbosity_ = list.sublist("General").get("Output Level",0);
86  writeHeader_ = verbosity_ > 2;
87  // Secant Information
88  useSecantPrecond_ = list.sublist("General").sublist("Secant").get("Use as Preconditioner", false);
89  useSecantHessVec_ = list.sublist("General").sublist("Secant").get("Use as Hessian", false);
91  if (useSecantPrecond_ && !useSecantHessVec_) mode = SECANTMODE_INVERSE;
92  else if (useSecantHessVec_ && !useSecantPrecond_) mode = SECANTMODE_FORWARD;
93  // Initialize trust region model
94  model_ = makePtr<TrustRegionModel_U<Real>>(list,secant,mode);
95  if (secant == nullPtr) {
96  esec_ = StringToESecant(list.sublist("General").sublist("Secant").get("Type","Limited-Memory BFGS"));
97  }
98 }
99 
100 template<typename Real>
102  const Vector<Real> &g,
103  Objective<Real> &obj,
105  std::ostream &outStream) {
106  const Real one(1);
107  hasEcon_ = true;
108  if (proj_ == nullPtr) {
109  proj_ = makePtr<PolyhedralProjection<Real>>(makePtrFromRef(bnd));
110  hasEcon_ = false;
111  }
112  // Initialize data
114  nhess_ = 0;
115  // Update approximate gradient and approximate objective function.
116  Real ftol = static_cast<Real>(0.1)*ROL_OVERFLOW<Real>();
117  proj_->getBoundConstraint()->projectInterior(x); state_->nproj++;
118  state_->iterateVec->set(x);
119  obj.update(x,UpdateType::Initial,state_->iter);
120  state_->value = obj.value(x,ftol);
121  state_->nfval++;
122  obj.gradient(*state_->gradientVec,x,ftol);
123  state_->ngrad++;
124  state_->stepVec->set(x);
125  state_->stepVec->axpy(-one,state_->gradientVec->dual());
126  proj_->project(*state_->stepVec,outStream); state_->nproj++;
127  state_->stepVec->axpy(-one,x);
128  state_->gnorm = state_->stepVec->norm();
129  state_->snorm = ROL_INF<Real>();
130  // Compute initial trust region radius if desired.
131  if ( state_->searchSize <= static_cast<Real>(0) ) {
132  state_->searchSize = state_->gradientVec->norm();
133  }
134  // Initialize null space projection
135  if (hasEcon_) {
136  rcon_ = makePtr<ReducedLinearConstraint<Real>>(proj_->getLinearConstraint(),
137  makePtrFromRef(bnd),
138  makePtrFromRef(x));
139  ns_ = makePtr<NullSpaceOperator<Real>>(rcon_,x,
140  *proj_->getResidual());
141  }
142 }
143 
144 template<typename Real>
146  const Vector<Real> &g,
147  Objective<Real> &obj,
149  std::ostream &outStream ) {
150  const Real zero(0), one(1), half(0.5);
151  Real tol0 = std::sqrt(ROL_EPSILON<Real>());
152  Real tol(0), stol(0), snorm(0);
153  Real ftrial(0), pRed(0), rho(1), alpha(1);
154  // Initialize trust-region data
155  initialize(x,g,obj,bnd,outStream);
156  Ptr<Vector<Real>> pwa1 = x.clone(), pwa2 = x.clone(), pwa3 = x.clone();
157  Ptr<Vector<Real>> pwa4 = x.clone(), pwa5 = x.clone();
158  Ptr<Vector<Real>> dwa1 = g.clone(), dwa2 = g.clone(), dwa3 = g.clone();
159  // Initialize nonmonotone data
160  Real rhoNM(0), sigmac(0), sigmar(0), sBs(0), gs(0);
161  Real fr(state_->value), fc(state_->value), fmin(state_->value);
162  TRUtils::ETRFlag TRflagNM;
163  int L(0);
164 
165  // Output
166  if (verbosity_ > 0) writeOutput(outStream,true);
167 
168  while (status_->check(*state_)) {
169  // Build trust-region model (use only to encapsulate Hessian/secant)
170  model_->setData(obj,*state_->iterateVec,*state_->gradientVec,tol0);
171 
172  // Run Truncated CG
173  // TODO: Model is: 1/2 (x-xk)' (B + Einv(D)) + g'(x-xk)
174  // applyHessian returns (B+Einv(D))v
175  SPflag_ = 0;
176  SPiter_ = 0;
177  tol = std::min(tol1_,tol2_*std::pow(state_->gnorm,spexp_));
178  stol = tol; //zero;
179  pwa5->set(state_->gradientVec->dual());
180  snorm = dtrpcg(*state_->stepVec,SPflag_,SPiter_,*state_->gradientVec,x,*pwa5,
181  state_->searchSize,*model_,bnd,tol,stol,
182  *pwa1,*dwa1,*pwa2,*dwa2,*pwa3,*pwa4,*dwa3,outStream);
183  if (verbosity_ > 1) {
184  outStream << " Computation of CG step" << std::endl;
185  outStream << " CG step length: " << snorm << std::endl;
186  outStream << " Number of CG iterations: " << SPiter_ << std::endl;
187  outStream << " CG flag: " << SPflag_ << std::endl;
188  outStream << std::endl;
189  }
190 
191  // Relax CG step so that it is interior
192  snorm = dgpstep(*pwa1,*state_->stepVec,x,one,outStream);
193  alpha = std::max(alphaMax_, one-snorm);
194  pwa1->scale(alpha);
195  state_->stepVec->set(*pwa1);
196  state_->snorm = alpha * snorm;
197  x.plus(*state_->stepVec);
198 
199  // Compute predicted reduction
200  model_->hessVec(*dwa1,*pwa1,x,tol); nhess_++;
201  gs = state_->gradientVec->apply(*state_->stepVec);
202  sBs = dwa1->apply(*state_->stepVec);
203  pRed = - half * sBs - gs;
204 
205  // Compute trial objective value
206  obj.update(x,UpdateType::Trial);
207  ftrial = obj.value(x,tol0);
208  state_->nfval++;
209 
210  // Compute ratio of acutal and predicted reduction
211  TRflag_ = TRUtils::SUCCESS;
212  TRUtils::analyzeRatio<Real>(rho,TRflag_,state_->value,ftrial,pRed,eps_,outStream,verbosity_>1);
213  if (useNM_) {
214  TRUtils::analyzeRatio<Real>(rhoNM,TRflagNM,fr,ftrial,pRed+sigmar,eps_,outStream,verbosity_>1);
215  TRflag_ = (rho < rhoNM ? TRflagNM : TRflag_);
216  rho = (rho < rhoNM ? rhoNM : rho );
217  }
218 
219  // Update algorithm state
220  state_->iter++;
221  // Accept/reject step and update trust region radius
222  if ((rho < eta0_ && TRflag_ == TRUtils::SUCCESS) || (TRflag_ >= 2)) { // Step Rejected
223  x.set(*state_->iterateVec);
224  obj.update(x,UpdateType::Revert,state_->iter);
225  if (interpRad_ && (rho < zero && TRflag_ != TRUtils::TRNAN)) {
226  // Negative reduction, interpolate to find new trust-region radius
227  state_->searchSize = TRUtils::interpolateRadius<Real>(*state_->gradientVec,*state_->stepVec,
228  state_->snorm,pRed,state_->value,ftrial,state_->searchSize,gamma0_,gamma1_,eta2_,
229  outStream,verbosity_>1);
230  }
231  else { // Shrink trust-region radius
232  state_->searchSize = gamma1_*std::min(state_->snorm,state_->searchSize);
233  }
234  }
235  else if ((rho >= eta0_ && TRflag_ != TRUtils::NPOSPREDNEG)
236  || (TRflag_ == TRUtils::POSPREDNEG)) { // Step Accepted
237  state_->value = ftrial;
238  obj.update(x,UpdateType::Accept,state_->iter);
239  if (useNM_) {
240  sigmac += pRed; sigmar += pRed;
241  if (ftrial < fmin) { fmin = ftrial; fc = fmin; sigmac = zero; L = 0; }
242  else {
243  L++;
244  if (ftrial > fc) { fc = ftrial; sigmac = zero; }
245  if (L == storageNM_) { fr = fc; sigmar = sigmac; }
246  }
247  }
248  // Increase trust-region radius
249  if (rho >= eta2_) state_->searchSize = std::min(gamma2_*state_->searchSize, delMax_);
250  // Compute gradient at new iterate
251  dwa1->set(*state_->gradientVec);
252  obj.gradient(*state_->gradientVec,x,tol0);
253  state_->ngrad++;
254  state_->gnorm = TypeB::Algorithm<Real>::optimalityCriterion(x,*state_->gradientVec,*pwa1,outStream);
255  state_->iterateVec->set(x);
256  // Update secant information in trust-region model
257  model_->update(x,*state_->stepVec,*dwa1,*state_->gradientVec,
258  state_->snorm,state_->iter);
259  }
260 
261  // Update Output
262  if (verbosity_ > 0) writeOutput(outStream,writeHeader_);
263  }
264  if (verbosity_ > 0) TypeB::Algorithm<Real>::writeExitStatus(outStream);
265 }
266 
267 template<typename Real>
269  const Vector<Real> &x, const Real alpha,
270  std::ostream &outStream) const {
271  s.set(x); s.axpy(alpha,w);
272  proj_->getBoundConstraint()->projectInterior(s); state_->nproj++;
273  s.axpy(static_cast<Real>(-1),x);
274  return s.norm();
275 }
276 
277 template<typename Real>
279  const Real ptp,
280  const Real ptx,
281  const Real del) const {
282  const Real zero(0);
283  Real dsq = del*del;
284  Real rad = ptx*ptx + ptp*(dsq-xtx);
285  rad = std::sqrt(std::max(rad,zero));
286  Real sigma(0);
287  if (ptx > zero) {
288  sigma = (dsq-xtx)/(ptx+rad);
289  }
290  else if (rad > zero) {
291  sigma = (rad-ptx)/ptp;
292  }
293  else {
294  sigma = zero;
295  }
296  return sigma;
297 }
298 
299 template<typename Real>
300 Real ColemanLiAlgorithm<Real>::dtrpcg(Vector<Real> &w, int &iflag, int &iter,
301  const Vector<Real> &g, const Vector<Real> &x,
302  const Vector<Real> &gdual,
303  const Real del, TrustRegionModel_U<Real> &model,
305  const Real tol, const Real stol,
307  Vector<Real> &t, Vector<Real> &pwa1,
308  Vector<Real> &pwa2, Vector<Real> &dwa,
309  std::ostream &outStream) const {
310  // p = step (primal)
311  // q = hessian applied to step p (dual)
312  // t = gradient (dual)
313  // r = preconditioned gradient (primal)
314  Real tol0 = std::sqrt(ROL_EPSILON<Real>());
315  const Real zero(0), one(1), two(2);
316  Real rho(0), kappa(0), beta(0), sigma(0), alpha(0);
317  Real rtr(0), tnorm(0), sMs(0), pMp(0), sMp(0);
318  iter = 0; iflag = 0;
319  // Initialize step
320  w.zero();
321  // Compute residual
322  t.set(g); t.scale(-one);
323  // Preconditioned residual
324  applyPrecond(r,t,x,gdual,model,bnd,tol0,dwa,pwa1);
325  //rho = r.dot(t.dual());
326  rho = r.apply(t);
327  // Initialize direction
328  p.set(r);
329  pMp = (!hasEcon_ ? rho : p.dot(p)); // If no equality constraint, used preconditioned norm
330  // Iterate CG
331  for (iter = 0; iter < maxit_; ++iter) {
332  // Apply Hessian to direction dir
333  applyHessian(q,p,x,gdual,model,bnd,tol0,pwa1,pwa2);
334  // Compute sigma such that ||s+sigma*dir|| = del
335  //kappa = p.dot(q.dual());
336  kappa = p.apply(q);
337  alpha = (kappa>zero) ? rho/kappa : zero;
338  sigma = dtrqsol(sMs,pMp,sMp,del);
339  // Check for negative curvature or if iterate exceeds trust region
340  if (kappa <= zero || alpha >= sigma) {
341  w.axpy(sigma,p);
342  sMs = del*del;
343  iflag = (kappa<=zero) ? 2 : 3;
344  break;
345  }
346  // Update iterate and residuals
347  w.axpy(alpha,p);
348  t.axpy(-alpha,q);
349  applyPrecond(r,t,x,gdual,model,bnd,tol0,dwa,pwa1);
350  // Exit if residual tolerance is met
351  //rtr = r.dot(t.dual());
352  rtr = r.apply(t);
353  tnorm = t.norm();
354  if (rtr <= stol*stol || tnorm <= tol) {
355  sMs = sMs + two*alpha*sMp + alpha*alpha*pMp;
356  iflag = 0;
357  break;
358  }
359  // Compute p = r + beta * p
360  beta = rtr/rho;
361  p.scale(beta); p.plus(r);
362  rho = rtr;
363  // Update dot products
364  // sMs = <s, inv(M)s> or <s, s> if equality constraint present
365  // sMp = <s, inv(M)p> or <s, p> if equality constraint present
366  // pMp = <p, inv(M)p> or <p, p> if equality constraint present
367  sMs = sMs + two*alpha*sMp + alpha*alpha*pMp;
368  sMp = beta*(sMp + alpha*pMp);
369  pMp = (!hasEcon_ ? rho : p.dot(p)) + beta*beta*pMp;
370  }
371  // Check iteration count
372  if (iter == maxit_) {
373  iflag = 1;
374  }
375  if (iflag != 1) {
376  iter++;
377  }
378  return std::sqrt(sMs); // w.norm();
379 }
380 
381 template<typename Real>
383  const Vector<Real> &v,
384  const Vector<Real> &x,
385  const Vector<Real> &g,
387  Vector<Real> &pwa) const {
388  bnd.applyInverseScalingFunction(pwa,v,x,g);
389  bnd.applyScalingFunctionJacobian(Cv,pwa,x,g);
390 }
391 
392 template<typename Real>
394  const Vector<Real> &v,
395  const Vector<Real> &x,
396  const Vector<Real> &g,
399  Real &tol,
400  Vector<Real> &pwa1,
401  Vector<Real> &pwa2) const {
402  model.hessVec(hv,v,x,tol); nhess_++;
403  applyC(pwa2,v,x,g,bnd,pwa1);
404  hv.plus(pwa2.dual());
405 }
406 
407 template<typename Real>
409  const Vector<Real> &v,
410  const Vector<Real> &x,
411  const Vector<Real> &g,
414  Real &tol,
415  Vector<Real> &dwa,
416  Vector<Real> &pwa) const {
417  model.precond(hv,v,x,tol);
418 }
419 
420 template<typename Real>
421 void ColemanLiAlgorithm<Real>::writeHeader( std::ostream& os ) const {
422  std::ios_base::fmtflags osFlags(os.flags());
423  if (verbosity_ > 1) {
424  os << std::string(114,'-') << std::endl;
425  os << " Coleman-Li affine-scaling trust-region method status output definitions" << std::endl << std::endl;
426  os << " iter - Number of iterates (steps taken)" << std::endl;
427  os << " value - Objective function value" << std::endl;
428  os << " gnorm - Norm of the gradient" << std::endl;
429  os << " snorm - Norm of the step (update to optimization vector)" << std::endl;
430  os << " delta - Trust-Region radius" << std::endl;
431  os << " #fval - Number of times the objective function was evaluated" << std::endl;
432  os << " #grad - Number of times the gradient was computed" << std::endl;
433  os << " #hess - Number of times the Hessian was applied" << std::endl;
434  os << " #proj - Number of times the projection was applied" << std::endl;
435  os << std::endl;
436  os << " tr_flag - Trust-Region flag" << std::endl;
437  for( int flag = TRUtils::SUCCESS; flag != TRUtils::UNDEFINED; ++flag ) {
438  os << " " << NumberToString(flag) << " - "
439  << TRUtils::ETRFlagToString(static_cast<TRUtils::ETRFlag>(flag)) << std::endl;
440  }
441  os << std::endl;
442  os << " iterCG - Number of Truncated CG iterations" << std::endl << std::endl;
443  os << " flagGC - Trust-Region Truncated CG flag" << std::endl;
444  for( int flag = CG_FLAG_SUCCESS; flag != CG_FLAG_UNDEFINED; ++flag ) {
445  os << " " << NumberToString(flag) << " - "
446  << ECGFlagToString(static_cast<ECGFlag>(flag)) << std::endl;
447  }
448  os << std::string(114,'-') << std::endl;
449  }
450  os << " ";
451  os << std::setw(6) << std::left << "iter";
452  os << std::setw(15) << std::left << "value";
453  os << std::setw(15) << std::left << "gnorm";
454  os << std::setw(15) << std::left << "snorm";
455  os << std::setw(15) << std::left << "delta";
456  os << std::setw(10) << std::left << "#fval";
457  os << std::setw(10) << std::left << "#grad";
458  os << std::setw(10) << std::left << "#hess";
459  os << std::setw(10) << std::left << "#proj";
460  os << std::setw(10) << std::left << "tr_flag";
461  os << std::setw(10) << std::left << "iterCG";
462  os << std::setw(10) << std::left << "flagCG";
463  os << std::endl;
464  os.flags(osFlags);
465 }
466 
467 template<typename Real>
468 void ColemanLiAlgorithm<Real>::writeName( std::ostream& os ) const {
469  std::ios_base::fmtflags osFlags(os.flags());
470  os << std::endl << "Coleman-Li Affine-Scaling Trust-Region Method (Type B, Bound Constraints)" << std::endl;
471  os.flags(osFlags);
472 }
473 
474 template<typename Real>
475 void ColemanLiAlgorithm<Real>::writeOutput( std::ostream& os, bool write_header ) const {
476  std::ios_base::fmtflags osFlags(os.flags());
477  os << std::scientific << std::setprecision(6);
478  if ( state_->iter == 0 ) writeName(os);
479  if ( write_header ) writeHeader(os);
480  if ( state_->iter == 0 ) {
481  os << " ";
482  os << std::setw(6) << std::left << state_->iter;
483  os << std::setw(15) << std::left << state_->value;
484  os << std::setw(15) << std::left << state_->gnorm;
485  os << std::setw(15) << std::left << "---";
486  os << std::setw(15) << std::left << state_->searchSize;
487  os << std::setw(10) << std::left << state_->nfval;
488  os << std::setw(10) << std::left << state_->ngrad;
489  os << std::setw(10) << std::left << nhess_;
490  os << std::setw(10) << std::left << state_->nproj;
491  os << std::setw(10) << std::left << "---";
492  os << std::setw(10) << std::left << "---";
493  os << std::setw(10) << std::left << "---";
494  os << std::endl;
495  }
496  else {
497  os << " ";
498  os << std::setw(6) << std::left << state_->iter;
499  os << std::setw(15) << std::left << state_->value;
500  os << std::setw(15) << std::left << state_->gnorm;
501  os << std::setw(15) << std::left << state_->snorm;
502  os << std::setw(15) << std::left << state_->searchSize;
503  os << std::setw(10) << std::left << state_->nfval;
504  os << std::setw(10) << std::left << state_->ngrad;
505  os << std::setw(10) << std::left << nhess_;
506  os << std::setw(10) << std::left << state_->nproj;
507  os << std::setw(10) << std::left << TRflag_;
508  os << std::setw(10) << std::left << SPiter_;
509  os << std::setw(10) << std::left << SPflag_;
510  os << std::endl;
511  }
512  os.flags(osFlags);
513 }
514 
515 } // namespace TypeB
516 } // namespace ROL
517 
518 #endif
std::string ECGFlagToString(ECGFlag cgf)
Definition: ROL_Types.hpp:831
Provides the interface to evaluate objective functions.
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:226
virtual void scale(const Real alpha)=0
Compute where .
virtual ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
virtual Real apply(const Vector< Real > &x) const
Apply to a dual vector. This is equivalent to the call .
Definition: ROL_Vector.hpp:238
virtual void plus(const Vector &x)=0
Compute , where .
virtual void axpy(const Real alpha, const Vector &x)
Compute where .
Definition: ROL_Vector.hpp:153
virtual Real value(const Vector< Real > &x, Real &tol)=0
Compute value.
Real dtrpcg(Vector< Real > &w, int &iflag, int &iter, const Vector< Real > &g, const Vector< Real > &x, const Vector< Real > &gdual, const Real del, TrustRegionModel_U< Real > &model, BoundConstraint< Real > &bnd, const Real tol, const Real stol, Vector< Real > &p, Vector< Real > &q, Vector< Real > &r, Vector< Real > &t, Vector< Real > &pwa1, Vector< Real > &pwa2, Vector< Real > &dwa, std::ostream &outStream=std::cout) const
void writeHeader(std::ostream &os) const override
Print iterate header.
virtual void writeExitStatus(std::ostream &os) const
ESecant StringToESecant(std::string s)
Definition: ROL_Types.hpp:543
virtual void zero()
Set to zero vector.
Definition: ROL_Vector.hpp:167
Defines the linear algebra or vector space interface.
Definition: ROL_Vector.hpp:80
void writeName(std::ostream &os) const override
Print step name.
virtual void update(const Vector< Real > &x, UpdateType type, int iter=-1)
Update objective function.
virtual Real dot(const Vector &x) const =0
Compute where .
Objective_SerialSimOpt(const Ptr< Obj > &obj, const V &ui) z0_ zero()
virtual void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &s, Real &tol) override
Apply Hessian approximation to vector.
ETRFlag
Enumation of flags used by trust-region solvers.
virtual void applyInverseScalingFunction(Vector< Real > &dv, const Vector< Real > &v, const Vector< Real > &x, const Vector< Real > &g) const
Apply inverse scaling function.
virtual void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol)
Compute gradient.
std::string NumberToString(T Number)
Definition: ROL_Types.hpp:81
void applyC(Vector< Real > &Cv, const Vector< Real > &v, const Vector< Real > &x, const Vector< Real > &g, BoundConstraint< Real > &bnd, Vector< Real > &pwa) const
Provides the interface to evaluate trust-region model functions.
Real dgpstep(Vector< Real > &s, const Vector< Real > &w, const Vector< Real > &x, const Real alpha, std::ostream &outStream=std::cout) const
ESecantMode
Definition: ROL_Secant.hpp:57
Provides interface for and implements limited-memory secant operators.
Definition: ROL_Secant.hpp:79
Real dtrqsol(const Real xtx, const Real ptp, const Real ptx, const Real del) const
Provides an interface to check status of optimization algorithms.
std::string ETRFlagToString(ETRFlag trf)
void writeOutput(std::ostream &os, const bool write_header=false) const override
Print iterate status.
Provides the interface to apply upper and lower bound constraints.
Real optimalityCriterion(const Vector< Real > &x, const Vector< Real > &g, Vector< Real > &primal, std::ostream &outStream=std::cout) const
void initialize(const Vector< Real > &x, const Vector< Real > &g)
virtual void applyScalingFunctionJacobian(Vector< Real > &dv, const Vector< Real > &v, const Vector< Real > &x, const Vector< Real > &g) const
Apply scaling function Jacobian.
void applyHessian(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, const Vector< Real > &g, TrustRegionModel_U< Real > &model, BoundConstraint< Real > &bnd, Real &tol, Vector< Real > &pwa1, Vector< Real > &pwa2) const
virtual void set(const Vector &x)
Set where .
Definition: ROL_Vector.hpp:209
virtual Real norm() const =0
Returns where .
void run(Vector< Real > &x, const Vector< Real > &g, Objective< Real > &obj, BoundConstraint< Real > &bnd, std::ostream &outStream=std::cout) override
Run algorithm on bound constrained problems (Type-B). This general interface supports the use of dual...
ColemanLiAlgorithm(ParameterList &list, const Ptr< Secant< Real >> &secant=nullPtr)
void initialize(Vector< Real > &x, const Vector< Real > &g, Objective< Real > &obj, BoundConstraint< Real > &bnd, std::ostream &outStream=std::cout)
virtual void precond(Vector< Real > &Pv, const Vector< Real > &v, const Vector< Real > &s, Real &tol) override
Apply preconditioner to vector.
void applyPrecond(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, const Vector< Real > &g, TrustRegionModel_U< Real > &model, BoundConstraint< Real > &bnd, Real &tol, Vector< Real > &dwa, Vector< Real > &pwa) const