73 std::ostream &outStream ) {
74 const Real one(1), TOL(1.e-2);
75 Real tol = std::sqrt(ROL_EPSILON<Real>());
90 state_->cnorm = state_->constraintVec->norm();
98 if (useDefaultScaling_) {
101 Ptr<Vector<Real>> ji = x.
clone();
102 Real maxji(0), normji(0);
103 for (
int i = 0; i < c.
dimension(); ++i) {
106 maxji = std::max(normji,maxji);
108 cscale_ = one/std::max(one,maxji);
110 catch (std::exception &e) {
117 state_->gnorm = state_->gradientVec->norm()/std::min(fscale_,cscale_);
120 if (useDefaultInitPen_) {
121 const Real oem8(1e-8), oem2(1e-2), two(2), ten(10);
122 state_->searchSize = std::max(oem8,
123 std::min(ten*std::max(one,std::abs(fscale_*state_->value))
124 / std::max(one,std::pow(cscale_*state_->cnorm,two)),oem2*maxPenaltyParam_));
127 optTolerance_ = std::max<Real>(TOL*outerOptTolerance_,
128 optToleranceInitial_);
130 feasTolerance_ = std::max<Real>(TOL*outerFeasTolerance_,
131 feasToleranceInitial_);
134 alobj.
reset(l,state_->searchSize,sigma_);
136 if (verbosity_ > 1) {
137 outStream << std::endl;
138 outStream <<
"Stabilized LCL Initialize" << std::endl;
139 outStream <<
"Objective Scaling: " << fscale_ << std::endl;
140 outStream <<
"Constraint Scaling: " << cscale_ << std::endl;
141 outStream <<
"Penalty Parameter: " << state_->searchSize << std::endl;
142 outStream << std::endl;
173 std::ostream &outStream ) {
174 const Real one(1), oem2(1e-2);
175 Real tol(std::sqrt(ROL_EPSILON<Real>())), cnorm(0), lnorm;;
178 state_->searchSize,sigma_,g,eres,emul,
179 scaleLagrangian_,HessianApprox_);
180 initialize(x,g,emul,eres,alobj,econ,outStream);
182 Ptr<Vector<Real>> u = eres.
clone(), v = eres.
clone(), c = eres.
clone();
183 Ptr<Vector<Real>> gu = emul.
clone(), gv = emul.
clone(), l = emul.
clone();
185 Ptr<ElasticLinearConstraint<Real>> lcon
186 = makePtr<ElasticLinearConstraint<Real>>(makePtrFromRef(x),
187 makePtrFromRef(econ),
188 makePtrFromRef(eres));
189 std::vector<Ptr<Vector<Real>>> vecList = {s,u,v};
190 Ptr<PartitionedVector<Real>> xp = makePtr<PartitionedVector<Real>>(vecList);
191 Ptr<PartitionedVector<Real>> gxp = makePtr<PartitionedVector<Real>>({gs,gu,gv});
192 Ptr<Vector<Real>> lb = u->clone(); lb->zero();
193 std::vector<Ptr<BoundConstraint<Real>>> bndList(3);
194 bndList[0] = makePtr<BoundConstraint<Real>>(); bndList[0]->deactivate();
195 bndList[1] = makePtr<Bounds<Real>>(*lb,
true);
196 bndList[2] = makePtr<Bounds<Real>>(*lb,
true);
197 Ptr<BoundConstraint<Real>> xbnd
198 = makePtr<BoundConstraint_Partitioned<Real>>(bndList,vecList);
199 ParameterList ppa_list;
200 if (c->dimension() == 1)
201 ppa_list.sublist(
"General").sublist(
"Polyhedral Projection").set(
"Type",
"Dai-Fletcher");
203 ppa_list.sublist(
"General").sublist(
"Polyhedral Projection").set(
"Type",
"Semismooth Newton");
207 elc.
finalize(
false,verbosity_>2,outStream);
208 Ptr<Vector<Real>> b2 = eres.
clone(), xpwa = xp->clone(), mul = emul.
clone();
212 Ptr<TypeB::Algorithm<Real>> algo;
215 if (verbosity_ > 0) writeOutput(outStream,
true);
217 while (status_->check(*state_)) {
218 lcon->setAnchor(state_->iterateVec);
219 if (verbosity_ > 3) elc.
check(
true,outStream);
222 list_.sublist(
"Status Test").set(
"Gradient Tolerance",optTolerance_);
223 list_.sublist(
"Status Test").set(
"Step Tolerance",1.e-6*optTolerance_);
224 algo = TypeB::AlgorithmFactory<Real>(list_,secant_);
225 algo->run(elc,outStream);
229 subproblemIter_ = algo->getState()->iter;
235 state_->stepVec->set(x);
236 state_->stepVec->axpy(-one,*state_->iterateVec);
237 state_->snorm = state_->stepVec->norm();
242 cnorm = cvec->norm();
243 if ( cscale_*cnorm < feasTolerance_ ) {
245 state_->iterateVec->set(x);
247 state_->constraintVec->set(*cvec);
248 state_->cnorm = cnorm;
252 emul.
axpy(state_->searchSize*cscale_,state_->constraintVec->dual());
255 if (scaleLagrangian_) state_->gradientVec->scale(state_->searchSize);
257 state_->gradientVec->axpy(-cscale_,*gs);
258 state_->gnorm = state_->gradientVec->norm();
262 sigma_ = std::min(one+lnorm,sigmaMax_)/(one+state_->searchSize);
264 optTolerance_ = std::max(oem2*outerOptTolerance_,
265 optTolerance_/(one + std::pow(state_->searchSize,optIncreaseExponent_)));
267 feasTolerance_ = std::max(oem2*outerFeasTolerance_,
268 feasTolerance_/(one + std::pow(state_->searchSize,feasIncreaseExponent_)));
271 state_->snorm += lnorm + state_->searchSize*cscale_*state_->cnorm;
272 state_->lagmultVec->set(emul);
276 state_->searchSize = std::min(penaltyUpdate_*state_->searchSize,maxPenaltyParam_);
277 sigma_ /= sigmaUpdate_;
278 optTolerance_ = std::max(oem2*outerOptTolerance_,
279 optToleranceInitial_/(one + std::pow(state_->searchSize,optDecreaseExponent_)));
280 feasTolerance_ = std::max(oem2*outerFeasTolerance_,
281 feasToleranceInitial_/(one + std::pow(state_->searchSize,feasDecreaseExponent_)));
283 alobj.
reset(emul,state_->searchSize,sigma_);
286 if (verbosity_ > 0) writeOutput(outStream,printHeader_);
293 std::ios_base::fmtflags osFlags(os.flags());
295 os << std::string(114,
'-') << std::endl;
296 os <<
"Stabilized LCL status output definitions" << std::endl << std::endl;
297 os <<
" iter - Number of iterates (steps taken)" << std::endl;
298 os <<
" fval - Objective function value" << std::endl;
299 os <<
" cnorm - Norm of the constraint violation" << std::endl;
300 os <<
" gLnorm - Norm of the gradient of the Lagrangian" << std::endl;
301 os <<
" snorm - Norm of the step" << std::endl;
302 os <<
" penalty - Penalty parameter" << std::endl;
303 os <<
" sigma - Elastic Penalty parameter" << std::endl;
304 os <<
" feasTol - Feasibility tolerance" << std::endl;
305 os <<
" optTol - Optimality tolerance" << std::endl;
306 os <<
" #fval - Number of times the objective was computed" << std::endl;
307 os <<
" #grad - Number of times the gradient was computed" << std::endl;
308 os <<
" #cval - Number of times the constraint was computed" << std::endl;
309 os <<
" subIter - Number of iterations to solve subproblem" << std::endl;
310 os << std::string(114,
'-') << std::endl;
313 os << std::setw(6) << std::left <<
"iter";
314 os << std::setw(15) << std::left <<
"fval";
315 os << std::setw(15) << std::left <<
"cnorm";
316 os << std::setw(15) << std::left <<
"gLnorm";
317 os << std::setw(15) << std::left <<
"snorm";
318 os << std::setw(10) << std::left <<
"penalty";
319 os << std::setw(10) << std::left <<
"sigma";
320 os << std::setw(10) << std::left <<
"feasTol";
321 os << std::setw(10) << std::left <<
"optTol";
322 os << std::setw(8) << std::left <<
"#fval";
323 os << std::setw(8) << std::left <<
"#grad";
324 os << std::setw(8) << std::left <<
"#cval";
325 os << std::setw(8) << std::left <<
"subIter";
341 std::ios_base::fmtflags osFlags(os.flags());
342 os << std::scientific << std::setprecision(6);
343 if ( state_->iter == 0 ) writeName(os);
344 if ( print_header ) writeHeader(os);
345 if ( state_->iter == 0 ) {
347 os << std::setw(6) << std::left << state_->iter;
348 os << std::setw(15) << std::left << state_->value;
349 os << std::setw(15) << std::left << state_->cnorm;
350 os << std::setw(15) << std::left << state_->gnorm;
351 os << std::setw(15) << std::left <<
"---";
352 os << std::scientific << std::setprecision(2);
353 os << std::setw(10) << std::left << state_->searchSize;
354 os << std::setw(10) << std::left << sigma_;
355 os << std::setw(10) << std::left << std::max(feasTolerance_,outerFeasTolerance_);
356 os << std::setw(10) << std::left << std::max(optTolerance_,outerOptTolerance_);
357 os << std::scientific << std::setprecision(6);
358 os << std::setw(8) << std::left << state_->nfval;
359 os << std::setw(8) << std::left << state_->ngrad;
360 os << std::setw(8) << std::left << state_->ncval;
361 os << std::setw(8) << std::left <<
"---";
366 os << std::setw(6) << std::left << state_->iter;
367 os << std::setw(15) << std::left << state_->value;
368 os << std::setw(15) << std::left << state_->cnorm;
369 os << std::setw(15) << std::left << state_->gnorm;
370 os << std::setw(15) << std::left << state_->snorm;
371 os << std::scientific << std::setprecision(2);
372 os << std::setw(10) << std::left << state_->searchSize;
373 os << std::setw(10) << std::left << sigma_;
374 os << std::setw(10) << std::left << feasTolerance_;
375 os << std::setw(10) << std::left << optTolerance_;
376 os << std::scientific << std::setprecision(6);
377 os << std::setw(8) << std::left << state_->nfval;
378 os << std::setw(8) << std::left << state_->ngrad;
379 os << std::setw(8) << std::left << state_->ncval;
380 os << std::setw(8) << std::left << subproblemIter_;