45 #ifndef ROL_INTERIORPOINT_PRIMALDUAL_RESIDUAL_H 46 #define ROL_INTERIORPOINT_PRIMALDUAL_RESIDUAL_H 48 #include "ROL_Elementwise_Function.hpp" 55 namespace InteriorPoint {
99 Teuchos::RCP<LinearOperator<Real> >
sym_;
101 const static size_type
OPT = 0;
104 const static size_type
INEQ = 3;
111 const Teuchos::RCP<CON> &eqcon,
112 const Teuchos::RCP<CON> &incon,
114 obj_(obj), eqcon_(eqcon), incon_(incon), mu_(1.0) {
117 const PV &xpv = Teuchos::dyn_cast<
const PV>(x);
119 qo_ = xpv.
get(OPT)->clone();
120 qs_ = xpv.
get(SLACK)->clone();
121 qe_ = xpv.
get(EQUAL)->clone();
122 qi_ = xpv.
get(INEQ)->clone();
128 void value( V &c,
const V &x, Real &tol ) {
133 PV &cpv = Teuchos::dyn_cast<PV>(c);
134 const PV &xpv = Teuchos::dyn_cast<
const PV>(x);
136 RCP<const V> xo = xpv.get(OPT);
137 RCP<const V> xs = xpv.get(SLACK);
138 RCP<const V> xe = xpv.get(EQUAL);
139 RCP<const V> xi = xpv.get(INEQ);
143 RCP<V> co = cpv.
get(OPT);
144 RCP<V> cs = cpv.
get(SLACK);
145 RCP<V> ce = cpv.
get(EQUAL);
146 RCP<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 = Teuchos::dyn_cast<PV>(jv);
190 const PV &vpv = Teuchos::dyn_cast<
const PV>(v);
191 const PV &xpv = Teuchos::dyn_cast<
const PV>(x);
193 RCP<V> jvo = jvpv.
get(OPT);
194 RCP<V> jvs = jvpv.
get(SLACK);
195 RCP<V> jve = jvpv.
get(EQUAL);
196 RCP<V> jvi = jvpv.
get(INEQ);
198 RCP<const V> vo = vpv.get(OPT);
199 RCP<const V> vs = vpv.get(SLACK);
200 RCP<const V> ve = vpv.get(EQUAL);
201 RCP<const V> vi = vpv.get(INEQ);
203 RCP<const V> xo = xpv.get(OPT);
204 RCP<const V> xs = xpv.get(SLACK);
205 RCP<const V> xe = xpv.get(EQUAL);
206 RCP<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);
280 const static size_type
OPT = 0;
283 const static size_type
INEQ = 3;
292 void update(
const V& s,
bool flag =
true,
int iter = -1 ) {
296 void apply( V &Hv,
const V &v, Real &tol )
const {
299 using Teuchos::dyn_cast;
301 const PV &vpv = dyn_cast<
const PV>(v);
302 PV &Hvpv = dyn_cast<PV>(Hv);
304 RCP<const V> vo = vpv.
get(OPT);
305 RCP<const V> vs = vpv.
get(SLACK);
306 RCP<const V> ve = vpv.
get(EQUAL);
307 RCP<const V> vi = vpv.
get(INEQ);
309 RCP<V> Hvo = Hvpv.get(OPT);
310 RCP<V> Hvs = Hvpv.get(SLACK);
311 RCP<V> Hve = Hvpv.get(EQUAL);
312 RCP<V> Hvi = Hvpv.get(INEQ);
317 Elementwise::Divide<Real> div;
318 Hvs->applyBinary(div,*s_);
331 using Teuchos::dyn_cast;
333 const PV &vpv = dyn_cast<
const PV>(v);
334 PV &Hvpv = dyn_cast<PV>(Hv);
336 RCP<const V> vo = vpv.
get(OPT);
337 RCP<const V> vs = vpv.
get(SLACK);
338 RCP<const V> ve = vpv.
get(EQUAL);
339 RCP<const V> vi = vpv.
get(INEQ);
341 RCP<V> Hvo = Hvpv.get(OPT);
342 RCP<V> Hvs = Hvpv.get(SLACK);
343 RCP<V> Hve = Hvpv.get(EQUAL);
344 RCP<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.
void apply(V &Hv, const V &v, Real &tol) const
Apply linear operator.
Defines the linear algebra of vector space on a generic partitioned vector.
static const size_type SLACK
virtual Teuchos::RCP< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
virtual void zero()
Set to zero vector.
Defines the linear algebra or vector space interface.
PrimalDualSymmetrizer(const V &s)
Express the Primal-Dual Interior Point gradient as an equality constraint.
static const size_type OPT
static const size_type EQUAL
Defines the equality constraint operator interface.
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 .
Teuchos::RCP< const Vector< Real > > get(size_type i) const
void updatePenalty(Real mu)
Teuchos::RCP< LinearOperator< Real > > sym_
Provides the interface to apply a linear operator.
EqualityConstraint< Real > CON
static const size_type INEQ
std::vector< PV >::size_type size_type
PartitionedVector< Real > PV
Teuchos::RCP< CON > eqcon_
Teuchos::RCP< CON > incon_
PrimalDualResidual(const Teuchos::RCP< OBJ > &obj, const Teuchos::RCP< CON > &eqcon, const Teuchos::RCP< CON > &incon, const V &x)
void applyJacobian(V &jv, const V &v, const V &x, Real &tol)
Apply the constraint Jacobian at , , to vector .
void update(const V &s, bool flag=true, int iter=-1)
Update linear operator.