10#ifndef ROL_DOUGLASRACHFORDPROJECTION_DEF_H
11#define ROL_DOUGLASRACHFORDPROJECTION_DEF_H
15template<
typename Real>
50 mul_->setScalar(
static_cast<Real
>(1));
51 con_->applyAdjointJacobian(*
z_,*
mul_,xprim,tol);
58template<
typename Real>
67 atol_ = list.sublist(
"General").sublist(
"Polyhedral Projection").get(
"Absolute Tolerance",
DEFAULT_atol_);
68 rtol_ = list.sublist(
"General").sublist(
"Polyhedral Projection").get(
"Relative Tolerance",
DEFAULT_rtol_);
69 maxit_ = list.sublist(
"General").sublist(
"Polyhedral Projection").get(
"Iteration Limit",
DEFAULT_maxit_);
71 alpha1_ = list.sublist(
"General").sublist(
"Polyhedral Projection").sublist(
"Douglas-Rachford").get(
"Constraint Weight",
DEFAULT_alpha1_);
73 gamma_ = list.sublist(
"General").sublist(
"Polyhedral Projection").sublist(
"Douglas-Rachford").get(
"Penalty Parameter",
DEFAULT_gamma_);
74 t0_ = list.sublist(
"General").sublist(
"Polyhedral Projection").sublist(
"Douglas-Rachford").get(
"Relaxation Parameter",
DEFAULT_t0_);
77template<
typename Real>
79 if (
con_ == nullPtr) {
87template<
typename Real>
92template<
typename Real>
99template<
typename Real>
105template<
typename Real>
109 Real lam = -rhs/
cdot_;
117 x.
scale(
static_cast<Real
>(-1));
122template<
typename Real>
124 const Real one(1), two(2), xnorm(x.
norm()), ctol(std::min(
atol_,
rtol_*xnorm));
126 p_->zero();
q_->zero();
y_->set(x);
127 std::ios_base::fmtflags streamFlags(stream.flags());
129 stream << std::scientific << std::setprecision(6);
131 stream <<
" Polyhedral Projection using Douglas Rachford Splitting" << std::endl;
133 stream << std::setw(6) << std::left <<
"iter";
134 stream << std::setw(15) << std::left <<
"error";
135 stream << std::setw(15) << std::left <<
"tol";
138 for (
int cnt=0; cnt <
maxit_; ++cnt) {
154 rnorm =
tmp_->norm();
157 stream << std::setw(6) << std::left << cnt;
158 stream << std::setw(15) << std::left << rnorm;
159 stream << std::setw(15) << std::left << ctol;
162 if (rnorm <= ctol)
break;
169 stream <<
">>> ROL::PolyhedralProjection::project : Projection may be inaccurate! rnorm = ";
170 stream << rnorm <<
" rtol = " << ctol << std::endl;
172 stream.flags(streamFlags);
Provides the interface to apply upper and lower bound constraints.
Defines the general constraint operator interface.
void project(Vector< Real > &x, std::ostream &stream=std::cout) override
Real residual_1d(const Vector< Real > &x) const
DouglasRachfordProjection(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)
void project_DouglasRachford(Vector< Real > &x, std::ostream &stream=std::cout) const
void project_bnd(Vector< Real > &x, const Vector< Real > &y) const
void project_con(Vector< Real > &x, const Vector< Real > &y) const
void residual_nd(Vector< Real > &r, const Vector< Real > &y) const
Ptr< Vector< Real > > tmp_
const Ptr< Constraint< Real > > con_
Ptr< Vector< Real > > xprim_
const Ptr< BoundConstraint< Real > > bnd_
Ptr< Vector< Real > > mul_
Ptr< Vector< Real > > res_
PolyhedralProjection(const Ptr< BoundConstraint< Real > > &bnd)
Defines the linear algebra or vector space interface.
virtual Real norm() const =0
Returns where .
virtual void set(const Vector &x)
Set where .
virtual void scale(const Real alpha)=0
Compute 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 .
Real ROL_EPSILON(void)
Platform-dependent machine epsilon.