45#ifndef ROL_DOUGLASRACHFORDPROJECTION_DEF_H
46#define ROL_DOUGLASRACHFORDPROJECTION_DEF_H
50template<
typename Real>
85 mul_->setScalar(
static_cast<Real
>(1));
86 con_->applyAdjointJacobian(*
z_,*
mul_,xprim,tol);
93template<
typename Real>
102 atol_ = list.sublist(
"General").sublist(
"Polyhedral Projection").get(
"Absolute Tolerance",
DEFAULT_atol_);
103 rtol_ = list.sublist(
"General").sublist(
"Polyhedral Projection").get(
"Relative Tolerance",
DEFAULT_rtol_);
104 maxit_ = list.sublist(
"General").sublist(
"Polyhedral Projection").get(
"Iteration Limit",
DEFAULT_maxit_);
106 alpha1_ = list.sublist(
"General").sublist(
"Polyhedral Projection").sublist(
"Douglas-Rachford").get(
"Constraint Weight",
DEFAULT_alpha1_);
108 gamma_ = list.sublist(
"General").sublist(
"Polyhedral Projection").sublist(
"Douglas-Rachford").get(
"Penalty Parameter",
DEFAULT_gamma_);
109 t0_ = list.sublist(
"General").sublist(
"Polyhedral Projection").sublist(
"Douglas-Rachford").get(
"Relaxation Parameter",
DEFAULT_t0_);
112template<
typename Real>
114 if (
con_ == nullPtr) {
122template<
typename Real>
127template<
typename Real>
131 con_->value(r,y,tol);
134template<
typename Real>
140template<
typename Real>
144 Real lam = -rhs/
cdot_;
152 x.
scale(
static_cast<Real
>(-1));
157template<
typename Real>
159 const Real one(1), two(2), xnorm(x.
norm()), ctol(std::min(
atol_,
rtol_*xnorm));
161 p_->zero();
q_->zero();
y_->set(x);
162 std::ios_base::fmtflags streamFlags(stream.flags());
164 stream << std::scientific << std::setprecision(6);
166 stream <<
" Polyhedral Projection using Douglas Rachford Splitting" << std::endl;
168 stream << std::setw(6) << std::left <<
"iter";
169 stream << std::setw(15) << std::left <<
"error";
170 stream << std::setw(15) << std::left <<
"tol";
173 for (
int cnt=0; cnt <
maxit_; ++cnt) {
189 rnorm =
tmp_->norm();
192 stream << std::setw(6) << std::left << cnt;
193 stream << std::setw(15) << std::left << rnorm;
194 stream << std::setw(15) << std::left << ctol;
197 if (rnorm <= ctol)
break;
204 stream <<
">>> ROL::PolyhedralProjection::project : Projection may be inaccurate! rnorm = ";
205 stream << rnorm <<
" rtol = " << ctol << std::endl;
207 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.