45#ifndef ROL_SEMISMOOTHNEWTONPROJECTION_DEF_H
46#define ROL_SEMISMOOTHNEWTONPROJECTION_DEF_H
50template<
typename Real>
86 list.sublist(
"General").sublist(
"Krylov").set(
"Type",
"Conjugate Gradients");
87 list.sublist(
"General").sublist(
"Krylov").set(
"Absolute Tolerance", 1e-6);
88 list.sublist(
"General").sublist(
"Krylov").set(
"Relative Tolerance", 1e-4);
89 list.sublist(
"General").sublist(
"Krylov").set(
"Iteration Limit",
dim_);
90 list.sublist(
"General").set(
"Inexact Hessian-Times-A-Vector",
false);
96template<
typename Real>
131 ParameterList &ppl = list.sublist(
"General").sublist(
"Polyhedral Projection");
135 decr_ = ppl.sublist(
"Semismooth Newton").get(
"Sufficient Decrease Tolerance",
DEFAULT_decr_);
145 klist.sublist(
"General").sublist(
"Krylov") = ppl.sublist(
"Semismooth Newton").sublist(
"Krylov");
146 klist.sublist(
"General").set(
"Inexact Hessian-Times-A-Vector",
false);
152template<
typename Real>
154 if (
con_ == nullPtr) {
162template<
typename Real>
166 con_->value(r,y,tol);
170template<
typename Real>
178 Ptr<Precond> M = makePtr<Precond>(mu);
180 krylov_->run(s,*J,r,*M,iter,flag);
183template<
typename Real>
190 con_->applyAdjointJacobian(*
xdual_,lam,x,tol);
195template<
typename Real>
199 std::ostream &stream)
const {
200 const Real
zero(0), half(0.5), one(1);
208 Real alpha(1), tmp(0), mu(0), rho(1), dd(0);
209 int iter(0), flag(0);
210 std::ios_base::fmtflags streamFlags(stream.flags());
213 stream << std::scientific << std::setprecision(6);
214 stream <<
" Polyhedral Projection using Dual Semismooth Newton" << std::endl;
216 stream << std::setw(6) << std::left <<
"iter";
217 stream << std::setw(15) << std::left <<
"rnorm";
218 stream << std::setw(15) << std::left <<
"alpha";
219 stream << std::setw(15) << std::left <<
"mu";
220 stream << std::setw(15) << std::left <<
"rho";
221 stream << std::setw(15) << std::left <<
"rtol";
222 stream << std::setw(8) << std::left <<
"kiter";
223 stream << std::setw(8) << std::left <<
"kflag";
226 for (
int cnt = 0; cnt <
maxit_; ++cnt) {
228 mu =
regscale_*std::max(rnorm,std::sqrt(rnorm));
229 rho = std::min(half,
errscale_*std::min(std::sqrt(rnorm),rnorm));
236 while ( tmp > (one-
decr_*alpha)*rnorm && alpha >
stol_ ) {
249 while ( tmp <
decr_*(one-rho)*mu*dd && alpha >
stol_ ) {
262 lam.
axpy(-alpha*tmp/(rnorm*rnorm),
res_->dual());
268 stream << std::setw(6) << std::left << cnt;
269 stream << std::setw(15) << std::left << rnorm;
270 stream << std::setw(15) << std::left << alpha;
271 stream << std::setw(15) << std::left << mu;
272 stream << std::setw(15) << std::left << rho;
273 stream << std::setw(15) << std::left <<
ctol_;
274 stream << std::setw(8) << std::left << iter;
275 stream << std::setw(8) << std::left << flag;
278 if (rnorm <=
ctol_)
break;
286 stream <<
">>> ROL::PolyhedralProjection::project : Projection may be inaccurate! rnorm = ";
287 stream << rnorm <<
" rtol = " <<
ctol_ << std::endl;
290 stream.flags(streamFlags);
293template<
typename Real>
299 Real res0 = std::max(resl,resu);
300 if (res0 <
atol_) res0 =
static_cast<Real
>(1);
Objective_SerialSimOpt(const Ptr< Obj > &obj, const V &ui) z0 zero)()
Provides the interface to apply upper and lower bound constraints.
Defines the general constraint operator interface.
const Ptr< Constraint< Real > > con_
Ptr< Vector< Real > > xprim_
const Ptr< BoundConstraint< Real > > bnd_
Ptr< Vector< Real > > mul_
Ptr< Vector< Real > > xdual_
Ptr< Vector< Real > > res_
PolyhedralProjection(const Ptr< BoundConstraint< Real > > &bnd)
Ptr< Vector< Real > > dlam_
Ptr< Vector< Real > > lnew_
Ptr< Vector< Real > > xnew_
void update_primal(Vector< Real > &y, const Vector< Real > &x, const Vector< Real > &lam) const
void solve_newton_system(Vector< Real > &s, const Vector< Real > &r, const Vector< Real > &y, const Real mu, const Real rho, int &iter, int &flag) const
void project_ssn(Vector< Real > &x, Vector< Real > &lam, Vector< Real > &dlam, std::ostream &stream=std::cout) const
SemismoothNewtonProjection(const Vector< Real > &xprim, const Vector< Real > &xdual, const Ptr< BoundConstraint< Real > > &bnd, const Ptr< Constraint< Real > > &con, const Vector< Real > &mul, const Vector< Real > &res)
Ptr< Krylov< Real > > krylov_
void project(Vector< Real > &x, std::ostream &stream=std::cout) override
Real compute_tolerance() const
Real residual(Vector< Real > &r, const Vector< Real > &y) const
Defines the linear algebra or vector space interface.
virtual Real apply(const Vector< Real > &x) const
Apply to a dual vector. This is equivalent to the call .
virtual Real norm() const =0
Returns where .
virtual void set(const Vector &x)
Set where .
virtual void plus(const Vector &x)=0
Compute , where .
virtual ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
virtual int dimension() const
Return dimension of the vector space.
virtual void axpy(const Real alpha, const Vector &x)
Compute where .
virtual Real dot(const Vector &x) const =0
Compute where .
Real ROL_EPSILON(void)
Platform-dependent machine epsilon.
Ptr< Krylov< Real > > KrylovFactory(ParameterList &parlist)