10#ifndef ROL_TYPEE_FLETCHERALGORITHM_DEF_H
11#define ROL_TYPEE_FLETCHERALGORITHM_DEF_H
18template<
typename Real>
25 ParameterList& sublist = list.sublist(
"Step").sublist(
"Fletcher");
26 sigma_ = sublist.get(
"Penalty Parameter", 1.0);
27 delta_ = sublist.get(
"Regularization Parameter", 0.0);
28 minDelta_ = sublist.get(
"Minimum Regularization Parameter", 1e-8);
29 deltaUpdate_ = sublist.get(
"Regularization Parameter Decrease Factor", 1e-1);
30 sigmaUpdate_ = sublist.get(
"Penalty Parameter Growth Factor", 2.0);
31 modifySigma_ = sublist.get(
"Modify Penalty Parameter",
false);
32 maxSigma_ = sublist.get(
"Maximum Penalty Parameter", 1e8);
33 minSigma_ = sublist.get(
"Minimum Penalty Parameter", 1e-6);
34 subStep_ = sublist.get(
"Subproblem Step Type",
"Trust Region");
35 int subiter = sublist.get(
"Subproblem Iteration Limit", 100);
37 verbosity_ = list.sublist(
"General").get(
"Output Level", 0);
41 list_.sublist(
"General").set(
"Output Level",(print ?
verbosity_-1 : 0));
43 list_.sublist(
"Status Test").set(
"Iteration Limit", subiter);
46template<
typename Real>
53 std::ostream &outStream ) {
82template<
typename Real>
89 std::ostream &outStream ) {
93 Ptr<Vector<Real>> dwa_ = g.
clone();
96 Ptr<TypeU::Algorithm<Real>> algo;
103 algo->run(x,g,fobj,outStream);
113 state_->iterateVec->set(x);
121 merit_ = algo->getState()->value;
122 gpnorm_ = algo->getState()->gnorm;
130 bool too_infeasible =
state_->cnorm >
static_cast<Real
>(100.)*
gpnorm_;
131 bool too_feasible =
state_->cnorm <
static_cast<Real
>(1e-2)*
gpnorm_;
132 bool modified =
false;
168template<
typename Real>
170 std::ios_base::fmtflags osFlags(os.flags());
172 os << std::string(114,
'-') << std::endl;
173 os <<
"Fletcher exact penalty status output definitions" << std::endl << std::endl;
174 os <<
" iter - Number of iterates (steps taken)" << std::endl;
175 os <<
" fval - Objective function value" << std::endl;
176 os <<
" cnorm - Norm of the constraint violation" << std::endl;
177 os <<
" gLnorm - Norm of the gradient of the Lagrangian" << std::endl;
178 os <<
" snorm - Norm of the step" << std::endl;
179 os <<
" merit - Penalty function value" << std::endl;
180 os <<
" gpnorm - Norm of the gradient of the penalty" << std::endl;
181 os <<
" penalty - Penalty parameter" << std::endl;
182 os <<
" delta - Feasibility tolerance" << std::endl;
183 os <<
" #fval - Number of times the objective was computed" << std::endl;
184 os <<
" #grad - Number of times the gradient was computed" << std::endl;
185 os <<
" #cval - Number of times the constraint was computed" << std::endl;
186 os <<
" subIter - Number of iterations to solve subproblem" << std::endl;
187 os << std::string(114,
'-') << std::endl;
190 os << std::setw(6) << std::left <<
"iter";
191 os << std::setw(15) << std::left <<
"fval";
192 os << std::setw(15) << std::left <<
"cnorm";
193 os << std::setw(15) << std::left <<
"gLnorm";
194 os << std::setw(15) << std::left <<
"snorm";
195 os << std::setw(15) << std::left <<
"merit";
196 os << std::setw(15) << std::left <<
"gpnorm";
197 os << std::setw(10) << std::left <<
"penalty";
198 os << std::setw(10) << std::left <<
"delta";
199 os << std::setw(8) << std::left <<
"#fval";
200 os << std::setw(8) << std::left <<
"#grad";
201 os << std::setw(8) << std::left <<
"#cval";
202 os << std::setw(8) << std::left <<
"subIter";
207template<
typename Real>
209 std::ios_base::fmtflags osFlags(os.flags());
210 os << std::endl <<
"Fletcher Exact Penalty Solver (Type E, Equality Constraints)";
212 os <<
"Subproblem Solver: " <<
subStep_ << std::endl;
216template<
typename Real>
218 std::ios_base::fmtflags osFlags(os.flags());
219 os << std::scientific << std::setprecision(6);
222 if (
state_->iter == 0 ) {
224 os << std::setw(6) << std::left <<
state_->iter;
225 os << std::setw(15) << std::left <<
state_->value;
226 os << std::setw(15) << std::left <<
state_->cnorm;
227 os << std::setw(15) << std::left <<
state_->gnorm;
228 os << std::setw(15) << std::left <<
"---";
229 os << std::setw(15) << std::left <<
merit_;
230 os << std::setw(15) << std::left <<
gpnorm_;
231 os << std::scientific << std::setprecision(2);
232 os << std::setw(10) << std::left <<
sigma_;
233 os << std::setw(10) << std::left <<
delta_;
234 os << std::scientific << std::setprecision(6);
235 os << std::setw(8) << std::left <<
state_->nfval;
236 os << std::setw(8) << std::left <<
state_->ngrad;
237 os << std::setw(8) << std::left <<
state_->ncval;
238 os << std::setw(8) << std::left <<
"---";
243 os << std::setw(6) << std::left <<
state_->iter;
244 os << std::setw(15) << std::left <<
state_->value;
245 os << std::setw(15) << std::left <<
state_->cnorm;
246 os << std::setw(15) << std::left <<
state_->gnorm;
247 os << std::setw(15) << std::left <<
state_->snorm;
248 os << std::setw(15) << std::left <<
merit_;
249 os << std::setw(15) << std::left <<
gpnorm_;
250 os << std::scientific << std::setprecision(2);
251 os << std::setw(10) << std::left <<
sigma_;
252 os << std::setw(10) << std::left <<
delta_;
253 os << std::scientific << std::setprecision(6);
254 os << std::setw(8) << std::left <<
state_->nfval;
255 os << std::setw(8) << std::left <<
state_->ngrad;
256 os << 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.