45 #ifndef ROL_FLETCHEROBJECTVEBASEDEF_H
46 #define ROL_FLETCHEROBJECTVEBASEDEF_H
50 template<
typename Real>
57 ParameterList &parlist)
58 :
obj_(obj), con_(con), nfval_(0), ngval_(0), ncval_(0),
65 multSolverError_(0), gradSolveError_(0),
66 iterKrylov_(0), flagKrylov_(0) {
77 vv_ = makePtr<PartitionedVector<Real>>(std::vector<Ptr<Vector<Real>>>({
v1_,
v2_}));
81 ww_ = makePtr<PartitionedVector<Real>>(std::vector<Ptr<Vector<Real>>>({
w1_,
w2_}));
85 bb_ = makePtr<PartitionedVector<Real>>(std::vector<Ptr<Vector<Real>>>({
b1_,
b2_}));
87 ParameterList& sublist = parlist.sublist(
"Step").sublist(
"Fletcher");
92 ROL::ParameterList krylovList;
93 Real atol =
static_cast<Real
>(1e-12);
94 Real rtol =
static_cast<Real
>(1e-2);
95 krylovList.sublist(
"General").sublist(
"Krylov").set(
"Type",
"GMRES");
96 krylovList.sublist(
"General").sublist(
"Krylov").set(
"Absolute Tolerance", atol);
97 krylovList.sublist(
"General").sublist(
"Krylov").set(
"Relative Tolerance", rtol);
98 krylovList.sublist(
"General").sublist(
"Krylov").set(
"Iteration Limit", 200);
99 krylov_ = KrylovFactory<Real>(krylovList);
102 template<
typename Real>
104 obj_->update(x,type,iter);
105 con_->update(x,type,iter);
106 fPhi_->objectiveUpdate(type);
107 gPhi_->objectiveUpdate(type);
108 y_->objectiveUpdate(type);
109 fval_->objectiveUpdate(type);
110 g_->objectiveUpdate(type);
111 c_->objectiveUpdate(type);
115 template<
typename Real>
118 Real tol =
static_cast<Real
>(1e-12);
119 computeMultipliers(*cdual_, *gLdual_, x, *xdual_, *cprim_, tol);
120 gL_->set(gLdual_->dual());
124 template<
typename Real>
126 Real tol = std::sqrt(ROL_EPSILON<Real>());
127 conValue(*cprim_, x, tol);
131 template<
typename Real>
134 Real tol =
static_cast<Real
>(1e-12);
135 computeMultipliers(*cdual_, *gLdual_, x, *xdual_, *cprim_, tol);
139 template<
typename Real>
142 Real tol =
static_cast<Real
>(1e-12);
143 this->gradient(*xdual_, x, tol);
147 template<
typename Real>
149 Real tol = std::sqrt(ROL_EPSILON<Real>());
150 return objValue(x, tol);
153 template<
typename Real>
158 template<
typename Real>
163 template<
typename Real>
168 template<
typename Real>
176 template<
typename Real>
180 bool isComputed = fval_->get(val,key);
182 val =
obj_->value(x,tol); nfval_++;
188 template<
typename Real>
191 bool isComputed = g_->get(g,key);
193 obj_->gradient(g, x, tol); ngval_++;
198 template<
typename Real>
201 bool isComputed = c_->get(c,key);
203 con_->value(c, x, tol); ncval_++;
208 template<
typename Real>
211 bool isComputed = y_->get(y,key);
212 if (isComputed && multSolverError_ <= tol)
return;
215 objGrad(g, x, tol2); tol2 = tol;
216 conValue(c, x, tol2);
217 scaledc_->set(c); scaledc_->scale(sigma_);
221 bool refine = isComputed;
222 multSolverError_ = tol;
223 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)