45 #ifndef ROL_INTERIORPOINT_PRIMALDUAL_RESIDUAL_H
46 #define ROL_INTERIORPOINT_PRIMALDUAL_RESIDUAL_H
48 #include "ROL_Elementwise_Function.hpp"
55 namespace InteriorPoint {
99 ROL::Ptr<LinearOperator<Real> >
sym_;
111 const ROL::Ptr<CON> &eqcon,
112 const ROL::Ptr<CON> &incon,
117 const PV &xpv =
dynamic_cast<const PV&
>(x);
124 sym_ = ROL::makePtr<PrimalDualSymmetrizer<Real>>(*qs_);
133 PV &cpv =
dynamic_cast<PV&
>(c);
134 const PV &xpv =
dynamic_cast<const PV&
>(x);
136 ROL::Ptr<const V> xo = xpv.
get(
OPT);
137 ROL::Ptr<const V> xs = xpv.
get(
SLACK);
138 ROL::Ptr<const V> xe = xpv.
get(
EQUAL);
139 ROL::Ptr<const V> xi = xpv.
get(
INEQ);
143 ROL::Ptr<V> co = cpv.
get(
OPT);
146 ROL::Ptr<V> ci = cpv.
get(
INEQ);
149 obj_->gradient(*co,*xo,tol);
152 eqcon_->applyAdjointJacobian(*
qo_,*xe,*xo,tol);
155 incon_->applyAdjointJacobian(*
qo_,*xi,*xo,tol);
161 Elementwise::Multiply<Real> mult;
162 cs->applyBinary(mult,*xi);
164 Elementwise::Fill<Real> fill(-
mu_);
165 qs_->applyUnary(fill);
170 eqcon_->value(*ce, *xo, tol);
173 incon_->value(*ci, *xo, tol);
177 sym_->apply(c,c,tol);
178 sym_->applyInverse(c,c,tol);
189 PV &jvpv =
dynamic_cast<PV&
>(jv);
190 const PV &vpv =
dynamic_cast<const PV&
>(v);
191 const PV &xpv =
dynamic_cast<const PV&
>(x);
193 ROL::Ptr<V> jvo = jvpv.
get(
OPT);
196 ROL::Ptr<V> jvi = jvpv.
get(
INEQ);
198 ROL::Ptr<const V> vo = vpv.
get(
OPT);
199 ROL::Ptr<const V> vs = vpv.
get(
SLACK);
200 ROL::Ptr<const V> ve = vpv.
get(
EQUAL);
201 ROL::Ptr<const V> vi = vpv.
get(
INEQ);
203 ROL::Ptr<const V> xo = xpv.
get(
OPT);
204 ROL::Ptr<const V> xs = xpv.
get(
SLACK);
205 ROL::Ptr<const V> xe = xpv.
get(
EQUAL);
206 ROL::Ptr<const V> xi = xpv.
get(
INEQ);
209 obj_->hessVec(*jvo,*vo,*xo,tol);
211 eqcon_->applyAdjointHessian(*
qo_,*xe,*vo,*xo,tol);
213 jvo->axpy(-1.0,*
qo_);
215 incon_->applyAdjointHessian(*
qo_,*xi,*vo,*xo,tol);
217 jvo->axpy(-1.0,*
qo_);
219 eqcon_->applyAdjointJacobian(*
qo_,*ve,*xo,tol);
221 jvo->axpy(-1.0,*
qo_);
223 incon_->applyAdjointJacobian(*
qo_,*vi,*xo,tol);
225 jvo->axpy(-1.0,*
qo_);
231 Elementwise::Multiply<Real> mult;
233 jvs->applyBinary(mult,*xi);
237 qs_->applyBinary(mult,*xs);
242 eqcon_->applyJacobian(*jve,*vo,*xo,tol);
245 incon_->applyJacobian(*jvi,*vo,*xo,tol);
250 sym_->apply(jv,jv,tol);
251 sym_->applyInverse(jv,jv,tol);
292 void update(
const V& s,
bool flag =
true,
int iter = -1 ) {
296 void apply(
V &Hv,
const V &v, Real &tol )
const {
301 const PV &vpv =
dynamic_cast<const PV&
>(v);
302 PV &Hvpv =
dynamic_cast<PV&
>(Hv);
304 ROL::Ptr<const V> vo = vpv.
get(
OPT);
305 ROL::Ptr<const V> vs = vpv.
get(
SLACK);
306 ROL::Ptr<const V> ve = vpv.
get(
EQUAL);
307 ROL::Ptr<const V> vi = vpv.
get(
INEQ);
309 ROL::Ptr<V> Hvo = Hvpv.
get(
OPT);
312 ROL::Ptr<V> Hvi = Hvpv.
get(
INEQ);
317 Elementwise::Divide<Real> div;
318 Hvs->applyBinary(div,*
s_);
333 const PV &vpv =
dynamic_cast<const PV&
>(v);
334 PV &Hvpv =
dynamic_cast<PV&
>(Hv);
336 ROL::Ptr<const V> vo = vpv.
get(
OPT);
337 ROL::Ptr<const V> vs = vpv.
get(
SLACK);
338 ROL::Ptr<const V> ve = vpv.
get(
EQUAL);
339 ROL::Ptr<const V> vi = vpv.
get(
INEQ);
341 ROL::Ptr<V> Hvo = Hvpv.
get(
OPT);
344 ROL::Ptr<V> Hvi = Hvpv.
get(
INEQ);
349 Elementwise::Multiply<Real> mult;
350 Hvs->applyBinary(mult,*
s_);
371 #endif // ROL_INTERIORPOINT_PRIMALDUAL_RESIDUAL_H
Provides the interface to evaluate objective functions.
static const size_type OPT
virtual ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
void apply(V &Hv, const V &v, Real &tol) const
Apply linear operator.
ROL::Ptr< const Vector< Real > > get(size_type i) const
static const size_type SLACK
Defines the linear algebra of vector space on a generic partitioned vector.
ROL::Ptr< LinearOperator< Real > > sym_
static const size_type EQUAL
virtual void zero()
Set to zero vector.
Defines the linear algebra or vector space interface.
PrimalDualSymmetrizer(const V &s)
static const size_type INEQ
Express the Primal-Dual Interior Point gradient as an equality constraint.
static const size_type OPT
PartitionedVector< Real > PV
void applyInverse(V &Hv, const V &v, Real &tol) const
Apply inverse of linear operator.
void value(V &c, const V &x, Real &tol)
Evaluate the constraint operator at .
void updatePenalty(Real mu)
static const size_type EQUAL
Provides the interface to apply a linear operator.
PrimalDualResidual(const ROL::Ptr< OBJ > &obj, const ROL::Ptr< CON > &eqcon, const ROL::Ptr< CON > &incon, const V &x)
std::vector< PV >::size_type size_type
PartitionedVector< Real > PV
static const size_type INEQ
void applyJacobian(V &jv, const V &v, const V &x, Real &tol)
Apply the constraint Jacobian at , , to vector .
Defines the general constraint operator interface.
void update(const V &s, bool flag=true, int iter=-1)
Update linear operator.
static const size_type SLACK