44 #ifndef ROL_AUGMENTEDLAGRANGIANSTEP_H
45 #define ROL_AUGMENTEDLAGRANGIANSTEP_H
50 #include "ROL_ParameterList.hpp"
154 class MoreauYosidaPenaltyStep;
157 class InteriorPointStep;
159 template <
class Real>
165 ROL::Ptr<Vector<Real>>
x_;
166 ROL::Ptr<BoundConstraint<Real>>
bnd_;
206 Real gnorm = 0., tol = std::sqrt(ROL_EPSILON<Real>());
214 x_->axpy(
static_cast<Real
>(-1),g.
dual());
216 x_->axpy(
static_cast<Real
>(-1),x);
236 Real one(1), p1(0.1), p9(0.9), ten(1.e1), oe8(1.e8), oem8(1.e-8);
237 ROL::ParameterList& sublist = parlist.sublist(
"Step").sublist(
"Augmented Lagrangian");
244 penaltyUpdate_ = sublist.get(
"Penalty Parameter Growth Factor", ten);
255 print_ = sublist.get(
"Print Intermediate Optimization History",
false);
256 maxit_ = sublist.get(
"Subproblem Iteration Limit", 1000);
257 subStep_ = sublist.get(
"Subproblem Step Type",
"Trust Region");
261 verbosity_ = parlist.sublist(
"General").get(
"Print Verbosity", 0);
269 fscale_ = sublist.get(
"Objective Scaling", 1.0);
270 cscale_ = sublist.get(
"Constraint Scaling", 1.0);
278 bnd_ = ROL::makePtr<BoundConstraint<Real>>();
288 Real one(1), TOL(1.e-2);
293 state->descentVec = x.
clone();
294 state->gradientVec = g.
clone();
295 state->constraintVec = c.
clone();
299 algo_state.
nfval = 0;
300 algo_state.
ncval = 0;
301 algo_state.
ngrad = 0;
312 Real tol = std::sqrt(ROL_EPSILON<Real>());
313 Ptr<Vector<Real>> ji = x.
clone();
314 Real maxji(0), normji(0);
315 for (
int i = 0; i < c.
dimension(); ++i) {
318 maxji = std::max(normji,maxji);
320 cscale_ = one/std::max(one,maxji);
322 catch (std::exception &e) {
330 algo_state.
cnorm = (state->constraintVec)->norm();
333 = std::max(
static_cast<Real
>(1e-8),std::min(
static_cast<Real
>(10)*
350 std::cout << std::endl;
351 std::cout <<
"Augmented Lagrangian Initialize" << std::endl;
352 std::cout <<
"Objective Scaling: " <<
fscale_ << std::endl;
353 std::cout <<
"Constraint Scaling: " <<
cscale_ << std::endl;
354 std::cout << std::endl;
376 Ptr<Objective<Real>> penObj;
380 penObj = makePtrFromRef(obj);
382 else if (
subStep_ ==
"Line Search") {
385 penObj = makePtrFromRef(obj);
387 else if (
subStep_ ==
"Moreau-Yosida Penalty") {
390 Ptr<Objective<Real>> raw_obj = makePtrFromRef(obj);
391 penObj = ROL::makePtr<MoreauYosidaPenalty<Real>>(raw_obj,
bnd_,x,
parlist_);
393 else if (
subStep_ ==
"Primal Dual Active Set") {
396 penObj = makePtrFromRef(obj);
398 else if (
subStep_ ==
"Trust Region") {
401 penObj = makePtrFromRef(obj);
403 else if (
subStep_ ==
"Interior Point") {
406 Ptr<Objective<Real>> raw_obj = makePtrFromRef(obj);
407 penObj = ROL::makePtr<InteriorPoint::PenalizedObjective<Real>>(raw_obj,
bnd_,x,
parlist_);
441 Real one(1), oem2(1.e-2);
449 state->descentVec->set(s);
456 algo_state.
cnorm = (state->constraintVec)->norm();
470 l.
axpy(state->searchSize*
cscale_,(state->constraintVec)->dual());
488 augLag.
reset(l,state->searchSize);
494 std::stringstream hist;
497 hist << std::string(114,
'-') << std::endl;
498 hist <<
"Augmented Lagrangian status output definitions" << std::endl << std::endl;
499 hist <<
" iter - Number of iterates (steps taken)" << std::endl;
500 hist <<
" fval - Objective function value" << std::endl;
501 hist <<
" cnorm - Norm of the constraint violation" << std::endl;
502 hist <<
" gLnorm - Norm of the gradient of the Lagrangian" << std::endl;
503 hist <<
" snorm - Norm of the step" << std::endl;
504 hist <<
" penalty - Penalty parameter" << std::endl;
505 hist <<
" feasTol - Feasibility tolerance" << std::endl;
506 hist <<
" optTol - Optimality tolerance" << std::endl;
507 hist <<
" #fval - Number of times the objective was computed" << std::endl;
508 hist <<
" #grad - Number of times the gradient was computed" << std::endl;
509 hist <<
" #cval - Number of times the constraint was computed" << std::endl;
510 hist <<
" subIter - Number of iterations to solve subproblem" << std::endl;
511 hist << std::string(114,
'-') << std::endl;
514 hist << std::setw(6) << std::left <<
"iter";
515 hist << std::setw(15) << std::left <<
"fval";
516 hist << std::setw(15) << std::left <<
"cnorm";
517 hist << std::setw(15) << std::left <<
"gLnorm";
518 hist << std::setw(15) << std::left <<
"snorm";
519 hist << std::setw(10) << std::left <<
"penalty";
520 hist << std::setw(10) << std::left <<
"feasTol";
521 hist << std::setw(10) << std::left <<
"optTol";
522 hist << std::setw(8) << std::left <<
"#fval";
523 hist << std::setw(8) << std::left <<
"#grad";
524 hist << std::setw(8) << std::left <<
"#cval";
525 hist << std::setw(8) << std::left <<
"subIter";
533 std::stringstream hist;
534 hist << std::endl <<
" Augmented Lagrangian Solver";
536 hist <<
"Subproblem Solver: " <<
subStep_ << std::endl;
543 std::stringstream hist;
544 hist << std::scientific << std::setprecision(6);
545 if ( algo_state.
iter == 0 ) {
551 if ( algo_state.
iter == 0 ) {
553 hist << std::setw(6) << std::left << algo_state.
iter;
554 hist << std::setw(15) << std::left << algo_state.
value;
555 hist << std::setw(15) << std::left << algo_state.
cnorm;
556 hist << std::setw(15) << std::left << algo_state.
gnorm;
557 hist << std::setw(15) << std::left <<
" ";
558 hist << std::scientific << std::setprecision(2);
559 hist << std::setw(10) << std::left << Step<Real>::getStepState()->searchSize;
566 hist << std::setw(6) << std::left << algo_state.
iter;
567 hist << std::setw(15) << std::left << algo_state.
value;
568 hist << std::setw(15) << std::left << algo_state.
cnorm;
569 hist << std::setw(15) << std::left << algo_state.
gnorm;
570 hist << std::setw(15) << std::left << algo_state.
snorm;
571 hist << std::scientific << std::setprecision(2);
572 hist << std::setw(10) << std::left << Step<Real>::getStepState()->searchSize;
575 hist << std::scientific << std::setprecision(6);
576 hist << std::setw(8) << std::left << algo_state.
nfval;
577 hist << std::setw(8) << std::left << algo_state.
ngrad;
578 hist << std::setw(8) << std::left << algo_state.
ncval;