44#ifndef ROL_PRIMALDUALINTERIORPOINTRESIDUAL_H
45#define ROL_PRIMALDUALINTERIORPOINTRESIDUAL_H
78class 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);
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.