107 std::ostream &outStream ) {
108 const Real one(1), TOL(1.e-2);
109 Real tol = std::sqrt(ROL_EPSILON<Real>());
124 state_->cnorm = state_->constraintVec->norm();
132 if (useDefaultScaling_) {
135 Ptr<Vector<Real>> ji = x.
clone();
136 Real maxji(0), normji(0);
137 for (
int i = 0; i < c.
dimension(); ++i) {
140 maxji = std::max(normji,maxji);
142 cscale_ = one/std::max(one,maxji);
144 catch (std::exception &e) {
151 state_->gnorm = state_->gradientVec->norm()/std::min(fscale_,cscale_);
154 if (useDefaultInitPen_) {
155 const Real oem8(1e-8), oem2(1e-2), two(2), ten(10);
156 state_->searchSize = std::max(oem8,
157 std::min(ten*std::max(one,std::abs(fscale_*state_->value))
158 / std::max(one,std::pow(cscale_*state_->cnorm,two)),oem2*maxPenaltyParam_));
161 optTolerance_ = std::max<Real>(TOL*outerOptTolerance_,
162 optToleranceInitial_);
164 feasTolerance_ = std::max<Real>(TOL*outerFeasTolerance_,
165 feasToleranceInitial_);
168 alobj.
reset(l,state_->searchSize,sigma_);
170 if (verbosity_ > 1) {
171 outStream << std::endl;
172 outStream <<
"Stabilized LCL Initialize" << std::endl;
173 outStream <<
"Objective Scaling: " << fscale_ << std::endl;
174 outStream <<
"Constraint Scaling: " << cscale_ << std::endl;
175 outStream <<
"Penalty Parameter: " << state_->searchSize << std::endl;
176 outStream << std::endl;
207 std::ostream &outStream ) {
208 const Real one(1), oem2(1e-2);
209 Real tol(std::sqrt(ROL_EPSILON<Real>())), cnorm(0), lnorm;;
212 state_->searchSize,sigma_,g,eres,emul,
213 scaleLagrangian_,HessianApprox_);
214 initialize(x,g,emul,eres,alobj,econ,outStream);
216 Ptr<Vector<Real>> u = eres.
clone(), v = eres.
clone(), c = eres.
clone();
217 Ptr<Vector<Real>> gu = emul.
clone(), gv = emul.
clone(), l = emul.
clone();
219 Ptr<ElasticLinearConstraint<Real>> lcon
220 = makePtr<ElasticLinearConstraint<Real>>(makePtrFromRef(x),
221 makePtrFromRef(econ),
222 makePtrFromRef(eres));
223 std::vector<Ptr<Vector<Real>>> vecList = {s,u,v};
224 Ptr<PartitionedVector<Real>> xp = makePtr<PartitionedVector<Real>>(vecList);
225 Ptr<PartitionedVector<Real>> gxp = makePtr<PartitionedVector<Real>>({gs,gu,gv});
226 Ptr<Vector<Real>> lb = u->clone(); lb->zero();
227 std::vector<Ptr<BoundConstraint<Real>>> bndList(3);
228 bndList[0] = makePtr<BoundConstraint<Real>>(); bndList[0]->deactivate();
229 bndList[1] = makePtr<Bounds<Real>>(*lb,
true);
230 bndList[2] = makePtr<Bounds<Real>>(*lb,
true);
231 Ptr<BoundConstraint<Real>> xbnd
232 = makePtr<BoundConstraint_Partitioned<Real>>(bndList,vecList);
233 ParameterList ppa_list;
234 if (c->dimension() == 1)
235 ppa_list.sublist(
"General").sublist(
"Polyhedral Projection").set(
"Type",
"Dai-Fletcher");
237 ppa_list.sublist(
"General").sublist(
"Polyhedral Projection").set(
"Type",
"Semismooth Newton");
241 elc.
finalize(
false,verbosity_>2,outStream);
242 Ptr<Vector<Real>> b2 = eres.
clone(), xpwa = xp->clone(), mul = emul.
clone();
246 Ptr<TypeB::Algorithm<Real>> algo;
249 if (verbosity_ > 0) writeOutput(outStream,
true);
251 while (status_->check(*state_)) {
252 lcon->setAnchor(state_->iterateVec);
253 if (verbosity_ > 3) elc.
check(
true,outStream);
256 list_.sublist(
"Status Test").set(
"Gradient Tolerance",optTolerance_);
257 list_.sublist(
"Status Test").set(
"Step Tolerance",1.e-6*optTolerance_);
258 algo = TypeB::AlgorithmFactory<Real>(list_);
259 algo->run(elc,outStream);
263 subproblemIter_ = algo->getState()->iter;
269 state_->stepVec->set(x);
270 state_->stepVec->axpy(-one,*state_->iterateVec);
271 state_->snorm = state_->stepVec->norm();
276 cnorm = cvec->norm();
277 if ( cscale_*cnorm < feasTolerance_ ) {
279 state_->iterateVec->set(x);
281 state_->constraintVec->set(*cvec);
282 state_->cnorm = cnorm;
286 emul.
axpy(state_->searchSize*cscale_,state_->constraintVec->dual());
289 if (scaleLagrangian_) state_->gradientVec->scale(state_->searchSize);
291 state_->gradientVec->axpy(-cscale_,*gs);
292 state_->gnorm = state_->gradientVec->norm();
296 sigma_ = std::min(one+lnorm,sigmaMax_)/(one+state_->searchSize);
298 optTolerance_ = std::max(oem2*outerOptTolerance_,
299 optTolerance_/(one + std::pow(state_->searchSize,optIncreaseExponent_)));
301 feasTolerance_ = std::max(oem2*outerFeasTolerance_,
302 feasTolerance_/(one + std::pow(state_->searchSize,feasIncreaseExponent_)));
305 state_->snorm += lnorm + state_->searchSize*cscale_*state_->cnorm;
306 state_->lagmultVec->set(emul);
310 state_->searchSize = std::min(penaltyUpdate_*state_->searchSize,maxPenaltyParam_);
311 sigma_ /= sigmaUpdate_;
312 optTolerance_ = std::max(oem2*outerOptTolerance_,
313 optToleranceInitial_/(one + std::pow(state_->searchSize,optDecreaseExponent_)));
314 feasTolerance_ = std::max(oem2*outerFeasTolerance_,
315 feasToleranceInitial_/(one + std::pow(state_->searchSize,feasDecreaseExponent_)));
317 alobj.
reset(emul,state_->searchSize,sigma_);
320 if (verbosity_ > 0) writeOutput(outStream,printHeader_);
327 std::stringstream hist;
329 hist << std::string(114,
'-') << std::endl;
330 hist <<
"Stabilized LCL status output definitions" << std::endl << std::endl;
331 hist <<
" iter - Number of iterates (steps taken)" << std::endl;
332 hist <<
" fval - Objective function value" << std::endl;
333 hist <<
" cnorm - Norm of the constraint violation" << std::endl;
334 hist <<
" gLnorm - Norm of the gradient of the Lagrangian" << std::endl;
335 hist <<
" snorm - Norm of the step" << std::endl;
336 hist <<
" penalty - Penalty parameter" << std::endl;
337 hist <<
" sigma - Elastic Penalty parameter" << std::endl;
338 hist <<
" feasTol - Feasibility tolerance" << std::endl;
339 hist <<
" optTol - Optimality tolerance" << std::endl;
340 hist <<
" #fval - Number of times the objective was computed" << std::endl;
341 hist <<
" #grad - Number of times the gradient was computed" << std::endl;
342 hist <<
" #cval - Number of times the constraint was computed" << std::endl;
343 hist <<
" subIter - Number of iterations to solve subproblem" << std::endl;
344 hist << std::string(114,
'-') << std::endl;
347 hist << std::setw(6) << std::left <<
"iter";
348 hist << std::setw(15) << std::left <<
"fval";
349 hist << std::setw(15) << std::left <<
"cnorm";
350 hist << std::setw(15) << std::left <<
"gLnorm";
351 hist << std::setw(15) << std::left <<
"snorm";
352 hist << std::setw(10) << std::left <<
"penalty";
353 hist << std::setw(10) << std::left <<
"sigma";
354 hist << std::setw(10) << std::left <<
"feasTol";
355 hist << std::setw(10) << std::left <<
"optTol";
356 hist << std::setw(8) << std::left <<
"#fval";
357 hist << std::setw(8) << std::left <<
"#grad";
358 hist << std::setw(8) << std::left <<
"#cval";
359 hist << std::setw(8) << std::left <<
"subIter";
375 std::stringstream hist;
376 hist << std::scientific << std::setprecision(6);
377 if ( state_->iter == 0 ) writeName(os);
378 if ( print_header ) writeHeader(os);
379 if ( state_->iter == 0 ) {
381 hist << std::setw(6) << std::left << state_->iter;
382 hist << std::setw(15) << std::left << state_->value;
383 hist << std::setw(15) << std::left << state_->cnorm;
384 hist << std::setw(15) << std::left << state_->gnorm;
385 hist << std::setw(15) << std::left <<
"---";
386 hist << std::scientific << std::setprecision(2);
387 hist << std::setw(10) << std::left << state_->searchSize;
388 hist << std::setw(10) << std::left << sigma_;
389 hist << std::setw(10) << std::left << std::max(feasTolerance_,outerFeasTolerance_);
390 hist << std::setw(10) << std::left << std::max(optTolerance_,outerOptTolerance_);
391 hist << std::scientific << std::setprecision(6);
392 hist << std::setw(8) << std::left << state_->nfval;
393 hist << std::setw(8) << std::left << state_->ngrad;
394 hist << std::setw(8) << std::left << state_->ncval;
395 hist << std::setw(8) << std::left <<
"---";
400 hist << std::setw(6) << std::left << state_->iter;
401 hist << std::setw(15) << std::left << state_->value;
402 hist << std::setw(15) << std::left << state_->cnorm;
403 hist << std::setw(15) << std::left << state_->gnorm;
404 hist << std::setw(15) << std::left << state_->snorm;
405 hist << std::scientific << std::setprecision(2);
406 hist << std::setw(10) << std::left << state_->searchSize;
407 hist << std::setw(10) << std::left << sigma_;
408 hist << std::setw(10) << std::left << feasTolerance_;
409 hist << std::setw(10) << std::left << optTolerance_;
410 hist << std::scientific << std::setprecision(6);
411 hist << std::setw(8) << std::left << state_->nfval;
412 hist << std::setw(8) << std::left << state_->ngrad;
413 hist << std::setw(8) << std::left << state_->ncval;
414 hist << std::setw(8) << std::left << subproblemIter_;