10#ifndef ROL_PRIMALDUALINTERIORPOINTRESIDUAL_H
11#define ROL_PRIMALDUALINTERIORPOINTRESIDUAL_H
44class PrimalDualInteriorPointResidual :
public Constraint<Real> {
46 typedef ROL::ParameterList
PL;
65 const ROL::Ptr<OBJ>
obj_;
66 const ROL::Ptr<CON>
con_;
71 ROL::Ptr<const V>
zl_;
72 ROL::Ptr<const V>
zu_;
74 ROL::Ptr<const V>
xl_;
75 ROL::Ptr<const V>
xu_;
77 const ROL::Ptr<const V>
maskL_;
78 const ROL::Ptr<const V>
maskU_;
93 Elementwise::Multiply<Real>
mult_;
95 class SafeDivide :
public Elementwise::BinaryFunction<Real> {
97 Real
apply(
const Real &x,
const Real &y )
const {
98 return y != 0 ? x/y : 0;
104 class SetZeros :
public Elementwise::BinaryFunction<Real> {
106 Real
apply(
const Real &x,
const Real &y )
const {
107 return y==1.0 ? 0 : x;
114 class InFill :
public Elementwise::BinaryFunction<Real> {
116 Real
apply(
const Real &x,
const Real &y )
const {
117 return x == 0 ? y : x;
125 PV &vec_pv =
dynamic_cast<PV&
>(vec);
132 const PV &vec_pv =
dynamic_cast<const PV&
>(vec);
143 const ROL::Ptr<CON> &con,
144 const ROL::Ptr<BND> &bnd,
146 const ROL::Ptr<const V> &maskL,
147 const ROL::Ptr<const V> &maskU,
148 ROL::Ptr<V> &scratch,
149 Real mu,
bool symmetrize ) :
156 const PV &x_pv =
dynamic_cast<const PV&
>(x);
169 const PV &x_pv =
dynamic_cast<const PV&
>(x);
176 obj_->update(*
x_,flag,iter);
177 con_->update(*
x_,flag,iter);
187 Elementwise::Shift<Real> subtract_mu(-
mu_);
188 Elementwise::Fill<Real> fill_minus_mu(-
mu_);
190 const PV &x_pv =
dynamic_cast<const PV&
>(x);
191 PV &c_pv =
dynamic_cast<PV&
>(c);
198 ROL::Ptr<V> cx = c_pv.
get(
OPT);
206 obj_->gradient(*cx,*
x_,tol);
228 czl->applyUnary(fill_minus_mu);
239 czl->axpy(-1.0,*
xl_);
241 czl->applyUnary(subtract_mu);
252 czu->applyUnary(fill_minus_mu);
265 czu->applyUnary(subtract_mu);
284 PV &jv_pv =
dynamic_cast<PV&
>(jv);
285 const PV &v_pv =
dynamic_cast<const PV&
>(v);
286 const PV &x_pv =
dynamic_cast<const PV&
>(x);
289 ROL::Ptr<V> jvx = jv_pv.
get(
OPT);
291 ROL::Ptr<V> jvzl = jv_pv.
get(
LOWER);
292 ROL::Ptr<V> jvzu = jv_pv.
get(
UPPER);
295 ROL::Ptr<const V> vx = v_pv.
get(
OPT);
296 ROL::Ptr<const V> vl = v_pv.
get(
EQUAL);
297 ROL::Ptr<const V> vzl = v_pv.
get(
LOWER);
298 ROL::Ptr<const V> vzu = v_pv.
get(
UPPER);
310 obj_->hessVec(*jvx,*vx,*
x_,tol);
330 con_->applyJacobian(*jvl,*vx,*
x_,tol);
341 jvzl->axpy(-1.0,*
xl_);
342 jvzl->applyBinary(
mult_,*vzl);
369 jvzl->applyBinary(
inFill_,*vzl);
380 jvzu->axpy(-1.0,*
x_);
381 jvzu->applyBinary(
mult_,*vzu);
397 jvzu->axpy(-1.0,*
x_);
398 jvzu->applyBinary(
mult_,*vzu);
406 jvzu->applyBinary(
inFill_,*vzu);
Provides the interface to apply upper and lower bound constraints.
Defines the general constraint operator interface.
Provides the interface to evaluate objective functions.
Defines the linear algebra of vector space on a generic partitioned vector.
std::vector< PV >::size_type size_type
ROL::Ptr< const Vector< Real > > get(size_type i) const
Real apply(const Real &x, const Real &y) const
Real apply(const Real &x, const Real &y) const
Real apply(const Real &x, const Real &y) const
void applyJacobian(V &jv, const V &v, const V &x, Real &tol)
Apply the constraint Jacobian at , , to vector .
const ROL::Ptr< const V > maskU_
void update(const Vector< Real > &x, bool flag=true, int iter=-1)
Update constraint functions. x is the optimization variable, flag = true if optimization variable i...
ROL::Ptr< const V > getOptMult(const V &vec)
const ROL::Ptr< BND > bnd_
PartitionedVector< Real > PV
void value(V &c, const V &x, Real &tol)
Evaluate the constraint operator at .
static const size_type OPT
int getNumberFunctionEvaluations(void) const
const ROL::Ptr< CON > con_
static const size_type EQUAL
static const size_type UPPER
Elementwise::ValueSet< Real > ValueSet
int getNumberGradientEvaluations(void) const
static const size_type LOWER
const ROL::Ptr< OBJ > obj_
PrimalDualInteriorPointResidual(const ROL::Ptr< OBJ > &obj, const ROL::Ptr< CON > &con, const ROL::Ptr< BND > &bnd, const V &x, const ROL::Ptr< const V > &maskL, const ROL::Ptr< const V > &maskU, ROL::Ptr< V > &scratch, Real mu, bool symmetrize)
BoundConstraint< Real > BND
int getNumberConstraintEvaluations(void) const
Elementwise::Multiply< Real > mult_
const ROL::Ptr< const V > maskL_
void reset(const Real mu)
ROL::Ptr< V > getOptMult(V &vec)
Defines the linear algebra or vector space interface.