44#ifndef ROL_TYPEE_FLETCHERALGORITHM_DEF_H
45#define ROL_TYPEE_FLETCHERALGORITHM_DEF_H
52template<
typename Real>
59 ParameterList& sublist = list.sublist(
"Step").sublist(
"Fletcher");
60 sigma_ = sublist.get(
"Penalty Parameter", 1.0);
61 delta_ = sublist.get(
"Regularization Parameter", 0.0);
62 minDelta_ = sublist.get(
"Minimum Regularization Parameter", 1e-8);
63 deltaUpdate_ = sublist.get(
"Regularization Parameter Decrease Factor", 1e-1);
64 sigmaUpdate_ = sublist.get(
"Penalty Parameter Growth Factor", 2.0);
65 modifySigma_ = sublist.get(
"Modify Penalty Parameter",
false);
66 maxSigma_ = sublist.get(
"Maximum Penalty Parameter", 1e8);
67 minSigma_ = sublist.get(
"Minimum Penalty Parameter", 1e-6);
68 subStep_ = sublist.get(
"Subproblem Step Type",
"Trust Region");
69 int subiter = sublist.get(
"Subproblem Iteration Limit", 100);
71 verbosity_ = list.sublist(
"General").get(
"Output Level", 0);
75 list_.sublist(
"General").set(
"Output Level",(print ?
verbosity_-1 : 0));
77 list_.sublist(
"Status Test").set(
"Iteration Limit", subiter);
80template<
typename Real>
87 std::ostream &outStream ) {
116template<
typename Real>
123 std::ostream &outStream ) {
127 Ptr<Vector<Real>> dwa_ = g.
clone();
129 initialize(x,g,emul,eres,fobj,econ,outStream);
130 Ptr<TypeU::Algorithm<Real>> algo;
137 algo->run(x,g,fobj,outStream);
147 state_->iterateVec->set(x);
155 merit_ = algo->getState()->value;
156 gpnorm_ = algo->getState()->gnorm;
164 bool too_infeasible =
state_->cnorm >
static_cast<Real
>(100.)*
gpnorm_;
165 bool too_feasible =
state_->cnorm <
static_cast<Real
>(1e-2)*
gpnorm_;
166 bool modified =
false;
202template<
typename Real>
204 std::stringstream hist;
206 hist << std::string(114,
'-') << std::endl;
207 hist <<
"Fletcher exact penalty status output definitions" << std::endl << std::endl;
208 hist <<
" iter - Number of iterates (steps taken)" << std::endl;
209 hist <<
" fval - Objective function value" << std::endl;
210 hist <<
" cnorm - Norm of the constraint violation" << std::endl;
211 hist <<
" gLnorm - Norm of the gradient of the Lagrangian" << std::endl;
212 hist <<
" snorm - Norm of the step" << std::endl;
213 hist <<
" merit - Penalty function value" << std::endl;
214 hist <<
" gpnorm - Norm of the gradient of the penalty" << std::endl;
215 hist <<
" penalty - Penalty parameter" << std::endl;
216 hist <<
" delta - Feasibility tolerance" << std::endl;
217 hist <<
" #fval - Number of times the objective was computed" << std::endl;
218 hist <<
" #grad - Number of times the gradient was computed" << std::endl;
219 hist <<
" #cval - Number of times the constraint was computed" << std::endl;
220 hist <<
" subIter - Number of iterations to solve subproblem" << std::endl;
221 hist << std::string(114,
'-') << std::endl;
224 hist << std::setw(6) << std::left <<
"iter";
225 hist << std::setw(15) << std::left <<
"fval";
226 hist << std::setw(15) << std::left <<
"cnorm";
227 hist << std::setw(15) << std::left <<
"gLnorm";
228 hist << std::setw(15) << std::left <<
"snorm";
229 hist << std::setw(15) << std::left <<
"merit";
230 hist << std::setw(15) << std::left <<
"gpnorm";
231 hist << std::setw(10) << std::left <<
"penalty";
232 hist << std::setw(10) << std::left <<
"delta";
233 hist << std::setw(8) << std::left <<
"#fval";
234 hist << std::setw(8) << std::left <<
"#grad";
235 hist << std::setw(8) << std::left <<
"#cval";
236 hist << std::setw(8) << std::left <<
"subIter";
241template<
typename Real>
243 std::stringstream hist;
244 hist << std::endl <<
"Fletcher Exact Penalty Solver (Type E, Equality Constraints)";
246 hist <<
"Subproblem Solver: " <<
subStep_ << std::endl;
250template<
typename Real>
252 std::stringstream hist;
253 hist << std::scientific << std::setprecision(6);
256 if (
state_->iter == 0 ) {
258 hist << std::setw(6) << std::left <<
state_->iter;
259 hist << std::setw(15) << std::left <<
state_->value;
260 hist << std::setw(15) << std::left <<
state_->cnorm;
261 hist << std::setw(15) << std::left <<
state_->gnorm;
262 hist << std::setw(15) << std::left <<
"---";
263 hist << std::setw(15) << std::left <<
merit_;
264 hist << std::setw(15) << std::left <<
gpnorm_;
265 hist << std::scientific << std::setprecision(2);
266 hist << std::setw(10) << std::left <<
sigma_;
267 hist << std::setw(10) << std::left <<
delta_;
268 hist << std::scientific << std::setprecision(6);
269 hist << std::setw(8) << std::left <<
state_->nfval;
270 hist << std::setw(8) << std::left <<
state_->ngrad;
271 hist << std::setw(8) << std::left <<
state_->ncval;
272 hist << std::setw(8) << std::left <<
"---";
277 hist << std::setw(6) << std::left <<
state_->iter;
278 hist << std::setw(15) << std::left <<
state_->value;
279 hist << std::setw(15) << std::left <<
state_->cnorm;
280 hist << std::setw(15) << std::left <<
state_->gnorm;
281 hist << std::setw(15) << std::left <<
state_->snorm;
282 hist << std::setw(15) << std::left <<
merit_;
283 hist << std::setw(15) << std::left <<
gpnorm_;
284 hist << std::scientific << std::setprecision(2);
285 hist << std::setw(10) << std::left <<
sigma_;
286 hist << std::setw(10) << std::left <<
delta_;
287 hist << std::scientific << std::setprecision(6);
288 hist << std::setw(8) << std::left <<
state_->nfval;
289 hist << std::setw(8) << std::left <<
state_->ngrad;
290 hist << std::setw(8) << std::left <<
state_->ncval;
virtual void initialize(const Vector< Real > &x)
Initialize temporary variables.
Provides an interface to check status of optimization algorithms for problems with equality constrain...
Defines the general constraint operator interface.
int getNumberGradientEvaluations() const
Ptr< const Vector< Real > > getLagrangianGradient(const Vector< Real > &x)
Ptr< const Vector< Real > > getConstraintVec(const Vector< Real > &x)
virtual void update(const Vector< Real > &x, UpdateType type, int iter=-1) override
int getNumberFunctionEvaluations() const
Real getObjectiveValue(const Vector< Real > &x)
void reset(Real sigma, Real delta)
int getNumberConstraintEvaluations() const
Ptr< const Vector< Real > > getMultiplierVec(const Vector< Real > &x)
void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol) override
Real value(const Vector< Real > &x, Real &tol) override
Provides the interface to evaluate objective functions.
const Ptr< CombinedStatusTest< Real > > status_
Algorithm()
Constructor, given a step and a status test.
const Ptr< AlgorithmState< Real > > state_
Provides interface for and implements limited-memory secant operators.
void initialize(const Vector< Real > &x, const Vector< Real > &g, const Vector< Real > &mul, const Vector< Real > &c)
virtual void writeExitStatus(std::ostream &os) const
FletcherAlgorithm(ParameterList &list, const Ptr< Secant< Real > > &secant=nullPtr)
const Ptr< Secant< Real > > secant_
virtual void writeName(std::ostream &os) const override
Print step name.
virtual void writeHeader(std::ostream &os) const override
Print iterate header.
virtual void run(Vector< Real > &x, const Vector< Real > &g, Objective< Real > &obj, Constraint< Real > &econ, Vector< Real > &emul, const Vector< Real > &eres, std::ostream &outStream=std::cout) override
virtual void writeOutput(std::ostream &os, const bool print_header=false) const override
Print iterate status.
void initialize(Vector< Real > &x, const Vector< Real > &g, const Vector< Real > &l, const Vector< Real > &c, FletcherObjectiveE< Real > &fobj, Constraint< Real > &con, std::ostream &outStream)
Defines the linear algebra or vector space interface.
virtual void set(const Vector &x)
Set where .
virtual ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
Ptr< Algorithm< Real > > AlgorithmFactory(ParameterList &parlist, const Ptr< Secant< Real > > &secant=nullPtr)
Real ROL_EPSILON(void)
Platform-dependent machine epsilon.