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_;
111 const Teuchos::RCP<CON> &eqcon,
112 const Teuchos::RCP<CON> &incon,
117 const PV &xpv = Teuchos::dyn_cast<
const PV>(x);
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);
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);
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);
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);
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);
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.
static const size_type OPT
void applyInverse(V &Hv, const V &v, Real &tol) const
Apply inverse of linear operator.
Defines the linear algebra of vector space on a generic partitioned vector.
static const size_type SLACK
Teuchos::RCP< const Vector< Real > > get(size_type i) const
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.
static const size_type SLACK
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
void apply(V &Hv, const V &v, Real &tol) const
Apply linear operator.
Defines the equality constraint operator interface.
PartitionedVector< Real > PV
void value(V &c, const V &x, Real &tol)
Evaluate the constraint operator at .
static const size_type INEQ
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_
static const size_type EQUAL
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.