108 std::ostream &outStream ) {
109 const Real one(1), TOL(1.e-2);
110 Real tol = std::sqrt(ROL_EPSILON<Real>());
121 alobj.
gradient(*state_->gradientVec,x,tol);
125 state_->cnorm = state_->constraintVec->norm();
133 if (useDefaultScaling_) {
136 Ptr<Vector<Real>> ji = x.
clone();
137 Real maxji(0), normji(0);
138 for (
int i = 0; i < c.
dimension(); ++i) {
141 maxji = std::max(normji,maxji);
143 cscale_ = one/std::max(one,maxji);
145 catch (std::exception &e) {
152 state_->gnorm = state_->gradientVec->norm()/std::min(fscale_,cscale_);
155 if (useRelTol_) outerOptTolerance_ *= state_->gnorm;
156 if (useDefaultInitPen_) {
157 const Real oem8(1e-8), oem2(1e-2), two(2), ten(10);
158 state_->searchSize = std::max(oem8,
159 std::min(ten*std::max(one,std::abs(fscale_*state_->value))
160 / std::max(one,std::pow(cscale_*state_->cnorm,two)),oem2*maxPenaltyParam_));
163 minPenaltyReciprocal_ = std::min(one/state_->searchSize,minPenaltyLowerBound_);
164 optTolerance_ = std::max<Real>(TOL*outerOptTolerance_,
165 optToleranceInitial_*std::pow(minPenaltyReciprocal_,optDecreaseExponent_));
166 optTolerance_ = std::min<Real>(optTolerance_,TOL*state_->gnorm);
167 feasTolerance_ = std::max<Real>(TOL*outerFeasTolerance_,
168 feasToleranceInitial_*std::pow(minPenaltyReciprocal_,feasDecreaseExponent_));
171 alobj.
reset(l,state_->searchSize);
173 if (verbosity_ > 1) {
174 outStream << std::endl;
175 outStream <<
"Augmented Lagrangian Initialize" << std::endl;
176 outStream <<
"Objective Scaling: " << fscale_ << std::endl;
177 outStream <<
"Constraint Scaling: " << cscale_ << std::endl;
178 outStream << std::endl;
189 std::ostream &outStream ) {
190 const Real one(1), oem2(1e-2);
191 Real tol(std::sqrt(ROL_EPSILON<Real>()));
194 state_->searchSize,g,eres,emul,
195 scaleLagrangian_,HessianApprox_);
196 initialize(x,g,emul,eres,alobj,econ,outStream);
197 Ptr<TypeU::Algorithm<Real>> algo;
200 if (verbosity_ > 0) writeOutput(outStream,
true);
202 while (status_->check(*state_)) {
204 list_.sublist(
"Status Test").set(
"Gradient Tolerance",optTolerance_);
205 list_.sublist(
"Status Test").set(
"Step Tolerance",1.e-6*optTolerance_);
206 algo = TypeU::AlgorithmFactory<Real>(list_);
207 algo->run(x,g,alobj,outStream);
208 subproblemIter_ = algo->getState()->iter;
211 state_->stepVec->set(x);
212 state_->stepVec->axpy(-one,*state_->iterateVec);
213 state_->snorm = state_->stepVec->norm();
217 state_->iterateVec->set(x);
220 state_->cnorm = state_->constraintVec->norm();
221 alobj.
gradient(*state_->gradientVec,x,tol);
222 if (scaleLagrangian_) {
223 state_->gradientVec->scale(state_->searchSize);
225 state_->gnorm = state_->gradientVec->norm()/std::min(fscale_,cscale_);
234 minPenaltyReciprocal_ = std::min(one/state_->searchSize,minPenaltyLowerBound_);
235 if ( cscale_*state_->cnorm < feasTolerance_ ) {
236 emul.
axpy(state_->searchSize*cscale_,state_->constraintVec->dual());
238 optTolerance_ = std::max(oem2*outerOptTolerance_,
239 optTolerance_*std::pow(minPenaltyReciprocal_,optIncreaseExponent_));
241 feasTolerance_ = std::max(oem2*outerFeasTolerance_,
242 feasTolerance_*std::pow(minPenaltyReciprocal_,feasIncreaseExponent_));
244 state_->snorm += state_->searchSize*cscale_*state_->cnorm;
245 state_->lagmultVec->set(emul);
248 state_->searchSize = std::min(penaltyUpdate_*state_->searchSize,maxPenaltyParam_);
249 optTolerance_ = std::max(oem2*outerOptTolerance_,
250 optToleranceInitial_*std::pow(minPenaltyReciprocal_,optDecreaseExponent_));
251 feasTolerance_ = std::max(oem2*outerFeasTolerance_,
252 feasToleranceInitial_*std::pow(minPenaltyReciprocal_,feasDecreaseExponent_));
254 alobj.
reset(emul,state_->searchSize);
257 if (verbosity_ > 0) writeOutput(outStream,printHeader_);
265 std::stringstream hist;
267 hist << std::string(114,
'-') << std::endl;
268 hist <<
"Augmented Lagrangian status output definitions" << std::endl << std::endl;
269 hist <<
" iter - Number of iterates (steps taken)" << std::endl;
270 hist <<
" fval - Objective function value" << std::endl;
271 hist <<
" cnorm - Norm of the constraint violation" << std::endl;
272 hist <<
" gLnorm - Norm of the gradient of the Lagrangian" << std::endl;
273 hist <<
" snorm - Norm of the step" << std::endl;
274 hist <<
" penalty - Penalty parameter" << std::endl;
275 hist <<
" feasTol - Feasibility tolerance" << std::endl;
276 hist <<
" optTol - Optimality tolerance" << std::endl;
277 hist <<
" #fval - Number of times the objective was computed" << std::endl;
278 hist <<
" #grad - Number of times the gradient was computed" << std::endl;
279 hist <<
" #cval - Number of times the constraint was computed" << std::endl;
280 hist <<
" subIter - Number of iterations to solve subproblem" << std::endl;
281 hist << std::string(114,
'-') << std::endl;
284 hist << std::setw(6) << std::left <<
"iter";
285 hist << std::setw(15) << std::left <<
"fval";
286 hist << std::setw(15) << std::left <<
"cnorm";
287 hist << std::setw(15) << std::left <<
"gLnorm";
288 hist << std::setw(15) << std::left <<
"snorm";
289 hist << std::setw(10) << std::left <<
"penalty";
290 hist << std::setw(10) << std::left <<
"feasTol";
291 hist << std::setw(10) << std::left <<
"optTol";
292 hist << std::setw(8) << std::left <<
"#fval";
293 hist << std::setw(8) << std::left <<
"#grad";
294 hist << std::setw(8) << std::left <<
"#cval";
295 hist << std::setw(8) << std::left <<
"subIter";
311 std::stringstream hist;
312 hist << std::scientific << std::setprecision(6);
313 if ( state_->iter == 0 ) writeName(os);
314 if ( print_header ) writeHeader(os);
315 if ( state_->iter == 0 ) {
317 hist << std::setw(6) << std::left << state_->iter;
318 hist << std::setw(15) << std::left << state_->value;
319 hist << std::setw(15) << std::left << state_->cnorm;
320 hist << std::setw(15) << std::left << state_->gnorm;
321 hist << std::setw(15) << std::left <<
"---";
322 hist << std::scientific << std::setprecision(2);
323 hist << std::setw(10) << std::left << state_->searchSize;
324 hist << std::setw(10) << std::left << std::max(feasTolerance_,outerFeasTolerance_);
325 hist << std::setw(10) << std::left << std::max(optTolerance_,outerOptTolerance_);
326 hist << std::scientific << std::setprecision(6);
327 hist << std::setw(8) << std::left << state_->nfval;
328 hist << std::setw(8) << std::left << state_->ngrad;
329 hist << std::setw(8) << std::left << state_->ncval;
330 hist << std::setw(8) << std::left <<
"---";
335 hist << std::setw(6) << std::left << state_->iter;
336 hist << std::setw(15) << std::left << state_->value;
337 hist << std::setw(15) << std::left << state_->cnorm;
338 hist << std::setw(15) << std::left << state_->gnorm;
339 hist << std::setw(15) << std::left << state_->snorm;
340 hist << std::scientific << std::setprecision(2);
341 hist << std::setw(10) << std::left << state_->searchSize;
342 hist << std::setw(10) << std::left << feasTolerance_;
343 hist << std::setw(10) << std::left << optTolerance_;
344 hist << std::scientific << std::setprecision(6);
345 hist << std::setw(8) << std::left << state_->nfval;
346 hist << std::setw(8) << std::left << state_->ngrad;
347 hist << std::setw(8) << std::left << state_->ncval;
348 hist << std::setw(8) << std::left << subproblemIter_;
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 .
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
Run algorithm on equality constrained problems (Type-E). This general interface supports the use of d...