10 #ifndef ROL_INTERIORPOINT_PRIMALDUAL_RESIDUAL_H
11 #define ROL_INTERIORPOINT_PRIMALDUAL_RESIDUAL_H
13 #include "ROL_Elementwise_Function.hpp"
20 namespace InteriorPoint {
64 ROL::Ptr<LinearOperator<Real> >
sym_;
76 const ROL::Ptr<CON> &eqcon,
77 const ROL::Ptr<CON> &incon,
82 const PV &xpv =
dynamic_cast<const PV&
>(x);
89 sym_ = ROL::makePtr<PrimalDualSymmetrizer<Real>>(*qs_);
93 void value(
V &c,
const V &x, Real &tol ) {
98 PV &cpv =
dynamic_cast<PV&
>(c);
99 const PV &xpv =
dynamic_cast<const PV&
>(x);
101 ROL::Ptr<const V> xo = xpv.
get(
OPT);
102 ROL::Ptr<const V> xs = xpv.
get(
SLACK);
103 ROL::Ptr<const V> xe = xpv.
get(
EQUAL);
104 ROL::Ptr<const V> xi = xpv.
get(
INEQ);
108 ROL::Ptr<V> co = cpv.
get(
OPT);
111 ROL::Ptr<V> ci = cpv.
get(
INEQ);
114 obj_->gradient(*co,*xo,tol);
117 eqcon_->applyAdjointJacobian(*
qo_,*xe,*xo,tol);
120 incon_->applyAdjointJacobian(*
qo_,*xi,*xo,tol);
126 Elementwise::Multiply<Real> mult;
127 cs->applyBinary(mult,*xi);
129 Elementwise::Fill<Real> fill(-
mu_);
130 qs_->applyUnary(fill);
135 eqcon_->value(*ce, *xo, tol);
138 incon_->value(*ci, *xo, tol);
142 sym_->apply(c,c,tol);
143 sym_->applyInverse(c,c,tol);
154 PV &jvpv =
dynamic_cast<PV&
>(jv);
155 const PV &vpv =
dynamic_cast<const PV&
>(v);
156 const PV &xpv =
dynamic_cast<const PV&
>(x);
158 ROL::Ptr<V> jvo = jvpv.
get(
OPT);
161 ROL::Ptr<V> jvi = jvpv.
get(
INEQ);
163 ROL::Ptr<const V> vo = vpv.
get(
OPT);
164 ROL::Ptr<const V> vs = vpv.
get(
SLACK);
165 ROL::Ptr<const V> ve = vpv.
get(
EQUAL);
166 ROL::Ptr<const V> vi = vpv.
get(
INEQ);
168 ROL::Ptr<const V> xo = xpv.
get(
OPT);
169 ROL::Ptr<const V> xs = xpv.
get(
SLACK);
170 ROL::Ptr<const V> xe = xpv.
get(
EQUAL);
171 ROL::Ptr<const V> xi = xpv.
get(
INEQ);
174 obj_->hessVec(*jvo,*vo,*xo,tol);
176 eqcon_->applyAdjointHessian(*
qo_,*xe,*vo,*xo,tol);
178 jvo->axpy(-1.0,*
qo_);
180 incon_->applyAdjointHessian(*
qo_,*xi,*vo,*xo,tol);
182 jvo->axpy(-1.0,*
qo_);
184 eqcon_->applyAdjointJacobian(*
qo_,*ve,*xo,tol);
186 jvo->axpy(-1.0,*
qo_);
188 incon_->applyAdjointJacobian(*
qo_,*vi,*xo,tol);
190 jvo->axpy(-1.0,*
qo_);
196 Elementwise::Multiply<Real> mult;
198 jvs->applyBinary(mult,*xi);
202 qs_->applyBinary(mult,*xs);
207 eqcon_->applyJacobian(*jve,*vo,*xo,tol);
210 incon_->applyJacobian(*jvi,*vo,*xo,tol);
215 sym_->apply(jv,jv,tol);
216 sym_->applyInverse(jv,jv,tol);
257 void update(
const V& s,
bool flag =
true,
int iter = -1 ) {
261 void apply(
V &Hv,
const V &v, Real &tol )
const {
266 const PV &vpv =
dynamic_cast<const PV&
>(v);
267 PV &Hvpv =
dynamic_cast<PV&
>(Hv);
269 ROL::Ptr<const V> vo = vpv.
get(
OPT);
270 ROL::Ptr<const V> vs = vpv.
get(
SLACK);
271 ROL::Ptr<const V> ve = vpv.
get(
EQUAL);
272 ROL::Ptr<const V> vi = vpv.
get(
INEQ);
274 ROL::Ptr<V> Hvo = Hvpv.
get(
OPT);
277 ROL::Ptr<V> Hvi = Hvpv.
get(
INEQ);
282 Elementwise::Divide<Real> div;
283 Hvs->applyBinary(div,*
s_);
298 const PV &vpv =
dynamic_cast<const PV&
>(v);
299 PV &Hvpv =
dynamic_cast<PV&
>(Hv);
301 ROL::Ptr<const V> vo = vpv.
get(
OPT);
302 ROL::Ptr<const V> vs = vpv.
get(
SLACK);
303 ROL::Ptr<const V> ve = vpv.
get(
EQUAL);
304 ROL::Ptr<const V> vi = vpv.
get(
INEQ);
306 ROL::Ptr<V> Hvo = Hvpv.
get(
OPT);
309 ROL::Ptr<V> Hvi = Hvpv.
get(
INEQ);
314 Elementwise::Multiply<Real> mult;
315 Hvs->applyBinary(mult,*
s_);
336 #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