10 #ifndef ROL_FLETCHER_H
11 #define ROL_FLETCHER_H
18 #include "ROL_Ptr.hpp"
65 Ptr<Vector<Real> >
Tv_;
66 Ptr<Vector<Real> >
w_;
67 Ptr<Vector<Real> >
v_;
68 Ptr<Vector<Real> >
wg_;
69 Ptr<Vector<Real> >
vg_;
95 const Ptr<Constraint<Real> >
con_;
96 const Ptr<const Vector<Real> >
x_;
107 con_->applyAdjointJacobian(*(Hvp.
get(0)), *(vp.
get(1)), *
x_, tol);
108 Hvp.
get(0)->plus(*(vp.
get(0)));
110 con_->applyJacobian(*(Hvp.
get(1)), *(vp.
get(0)), *
x_, tol);
117 const Ptr<Constraint<Real> >
con_;
118 const Ptr<const Vector<Real> >
x_;
133 con_->applyPreconditioner(*(Hvp.
get(1)),*(vp.
get(1)),*
x_,*
x_, zero);
142 ROL::ParameterList &parlist)
146 y_ = conVec.
dual().clone();
147 g_ = optVec.
dual().clone();
153 w_ = optVec.
dual().clone();
154 v_ = conVec.
dual().clone();
165 vv_ = makePtr<PartitionedVector<Real>>(std::vector<Ptr<Vector<Real>> >({
v1_,
v2_}));
169 ww_ = makePtr<PartitionedVector<Real>>(std::vector<Ptr<Vector<Real>> >({
w1_,
w2_}));
173 bb_ = makePtr<PartitionedVector<Real>>(std::vector<Ptr<Vector<Real>> >({
b1_,
b2_}));
175 ROL::ParameterList& sublist = parlist.sublist(
"Step").sublist(
"Fletcher");
176 HessianApprox_ = sublist.get(
"Level of Hessian Approximation", 0);
180 delta_ = sublist.get(
"Regularization Parameter", 0.0);
182 useInexact_ = sublist.get(
"Inexact Solves",
false);
184 ROL::ParameterList krylovList;
185 Real atol =
static_cast<Real
>(1e-12);
186 Real rtol =
static_cast<Real
>(1e-2);
187 krylovList.sublist(
"General").sublist(
"Krylov").set(
"Type",
"GMRES");
188 krylovList.sublist(
"General").sublist(
"Krylov").set(
"Absolute Tolerance", atol);
189 krylovList.sublist(
"General").sublist(
"Krylov").set(
"Relative Tolerance", rtol);
190 krylovList.sublist(
"General").sublist(
"Krylov").set(
"Iteration Limit", 200);
191 krylov_ = KrylovFactory<Real>(krylovList);
195 obj_->update(x,flag,iter);
196 con_->update(x,flag,iter);
256 con_->applyAdjointHessian( *
gPhi_, *
y_, *
wg_, x, tol2 ); tol2 = origTol;
259 obj_->hessVec( *
Tv_, *
wg_, x, tol2 ); tol2 = origTol;
260 gPhi_->axpy( static_cast<Real>(-1), *
Tv_ );
262 con_->applyAdjointHessian( *
Tv_, *
vg_, *
gL_, x, tol2 ); tol2 = origTol;
268 con_->applyAdjointJacobian( *
Tv_, *
c_, x, tol2 ); tol2 = origTol;
292 obj_->hessVec( hv, v, x, tol2 ); tol2 = origTol;
293 con_->applyAdjointHessian( *
Tv_, *
y_, v, x, tol2 ); tol2 = origTol;
294 hv.
axpy(static_cast<Real>(-1), *
Tv_ );
298 hv.
scale( static_cast<Real>(-1) );
306 obj_->hessVec( *
Tv_, *
w_, x, tol2 ); tol2 = origTol;
308 con_->applyAdjointHessian( *
Tv_, *
y_, *
w_, x, tol2 ); tol2 = origTol;
309 hv.
axpy( static_cast<Real>(-1), *
Tv_ );
314 con_->applyJacobian( *
b2_, v, x, tol2 ); tol2 = origTol;
315 con_->applyAdjointJacobian( *
Tv_, *
b2_, x, tol2 ); tol2 = origTol;
317 con_->applyAdjointHessian( *
Tv_, *
c_, v, x, tol2); tol2 = origTol;
329 bool refine =
false) {
331 ROL::Ptr<LinearOperator<Real> > K
332 = ROL::makePtr<AugSystem>(
con_, makePtrFromRef(x),
delta_);
333 ROL::Ptr<LinearOperator<Real> > P
334 = ROL::makePtr<AugSystemPrecond>(
con_, makePtrFromRef(x));
344 K->apply(*
vv_, *
ww_, tol); tol = origTol;
346 b1_->axpy( static_cast<Real>(-1), *
v1_ );
347 b2_->axpy( static_cast<Real>(-1), *
v2_ );
355 krylov_->resetAbsoluteTolerance(tol);
Provides the interface to evaluate objective functions.
Real value(const Vector< Real > &x, Real &tol)
Compute value.
virtual const Vector & dual() const
Return dual representation of , for example, the result of applying a Riesz map, or change of basis...
Ptr< Vector< Real > > w2_
Ptr< Vector< Real > > gPhi_
virtual void scale(const Real alpha)=0
Compute where .
virtual ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
const Ptr< Constraint< Real > > con_
Real quadPenaltyParameter_
ROL::Ptr< const Vector< Real > > get(size_type i) const
virtual void plus(const Vector &x)=0
Compute , where .
virtual void axpy(const Real alpha, const Vector &x)
Compute where .
Defines the linear algebra of vector space on a generic partitioned vector.
void objValue(const Vector< Real > &x, Real &tol)
const Ptr< Objective< Real > > obj_
void applyInverse(Vector< Real > &Hv, const Vector< Real > &v, Real &tol) const
Apply inverse of linear operator.
Ptr< Vector< Real > > vg_
Contains definitions of custom data types in ROL.
void solveAugmentedSystem(Vector< Real > &v1, Vector< Real > &v2, const Vector< Real > &b1, const Vector< Real > &b2, const Vector< Real > &x, Real &tol, bool refine=false)
Fletcher(const ROL::Ptr< Objective< Real > > &obj, const ROL::Ptr< Constraint< Real > > &con, const Vector< Real > &optVec, const Vector< Real > &conVec, ROL::ParameterList &parlist)
Ptr< Vector< Real > > wg_
const Ptr< const Vector< Real > > x_
const Ptr< const Vector< Real > > x_
AugSystemPrecond(const Ptr< Constraint< Real > > con, const Ptr< const Vector< Real > > x)
Ptr< Vector< Real > > czeros_
Ptr< Vector< Real > > w1_
Ptr< Vector< Real > > Tv_
Defines the linear algebra or vector space interface.
Ptr< Krylov< Real > > krylov_
Objective_SerialSimOpt(const Ptr< Obj > &obj, const V &ui) z0_ zero()
Ptr< Vector< Real > > gL_
Ptr< Vector< Real > > v1_
Ptr< Vector< Real > > b1_
AugSystem(const Ptr< Constraint< Real > > &con, const Ptr< const Vector< Real > > &x, const Real delta)
bool isMultiplierComputed_
Ptr< Vector< Real > > scaledc_
void apply(Vector< Real > &Hv, const Vector< Real > &v, Real &tol) const
Apply linear operator.
void conValue(const Vector< Real > &x, Real &tol)
void set(const V &x)
Set where .
void computeMultipliers(const Vector< Real > &x, const Real tol)
Ptr< Vector< Real > > xzeros_
Ptr< PartitionedVector< Real > > vv_
Provides the interface to apply a linear operator.
const Ptr< Constraint< Real > > con_
void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply Hessian approximation to vector.
virtual void set(const Vector &x)
Set where .
void update(const Vector< Real > &x, bool flag=true, int iter=-1)
Update objective function.
Ptr< Vector< Real > > v2_
Ptr< Vector< Real > > b2_
Ptr< PartitionedVector< Real > > bb_
const Ptr< Constraint< Real > > con_
Ptr< PartitionedVector< Real > > ww_
void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol)
Compute gradient.
void objGrad(const Vector< Real > &x, Real &tol)
Defines the general constraint operator interface.
void apply(Vector< Real > &Hv, const Vector< Real > &v, Real &tol) const
Apply linear operator.