44#ifndef ROL_TYPEG_AUGMENTEDLAGRANGIANALGORITHM_DEF_H
45#define ROL_TYPEG_AUGMENTEDLAGRANGIANALGORITHM_DEF_H
52template<
typename Real>
59 Real one(1), p1(0.1), p9(0.9), ten(1.e1), oe8(1.e8), oem8(1.e-8);
60 ParameterList& sublist = list.sublist(
"Step").sublist(
"Augmented Lagrangian");
62 state_->searchSize = sublist.get(
"Initial Penalty Parameter", ten);
66 penaltyUpdate_ = sublist.get(
"Penalty Parameter Growth Factor", ten);
78 print_ = sublist.get(
"Print Intermediate Optimization History",
false);
79 maxit_ = sublist.get(
"Subproblem Iteration Limit", 1000);
80 subStep_ = sublist.get(
"Subproblem Step Type",
"Trust Region");
83 list_.sublist(
"Status Test").set(
"Iteration Limit",
maxit_);
84 list_.sublist(
"Status Test").set(
"Use Relative Tolerances",
false);
86 verbosity_ = list.sublist(
"General").get(
"Output Level", 0);
94 useRelTol_ = list.sublist(
"Status Test").get(
"Use Relative Tolerances",
false);
97 fscale_ = sublist.get(
"Objective Scaling", one);
98 cscale_ = sublist.get(
"Constraint Scaling", one);
101template<
typename Real>
109 std::ostream &outStream ) {
111 if (
proj_ == nullPtr) {
112 proj_ = makePtr<PolyhedralProjection<Real>>(makePtrFromRef(bnd));
115 proj_->project(x,outStream);
117 const Real one(1), TOL(1.e-2);
144 Ptr<Vector<Real>> ji = x.
clone();
145 Real maxji(0), normji(0);
146 for (
int i = 0; i < c.
dimension(); ++i) {
149 maxji = std::max(normji,maxji);
151 cscale_ = one/std::max(one,maxji);
153 catch (std::exception &e) {
161 proj_->project(x,outStream);
168 const Real oem8(1e-8), oem2(1e-2), two(2), ten(10);
169 state_->searchSize = std::max(oem8,
186 outStream << std::endl;
187 outStream <<
"Augmented Lagrangian Initialize" << std::endl;
188 outStream <<
"Objective Scaling: " <<
fscale_ << std::endl;
189 outStream <<
"Constraint Scaling: " <<
cscale_ << std::endl;
190 outStream <<
"Penalty Parameter: " <<
state_->searchSize << std::endl;
191 outStream << std::endl;
195template<
typename Real>
203 std::ostream &outStream ) {
204 const Real one(1), oem2(1e-2);
208 state_->searchSize,g,eres,emul,
210 initialize(x,g,emul,eres,alobj,bnd,econ,outStream);
211 Ptr<TypeB::Algorithm<Real>> algo;
222 *
proj_->getMultiplier(),*
proj_->getResidual(),
224 else algo->run(x,g,alobj,bnd,outStream);
234 state_->iterateVec->set(x);
243 proj_->project(x,outStream);
265 state_->lagmultVec->set(emul);
283template<
typename Real>
285 std::stringstream hist;
287 hist << std::string(114,
'-') << std::endl;
288 hist <<
"Augmented Lagrangian status output definitions" << std::endl << std::endl;
289 hist <<
" iter - Number of iterates (steps taken)" << std::endl;
290 hist <<
" fval - Objective function value" << std::endl;
291 hist <<
" cnorm - Norm of the constraint violation" << std::endl;
292 hist <<
" gLnorm - Norm of the gradient of the Lagrangian" << std::endl;
293 hist <<
" snorm - Norm of the step" << std::endl;
294 hist <<
" penalty - Penalty parameter" << std::endl;
295 hist <<
" feasTol - Feasibility tolerance" << std::endl;
296 hist <<
" optTol - Optimality tolerance" << std::endl;
297 hist <<
" #fval - Number of times the objective was computed" << std::endl;
298 hist <<
" #grad - Number of times the gradient was computed" << std::endl;
299 hist <<
" #cval - Number of times the constraint was computed" << std::endl;
300 hist <<
" subIter - Number of iterations to solve subproblem" << std::endl;
301 hist << std::string(114,
'-') << std::endl;
304 hist << std::setw(6) << std::left <<
"iter";
305 hist << std::setw(15) << std::left <<
"fval";
306 hist << std::setw(15) << std::left <<
"cnorm";
307 hist << std::setw(15) << std::left <<
"gLnorm";
308 hist << std::setw(15) << std::left <<
"snorm";
309 hist << std::setw(10) << std::left <<
"penalty";
310 hist << std::setw(10) << std::left <<
"feasTol";
311 hist << std::setw(10) << std::left <<
"optTol";
312 hist << std::setw(8) << std::left <<
"#fval";
313 hist << std::setw(8) << std::left <<
"#grad";
314 hist << std::setw(8) << std::left <<
"#cval";
315 hist << std::setw(8) << std::left <<
"subIter";
320template<
typename Real>
322 std::stringstream hist;
323 hist << std::endl <<
"Augmented Lagrangian Solver (Type G, General Constraints)";
325 hist <<
"Subproblem Solver: " <<
subStep_ << std::endl;
329template<
typename Real>
331 std::stringstream hist;
332 hist << std::scientific << std::setprecision(6);
335 if (
state_->iter == 0 ) {
337 hist << std::setw(6) << std::left <<
state_->iter;
338 hist << std::setw(15) << std::left <<
state_->value;
339 hist << std::setw(15) << std::left <<
state_->cnorm;
340 hist << std::setw(15) << std::left <<
state_->gnorm;
341 hist << std::setw(15) << std::left <<
"---";
342 hist << std::scientific << std::setprecision(2);
343 hist << std::setw(10) << std::left <<
state_->searchSize;
346 hist << std::scientific << std::setprecision(6);
347 hist << std::setw(8) << std::left <<
state_->nfval;
348 hist << std::setw(8) << std::left <<
state_->ngrad;
349 hist << std::setw(8) << std::left <<
state_->ncval;
350 hist << std::setw(8) << std::left <<
"---";
355 hist << std::setw(6) << std::left <<
state_->iter;
356 hist << std::setw(15) << std::left <<
state_->value;
357 hist << std::setw(15) << std::left <<
state_->cnorm;
358 hist << std::setw(15) << std::left <<
state_->gnorm;
359 hist << std::setw(15) << std::left <<
state_->snorm;
360 hist << std::scientific << std::setprecision(2);
361 hist << std::setw(10) << std::left <<
state_->searchSize;
364 hist << std::scientific << std::setprecision(6);
365 hist << std::setw(8) << std::left <<
state_->nfval;
366 hist << std::setw(8) << std::left <<
state_->ngrad;
367 hist << std::setw(8) << std::left <<
state_->ncval;
Provides the interface to evaluate the augmented Lagrangian.
void reset(const Vector< Real > &multiplier, const Real penaltyParameter)
int getNumberGradientEvaluations(void) const
void update(const Vector< Real > &x, UpdateType type, int iter=-1)
int getNumberFunctionEvaluations(void) const
Real getObjectiveValue(const Vector< Real > &x, Real &tol)
void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol)
void setScaling(const Real fscale=1.0, const Real cscale=1.0)
const Ptr< const Vector< Real > > getObjectiveGradient(const Vector< Real > &x, Real &tol)
const Ptr< const Vector< Real > > getConstraintVec(const Vector< Real > &x, Real &tol)
int getNumberConstraintEvaluations(void) const
Provides the interface to apply upper and lower bound constraints.
Provides an interface to check status of optimization algorithms for problems with equality constrain...
Defines the general constraint operator interface.
virtual void applyAdjointJacobian(Vector< Real > &ajv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply the adjoint of the the constraint Jacobian at , , to vector .
Provides the interface to evaluate objective functions.
Algorithm()
Constructor, given a step and a status test.
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
const Ptr< CombinedStatusTest< Real > > status_
Ptr< PolyhedralProjection< Real > > proj_
const Ptr< AlgorithmState< Real > > state_
Real optIncreaseExponent_
void writeOutput(std::ostream &os, const bool print_header=false) const override
Print iterate status.
Real optDecreaseExponent_
Real feasDecreaseExponent_
Real minPenaltyLowerBound_
void writeName(std::ostream &os) const override
Print step name.
void run(Vector< Real > &x, const Vector< Real > &g, Objective< Real > &obj, BoundConstraint< Real > &bnd, Constraint< Real > &econ, Vector< Real > &emul, const Vector< Real > &eres, std::ostream &outStream=std::cout) override
Run algorithm on general constrained problems (Type-G). This is the primary Type-G interface.
AugmentedLagrangianAlgorithm(ParameterList &list)
Real feasIncreaseExponent_
void initialize(Vector< Real > &x, const Vector< Real > &g, const Vector< Real > &l, const Vector< Real > &c, AugmentedLagrangianObjective< Real > &alobj, BoundConstraint< Real > &bnd, Constraint< Real > &con, std::ostream &outStream=std::cout)
Real feasToleranceInitial_
Real minPenaltyReciprocal_
void writeHeader(std::ostream &os) const override
Print iterate header.
Real optToleranceInitial_
Defines the linear algebra or vector space interface.
virtual Real norm() const =0
Returns where .
virtual void set(const Vector &x)
Set where .
virtual ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
virtual int dimension() const
Return dimension of the vector space.
virtual ROL::Ptr< Vector > basis(const int i) const
Return i-th basis vector.
virtual void axpy(const Real alpha, const Vector &x)
Compute where .
Ptr< Algorithm< Real > > AlgorithmFactory(ParameterList &parlist)
Real ROL_EPSILON(void)
Platform-dependent machine epsilon.