44 #ifndef ROL_PRIMALDUALINTERIORPOINTRESIDUAL_H
45 #define ROL_PRIMALDUALINTERIORPOINTRESIDUAL_H
78 class PrimalDualInteriorPointResidual :
public Constraint<Real> {
80 typedef ROL::ParameterList
PL;
99 const ROL::Ptr<OBJ>
obj_;
100 const ROL::Ptr<CON>
con_;
103 ROL::Ptr<const V>
x_;
104 ROL::Ptr<const V>
l_;
105 ROL::Ptr<const V>
zl_;
106 ROL::Ptr<const V>
zu_;
108 ROL::Ptr<const V>
xl_;
109 ROL::Ptr<const V>
xu_;
111 const ROL::Ptr<const V>
maskL_;
112 const ROL::Ptr<const V>
maskU_;
129 class SafeDivide :
public Elementwise::BinaryFunction<Real> {
131 Real
apply(
const Real &x,
const Real &y )
const {
132 return y != 0 ? x/y : 0;
138 class SetZeros :
public Elementwise::BinaryFunction<Real> {
140 Real
apply(
const Real &x,
const Real &y )
const {
141 return y==1.0 ? 0 : x;
148 class InFill :
public Elementwise::BinaryFunction<Real> {
150 Real
apply(
const Real &x,
const Real &y )
const {
151 return x == 0 ? y : x;
159 PV &vec_pv = dynamic_cast<PV&>(vec);
166 const PV &vec_pv = dynamic_cast<const PV&>(vec);
177 const ROL::Ptr<CON> &con,
178 const ROL::Ptr<BND> &bnd,
180 const ROL::Ptr<const V> &maskL,
181 const ROL::Ptr<const V> &maskU,
182 ROL::Ptr<V> &scratch,
183 Real mu,
bool symmetrize ) :
190 const PV &x_pv = dynamic_cast<const PV&>(x);
203 const PV &x_pv = dynamic_cast<const PV&>(x);
210 obj_->update(*
x_,flag,iter);
211 con_->update(*
x_,flag,iter);
221 Elementwise::Shift<Real> subtract_mu(-
mu_);
222 Elementwise::Fill<Real> fill_minus_mu(-
mu_);
224 const PV &x_pv = dynamic_cast<const PV&>(x);
225 PV &c_pv = dynamic_cast<PV&>(c);
232 ROL::Ptr<V> cx = c_pv.
get(
OPT);
240 obj_->gradient(*cx,*
x_,tol);
262 czl->applyUnary(fill_minus_mu);
273 czl->axpy(-1.0,*
xl_);
275 czl->applyUnary(subtract_mu);
286 czu->applyUnary(fill_minus_mu);
299 czu->applyUnary(subtract_mu);
318 PV &jv_pv = dynamic_cast<PV&>(jv);
319 const PV &v_pv = dynamic_cast<const PV&>(v);
320 const PV &x_pv = dynamic_cast<const PV&>(x);
323 ROL::Ptr<V> jvx = jv_pv.
get(
OPT);
325 ROL::Ptr<V> jvzl = jv_pv.
get(
LOWER);
326 ROL::Ptr<V> jvzu = jv_pv.
get(
UPPER);
329 ROL::Ptr<const V> vx = v_pv.
get(
OPT);
330 ROL::Ptr<const V> vl = v_pv.
get(
EQUAL);
331 ROL::Ptr<const V> vzl = v_pv.
get(
LOWER);
332 ROL::Ptr<const V> vzu = v_pv.
get(
UPPER);
344 obj_->hessVec(*jvx,*vx,*
x_,tol);
364 con_->applyJacobian(*jvl,*vx,*
x_,tol);
375 jvzl->axpy(-1.0,*
xl_);
376 jvzl->applyBinary(
mult_,*vzl);
403 jvzl->applyBinary(
inFill_,*vzl);
414 jvzu->axpy(-1.0,*
x_);
415 jvzu->applyBinary(
mult_,*vzu);
431 jvzu->axpy(-1.0,*
x_);
432 jvzu->applyBinary(
mult_,*vzu);
440 jvzu->applyBinary(
inFill_,*vzu);
468 #endif // ROL_PRIMALDUALINTERIORPOINTRESIDUAL_H