10 #ifndef ROL_FLETCHEROBJECTVEBASEDEF_H
11 #define ROL_FLETCHEROBJECTVEBASEDEF_H
15 template<
typename Real>
22 ParameterList &parlist)
23 :
obj_(obj), con_(con), nfval_(0), ngval_(0), ncval_(0),
30 multSolverError_(0), gradSolveError_(0),
31 iterKrylov_(0), flagKrylov_(0) {
42 vv_ = makePtr<PartitionedVector<Real>>(std::vector<Ptr<Vector<Real>>>({
v1_,
v2_}));
46 ww_ = makePtr<PartitionedVector<Real>>(std::vector<Ptr<Vector<Real>>>({
w1_,
w2_}));
50 bb_ = makePtr<PartitionedVector<Real>>(std::vector<Ptr<Vector<Real>>>({
b1_,
b2_}));
52 ParameterList& sublist = parlist.sublist(
"Step").sublist(
"Fletcher");
57 ROL::ParameterList krylovList;
58 Real atol =
static_cast<Real
>(1e-12);
59 Real rtol =
static_cast<Real
>(1e-2);
60 krylovList.sublist(
"General").sublist(
"Krylov").set(
"Type",
"GMRES");
61 krylovList.sublist(
"General").sublist(
"Krylov").set(
"Absolute Tolerance", atol);
62 krylovList.sublist(
"General").sublist(
"Krylov").set(
"Relative Tolerance", rtol);
63 krylovList.sublist(
"General").sublist(
"Krylov").set(
"Iteration Limit", 200);
64 krylov_ = KrylovFactory<Real>(krylovList);
67 template<
typename Real>
69 obj_->update(x,type,iter);
70 con_->update(x,type,iter);
71 fPhi_->objectiveUpdate(type);
72 gPhi_->objectiveUpdate(type);
73 y_->objectiveUpdate(type);
74 fval_->objectiveUpdate(type);
75 g_->objectiveUpdate(type);
76 c_->objectiveUpdate(type);
80 template<
typename Real>
83 Real tol =
static_cast<Real
>(1e-12);
84 computeMultipliers(*cdual_, *gLdual_, x, *xdual_, *cprim_, tol);
85 gL_->set(gLdual_->dual());
89 template<
typename Real>
91 Real tol = std::sqrt(ROL_EPSILON<Real>());
92 conValue(*cprim_, x, tol);
96 template<
typename Real>
99 Real tol =
static_cast<Real
>(1e-12);
100 computeMultipliers(*cdual_, *gLdual_, x, *xdual_, *cprim_, tol);
104 template<
typename Real>
107 Real tol =
static_cast<Real
>(1e-12);
108 this->gradient(*xdual_, x, tol);
112 template<
typename Real>
114 Real tol = std::sqrt(ROL_EPSILON<Real>());
115 return objValue(x, tol);
118 template<
typename Real>
123 template<
typename Real>
128 template<
typename Real>
133 template<
typename Real>
141 template<
typename Real>
145 bool isComputed = fval_->get(val,key);
147 val =
obj_->value(x,tol); nfval_++;
153 template<
typename Real>
156 bool isComputed = g_->get(g,key);
158 obj_->gradient(g, x, tol); ngval_++;
163 template<
typename Real>
166 bool isComputed = c_->get(c,key);
168 con_->value(c, x, tol); ncval_++;
173 template<
typename Real>
176 bool isComputed = y_->get(y,key);
177 if (isComputed && multSolverError_ <= tol)
return;
180 objGrad(g, x, tol2); tol2 = tol;
181 conValue(c, x, tol2);
182 scaledc_->set(c); scaledc_->scale(sigma_);
186 bool refine = isComputed;
187 multSolverError_ = tol;
188 solveAugmentedSystem(gL,y,g,*scaledc_,x,multSolverError_,refine);
Provides the interface to evaluate objective functions.
Ptr< const Vector< Real > > getGradient(const Vector< Real > &x)
Ptr< Vector< Real > > cprim_
void computeMultipliers(Vector< Real > &y, Vector< Real > &gL, const Vector< Real > &x, Vector< Real > &g, Vector< Real > &c, Real tol)
virtual ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
Ptr< Vector< Real > > xprim_
Real objValue(const Vector< Real > &x, Real &tol)
Ptr< Vector< Real > > gLdual_
Ptr< Vector< Real > > b1_
Real quadPenaltyParameter_
Ptr< Vector< Real > > gL_
Ptr< const Vector< Real > > getMultiplierVec(const Vector< Real > &x)
Defines the linear algebra or vector space interface.
void objGrad(Vector< Real > &g, const Vector< Real > &x, Real &tol)
Ptr< PartitionedVector< Real > > vv_
int getNumberFunctionEvaluations() const
Ptr< PartitionedVector< Real > > ww_
Real getObjectiveValue(const Vector< Real > &x)
Ptr< Krylov< Real > > krylov_
Ptr< Vector< Real > > xdual_
Ptr< PartitionedVector< Real > > bb_
Ptr< Vector< Real > > scaledc_
int getNumberGradientEvaluations() const
Ptr< Vector< Real > > cdual_
Ptr< Vector< Real > > v2_
Ptr< const Vector< Real > > getConstraintVec(const Vector< Real > &x)
virtual Real norm() const =0
Returns where .
FletcherObjectiveBase(const Ptr< Objective< Real >> &obj, const Ptr< Constraint< Real >> &con, const Vector< Real > &xprim, const Vector< Real > &xdual, const Vector< Real > &cprim, const Vector< Real > &cdual, ParameterList &parlist)
Ptr< Vector< Real > > b2_
virtual void update(const Vector< Real > &x, UpdateType type, int iter=-1) override
Update objective function.
Ptr< Vector< Real > > v1_
Ptr< const Vector< Real > > getLagrangianGradient(const Vector< Real > &x)
Ptr< Vector< Real > > w1_
Defines the general constraint operator interface.
void reset(Real sigma, Real delta)
int getNumberConstraintEvaluations() const
Ptr< Vector< Real > > w2_
void conValue(Vector< Real > &c, const Vector< Real > &x, Real &tol)