44 #ifndef ROL_AUGMENTEDLAGRANGIANSTEP_H 45 #define ROL_AUGMENTEDLAGRANGIANSTEP_H 58 #include "Teuchos_ParameterList.hpp" 71 Teuchos::RCP<AugmentedLagrangian<Real> >
augLag_;
72 Teuchos::RCP<Algorithm<Real> >
algo_;
73 Teuchos::RCP<Vector<Real> >
x_;
102 augLag_->gradient(g,x,zerotol);
103 if ( scaleLagrangian_ ) {
109 x_->axpy(-1.,g.
dual());
124 :
Step<Real>(), augLag_(Teuchos::null), algo_(Teuchos::null),
125 x_(Teuchos::null), parlist_(parlist), subproblemIter_(0) {
126 Teuchos::ParameterList& sublist = parlist.sublist(
"Step").sublist(
"Augmented Lagrangian");
129 scaleLagrangian_ = sublist.get(
"Use Scaled Augmented Lagrangian",
false);
130 minPenaltyLowerBound_ = sublist.get(
"Penalty Parameter Reciprocal Lower Bound", 0.1);
131 minPenaltyReciprocal_ = 0.1;
133 optIncreaseExponent_ = sublist.get(
"Optimality Tolerance Update Exponent", 1.0);
134 optDecreaseExponent_ = sublist.get(
"Optimality Tolerance Decrease Exponent", 1.0);
135 optToleranceInitial_ = sublist.get(
"Initial Optimality Tolerance", 1.0);
137 feasIncreaseExponent_ = sublist.get(
"Feasibility Tolerance Update Exponent", 0.1);
138 feasDecreaseExponent_ = sublist.get(
"Feasibility Tolerance Decrease Exponent", 0.9);
139 feasToleranceInitial_ = sublist.get(
"Initial Feasibility Tolerance", 1.0);
141 print_ = sublist.get(
"Print Intermediate Optimization History",
false);
142 maxit_ = sublist.get(
"Subproblem Iteration Limit", 1000);
143 subStep_ = sublist.get(
"Subproblem Step Type",
"Trust Region");
144 parlist_.sublist(
"Status Test").set(
"Iteration Limit",maxit_);
146 outerFeasTolerance_ = parlist.sublist(
"Status Test").get(
"Constraint Tolerance", 1.e-8);
147 outerOptTolerance_ = parlist.sublist(
"Status Test").get(
"Gradient Tolerance", 1.e-8);
157 state->descentVec = x.
clone();
158 state->gradientVec = g.
clone();
159 state->constraintVec = c.
clone();
163 algo_state.
nfval = 0;
164 algo_state.
ncval = 0;
165 algo_state.
ngrad = 0;
167 minPenaltyReciprocal_ = std::min(1./state->searchSize,minPenaltyLowerBound_);
168 optTolerance_ = optToleranceInitial_*std::pow(minPenaltyReciprocal_,optDecreaseExponent_);
169 feasTolerance_ = feasToleranceInitial_*std::pow(minPenaltyReciprocal_,feasDecreaseExponent_);
178 augLag_->update(x,
true,algo_state.
iter);
179 algo_state.
value = augLag_->getObjectiveValue();
181 augLag_->getConstraintVec(*(state->constraintVec));
182 algo_state.
cnorm = (state->constraintVec)->norm();
184 algo_state.
ncval += augLag_->getNumberConstraintEvaluations();
185 algo_state.
nfval += augLag_->getNumberFunctionEvaluations();
186 algo_state.
ngrad += augLag_->getNumberGradientEvaluations();
194 parlist_.sublist(
"Status Test").set(
"Gradient Tolerance",optTolerance_);
195 parlist_.sublist(
"Status Test").set(
"Step Tolerance",1.e-6*optTolerance_);
199 algo_->run(*x_,*augLag_,bnd,print_);
202 algo_->run(*x_,*augLag_,print_);
205 subproblemIter_ = (algo_->getState())->iter;
218 state->descentVec->set(s);
222 augLag_->update(x,
true,algo_state.
iter);
224 algo_state.
value = augLag_->getObjectiveValue();
226 augLag_->getConstraintVec(*(state->constraintVec));
227 algo_state.
cnorm = (state->constraintVec)->norm();
231 bool updated = augLag_->updateMultipliers(l,state->searchSize,x,feasTolerance_);
232 algo_state.
snorm += (updated ? l.
norm() + 1. : 0.);
234 minPenaltyReciprocal_ = std::min(1./state->searchSize,minPenaltyLowerBound_);
235 if ( algo_state.
cnorm < feasTolerance_ ) {
236 optTolerance_ *= std::pow(minPenaltyReciprocal_,optIncreaseExponent_);
237 feasTolerance_ *= std::pow(minPenaltyReciprocal_,feasIncreaseExponent_);
240 optTolerance_ = optToleranceInitial_*std::pow(minPenaltyReciprocal_,optDecreaseExponent_);
241 feasTolerance_ = feasToleranceInitial_*std::pow(minPenaltyReciprocal_,feasDecreaseExponent_);
244 algo_state.
nfval += augLag_->getNumberFunctionEvaluations();
245 algo_state.
ngrad += augLag_->getNumberGradientEvaluations();
246 algo_state.
ncval += augLag_->getNumberConstraintEvaluations();
253 std::stringstream hist;
255 hist << std::setw(6) << std::left <<
"iter";
256 hist << std::setw(15) << std::left <<
"fval";
257 hist << std::setw(15) << std::left <<
"cnorm";
258 hist << std::setw(15) << std::left <<
"gLnorm";
259 hist << std::setw(15) << std::left <<
"snorm";
260 hist << std::setw(10) << std::left <<
"penalty";
261 hist << std::setw(10) << std::left <<
"feasTol";
262 hist << std::setw(10) << std::left <<
"optTol";
263 hist << std::setw(8) << std::left <<
"#fval";
264 hist << std::setw(8) << std::left <<
"#grad";
265 hist << std::setw(8) << std::left <<
"#cval";
266 hist << std::setw(8) << std::left <<
"subIter";
274 std::stringstream hist;
275 hist <<
"\n" <<
" Augmented Lagrangian solver";
283 std::stringstream hist;
284 hist << std::scientific << std::setprecision(6);
285 if ( algo_state.
iter == 0 ) {
291 if ( algo_state.
iter == 0 ) {
293 hist << std::setw(6) << std::left << algo_state.
iter;
294 hist << std::setw(15) << std::left << algo_state.
value;
295 hist << std::setw(15) << std::left << algo_state.
cnorm;
296 hist << std::setw(15) << std::left << algo_state.
gnorm;
297 hist << std::setw(15) << std::left <<
" ";
298 hist << std::scientific << std::setprecision(2);
299 hist << std::setw(10) << std::left << Step<Real>::getStepState()->searchSize;
300 hist << std::setw(10) << std::left << std::max(feasTolerance_,outerFeasTolerance_);
301 hist << std::setw(10) << std::left << std::max(optTolerance_,outerOptTolerance_);
306 hist << std::setw(6) << std::left << algo_state.
iter;
307 hist << std::setw(15) << std::left << algo_state.
value;
308 hist << std::setw(15) << std::left << algo_state.
cnorm;
309 hist << std::setw(15) << std::left << algo_state.
gnorm;
310 hist << std::setw(15) << std::left << algo_state.
snorm;
311 hist << std::scientific << std::setprecision(2);
312 hist << std::setw(10) << std::left << Step<Real>::getStepState()->searchSize;
315 hist << std::scientific << std::setprecision(6);
316 hist << std::setw(8) << std::left << algo_state.
nfval;
317 hist << std::setw(8) << std::left << algo_state.
ngrad;
318 hist << std::setw(8) << std::left << algo_state.
ncval;
Real feasDecreaseExponent_
void initialize(Vector< Real > &x, const Vector< Real > &g, Vector< Real > &l, const Vector< Real > &c, Objective< Real > &obj, EqualityConstraint< Real > &con, BoundConstraint< Real > &bnd, AlgorithmState< Real > &algo_state)
Initialize step with equality constraint.
Provides the interface to evaluate objective functions.
Provides the interface to evaluate the augmented Lagrangian.
virtual const Vector & dual() const
Return dual representation of , for example, the result of applying a Riesz map, or change of basis...
virtual void scale(const Real alpha)=0
Compute where .
std::string printHeader(void) const
Print iterate header.
virtual void plus(const Vector &x)=0
Compute , where .
virtual void axpy(const Real alpha, const Vector &x)
Compute where .
Provides the interface to compute optimization steps.
Real feasIncreaseExponent_
Real feasToleranceInitial_
Teuchos::RCP< StepState< Real > > getState(void)
Contains definitions of custom data types in ROL.
Teuchos::RCP< Algorithm< Real > > algo_
virtual void update(const Vector< Real > &x, bool flag=true, int iter=-1)
Update bounds.
virtual Teuchos::RCP< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
Defines the linear algebra or vector space interface.
~AugmentedLagrangianStep()
Provides the interface to compute augmented Lagrangian steps.
std::string printName(void) const
Print step name.
Real optIncreaseExponent_
State for algorithm class. Will be used for restarts.
Teuchos::RCP< Vector< Real > > x_
bool isActivated(void)
Check if bounds are on.
Defines the equality constraint operator interface.
Real minPenaltyLowerBound_
Provides an interface to run optimization algorithms.
AugmentedLagrangianStep(Teuchos::ParameterList &parlist)
Real optDecreaseExponent_
Real minPenaltyReciprocal_
Teuchos::RCP< AugmentedLagrangian< Real > > augLag_
void compute(Vector< Real > &s, const Vector< Real > &x, const Vector< Real > &l, Objective< Real > &obj, EqualityConstraint< Real > &con, BoundConstraint< Real > &bnd, AlgorithmState< Real > &algo_state)
Compute step (equality and bound constraints).
Real optToleranceInitial_
Provides the interface to apply upper and lower bound constraints.
std::string print(AlgorithmState< Real > &algo_state, bool pHeader=false) const
Print iterate status.
Teuchos::RCP< Vector< Real > > lagmultVec
Teuchos::RCP< Vector< Real > > iterateVec
virtual void set(const Vector &x)
Set where .
virtual Real norm() const =0
Returns where .
void update(Vector< Real > &x, Vector< Real > &l, const Vector< Real > &s, Objective< Real > &obj, EqualityConstraint< Real > &con, BoundConstraint< Real > &bnd, AlgorithmState< Real > &algo_state)
Update step, if successful (equality and bound constraints).
void update(Vector< Real > &x, const Vector< Real > &s, Objective< Real > &obj, BoundConstraint< Real > &con, AlgorithmState< Real > &algo_state)
Update step, for bound constraints; here only to satisfy the interface requirements, does nothing, needs refactoring.
virtual void project(Vector< Real > &x)
Project optimization variables onto the bounds.
Teuchos::ParameterList parlist_
Real computeGradient(Vector< Real > &g, const Vector< Real > &x, const Real mu, BoundConstraint< Real > &bnd)
static const double ROL_EPSILON
Platform-dependent machine epsilon.
void compute(Vector< Real > &s, const Vector< Real > &x, Objective< Real > &obj, BoundConstraint< Real > &con, AlgorithmState< Real > &algo_state)
Compute step for bound constraints; here only to satisfy the interface requirements, does nothing, needs refactoring.