44 #ifndef ROL_TYPEE_COMPOSITESTEPALGORITHM_DEF_H 45 #define ROL_TYPEE_COMPOSITESTEPALGORITHM_DEF_H 50 template<
typename Real>
61 Real one(1), two(2), p8(0.8),
zero(0), oem8(1.e-8);
62 ParameterList& cslist =
list_.sublist(
"Step").sublist(
"Composite Step");
65 tolOSS_ = cslist.sublist(
"Optimality System Solver").get(
"Nominal Relative Tolerance", 1e-8);
66 tolOSSfixed_ = cslist.sublist(
"Optimality System Solver").get(
"Fix Tolerance",
true);
67 maxiterCG_ = cslist.sublist(
"Tangential Subproblem Solver").get(
"Iteration Limit", 20);
68 tolCG_ = cslist.sublist(
"Tangential Subproblem Solver").get(
"Relative Tolerance", 1e-2);
69 Delta_ = cslist.get(
"Initial Radius", 1e2);
70 useConHess_ = cslist.get(
"Use Constraint Hessian",
true);
115 template<
typename Real>
122 Real zerotol = std::sqrt(ROL_EPSILON<Real>());
124 ROL::Ptr<Vector<Real> > n = xvec_->clone();
125 ROL::Ptr<Vector<Real> > c = cvec_->clone();
126 ROL::Ptr<Vector<Real> > t = xvec_->clone();
127 ROL::Ptr<Vector<Real> > tCP = xvec_->clone();
128 ROL::Ptr<Vector<Real> > g = gvec_->clone();
129 ROL::Ptr<Vector<Real> > gf = gvec_->clone();
130 ROL::Ptr<Vector<Real> > Wg = xvec_->clone();
131 ROL::Ptr<Vector<Real> > ajl = gvec_->clone();
134 ROL::Ptr<Vector<Real> > l_new = lvec_->clone();
135 ROL::Ptr<Vector<Real> > c_new = cvec_->clone();
136 ROL::Ptr<Vector<Real> > g_new = gvec_->clone();
137 ROL::Ptr<Vector<Real> > gf_new = gvec_->clone();
140 f = obj.
value(x, zerotol);
145 con.
value(*c, x, zerotol);
148 computeQuasinormalStep(*n, *c, x, zeta_*Delta_, con);
157 solveTangentialSubproblem(*t, *tCP, *Wg, x, *g, *n, l, Delta_, obj, con);
158 totalIterCG_ += iterCG_;
161 accept(s, *n, *t, f_new, *c_new, *gf_new, *l_new, *g_new, x, l, f, *gf, *c, *g, *tCP, *Wg, obj, con);
165 template<
typename Real>
172 Real zerotol = std::sqrt(ROL_EPSILON<Real>());
173 std::vector<Real> augiters;
176 std::stringstream hist;
177 hist <<
"\n Lagrange multiplier step\n";
178 std::cout << hist.str();
182 Ptr<Vector<Real> > ajl = gvec_->clone();
186 Ptr<Vector<Real> > b1 = gvec_->clone();
187 Ptr<Vector<Real> > b2 = cvec_->clone();
189 b1->set(gf); b1->plus(*ajl); b1->scale(-one);
194 Ptr<Vector<Real> > v1 = xvec_->clone();
195 Ptr<Vector<Real> > v2 = lvec_->clone();
198 Real b1norm = b1->norm();
199 Real tol = setTolOSS(lmhtol_*b1norm);
204 totalIterLS_ = totalIterLS_ + augiters.size();
205 printInfoLS(augiters);
214 template<
typename Real>
222 std::stringstream hist;
223 hist <<
"\n Quasi-normal step\n";
224 std::cout << hist.str();
229 Real zerotol = std::sqrt(ROL_EPSILON<Real>());
230 std::vector<Real> augiters;
233 Ptr<Vector<Real> > nCP = xvec_->clone();
234 Ptr<Vector<Real> > nCPdual = gvec_->clone();
235 Ptr<Vector<Real> > nN = xvec_->clone();
236 Ptr<Vector<Real> > ctemp = cvec_->clone();
237 Ptr<Vector<Real> > dualc0 = lvec_->clone();
238 dualc0->set(c.
dual());
240 nCP->set(nCPdual->dual());
243 Real normsquare_ctemp = ctemp->dot(*ctemp);
244 if (normsquare_ctemp !=
zero) {
245 nCP->scale( -(nCP->dot(*nCP))/normsquare_ctemp );
250 Real norm_nCP = nCP->norm();
251 if (norm_nCP >= delta) {
253 n.
scale( delta/norm_nCP );
255 std::stringstream hist;
256 hist <<
" taking partial Cauchy step\n";
257 std::cout << hist.str();
267 Real tol = setTolOSS(qntol_*ctemp->norm());
270 nCPdual->set(nCP->dual());
271 nCPdual->scale(-one);
273 Ptr<Vector<Real> > dn = xvec_->clone();
274 Ptr<Vector<Real> > y = lvec_->clone();
278 totalIterLS_ = totalIterLS_ + augiters.size();
279 printInfoLS(augiters);
286 Real norm_nN = nN->norm();
287 if (norm_nN <= delta) {
291 std::stringstream hist;
292 hist <<
" taking full Newton step\n";
293 std::cout << hist.str();
300 Real aa = dn->dot(*dn);
301 Real bb = dn->dot(*nCP);
302 Real cc = norm_nCP*norm_nCP - delta*delta;
303 Real tau = (-bb+sqrt(bb*bb-aa*cc))/aa;
307 std::stringstream hist;
308 hist <<
" taking dogleg step\n";
309 std::cout << hist.str();
316 template<
typename Real>
329 bool orthocheck =
true;
331 Real tol_ortho = 0.5;
338 Real zerotol = std::sqrt(ROL_EPSILON<Real>());
339 std::vector<Real> augiters;
344 Ptr<Vector<Real> > r = gvec_->clone();
345 Ptr<Vector<Real> > pdesc = xvec_->clone();
346 Ptr<Vector<Real> > tprev = xvec_->clone();
347 Ptr<Vector<Real> > Wr = xvec_->clone();
348 Ptr<Vector<Real> > Hp = gvec_->clone();
349 Ptr<Vector<Real> > xtemp = xvec_->clone();
350 Ptr<Vector<Real> > gtemp = gvec_->clone();
351 Ptr<Vector<Real> > ltemp = lvec_->clone();
352 Ptr<Vector<Real> > czero = cvec_->clone();
355 obj.
hessVec(*gtemp, n, x, zerotol);
361 Real normg = r->norm();
369 std::vector<Real> normWr(maxiterCG_+1,
zero);
371 std::vector<Ptr<Vector<Real > > > p;
372 std::vector<Ptr<Vector<Real > > > Hps;
373 std::vector<Ptr<Vector<Real > > > rs;
374 std::vector<Ptr<Vector<Real > > > Wrs;
379 std::stringstream hist;
380 hist <<
"\n Tangential subproblem\n";
381 hist << std::setw(6) << std::right <<
"iter" << std::setw(18) <<
"||Wr||/||Wr0||" << std::setw(15) <<
"||s||";
382 hist << std::setw(15) <<
"delta" << std::setw(15) <<
"||c'(x)s||" <<
"\n";
383 std::cout << hist.str();
388 std::stringstream hist;
389 hist <<
" >>> Tangential subproblem: Initial gradient is zero! \n";
390 std::cout << hist.str();
392 iterCG_ = 0; Wg.
zero(); flagCG_ = 0;
397 while (iterCG_ < maxiterCG_) {
407 Real tol = setTolOSS(pgtol_);
410 totalIterLS_ = totalIterLS_ + augiters.size();
411 printInfoLS(augiters);
416 Wrs.push_back(xvec_->clone());
417 (Wrs[iterCG_-1])->
set(*Wr);
420 if (normWg ==
zero) {
424 std::stringstream hist;
425 hist <<
" Initial projected residual is close to zero! \n";
426 std::cout << hist.str();
434 rs.push_back(xvec_->clone());
436 (rs[0])->
set(r->dual());
441 Real tol = setTolOSS(projtol_);
444 totalIterLS_ = totalIterLS_ + augiters.size();
445 printInfoLS(augiters);
448 Wrs.push_back(xvec_->clone());
449 (Wrs[iterCG_-1])->
set(*Wr);
453 normWr[iterCG_-1] = Wr->norm();
456 Ptr<Vector<Real> > ct = cvec_->clone();
458 Real linc = ct->norm();
459 std::stringstream hist;
460 hist << std::scientific << std::setprecision(6);
461 hist << std::setw(6) << std::right << iterCG_-1 << std::setw(18) << normWr[iterCG_-1]/normWg << std::setw(15) << t.
norm();
462 hist << std::setw(15) << delta << std::setw(15) << linc <<
"\n";
463 std::cout << hist.str();
467 if (normWr[iterCG_-1]/normWg < tolCG_) {
471 std::stringstream hist;
472 hist <<
" || W(g + H*(n+s)) || <= cgtol*|| W(g + H*n)|| \n";
473 std::cout << hist.str();
480 LA::Matrix<Real> Wrr(iterCG_,iterCG_);
481 LA::Matrix<Real> T(iterCG_,iterCG_);
482 LA::Matrix<Real> Tm1(iterCG_,iterCG_);
483 for (
int i=0; i<iterCG_; i++) {
484 for (
int j=0; j<iterCG_; j++) {
485 Wrr(i,j) = (Wrs[i])->dot(*rs[j]);
486 T(i,j) = Wrr(i,j)/(normWr[i]*normWr[j]);
489 Tm1(i,j) = Tm1(i,j) - one;
493 if (Tm1.normOne() >= tol_ortho) {
494 LAPACK<int,Real> lapack;
495 std::vector<int> ipiv(iterCG_);
497 std::vector<Real> work(3*iterCG_);
499 lapack.GETRF(iterCG_, iterCG_, T.values(), T.stride(), &ipiv[0], &info);
500 lapack.GETRI(iterCG_, T.values(), T.stride(), &ipiv[0], &work[0], 3*iterCG_, &info);
502 for (
int i=0; i<iterCG_; i++) {
503 Tm1(i,i) = Tm1(i,i) - one;
505 if (Tm1.normOne() > S_max) {
508 std::stringstream hist;
509 hist <<
" large nonorthogonality in W(R)'*R detected \n";
510 std::cout << hist.str();
518 p.push_back(xvec_->clone());
519 (p[iterCG_-1])->
set(*Wr);
520 (p[iterCG_-1])->scale(-one);
521 for (
int j=1; j<iterCG_; j++) {
522 Real scal = (p[iterCG_-1])->dot(*(Hps[j-1])) / (p[j-1])->dot(*(Hps[j-1]));
523 Ptr<Vector<Real> > pj = xvec_->clone();
526 (p[iterCG_-1])->plus(*pj);
530 Hps.push_back(xvec_->clone());
532 obj.
hessVec(*Hp, *(p[iterCG_-1]), x, zerotol);
539 (Hps[iterCG_-1])->
set(Hp->dual());
541 pHp = (p[iterCG_-1])->dot(*(Hps[iterCG_-1]));
543 rp = (p[iterCG_-1])->dot(*(rs[iterCG_-1]));
545 normp = (p[iterCG_-1])->norm();
550 pdesc->set(*(p[iterCG_-1]));
551 if ((std::abs(rp) >= rptol*normp*normr) && (sgn(rp) == 1)) {
555 Real a = pdesc->dot(*pdesc);
556 Real b = pdesc->dot(t);
557 Real c = t.
dot(t) - delta*delta;
559 Real theta = (-b + std::sqrt(b*b - a*c)) / a;
560 xtemp->set(*(p[iterCG_-1]));
568 std::stringstream hist;
569 hist <<
" negative curvature detected \n";
570 std::cout << hist.str();
576 if (std::abs(rp) < rptol*normp*normr) {
579 std::stringstream hist;
580 hist <<
" Zero alpha due to inexactness. \n";
581 std::cout << hist.str();
590 xtemp->set(*(p[iterCG_-1]));
596 if (normt >= delta) {
597 pdesc->set(*(p[iterCG_-1]));
601 Real a = pdesc->dot(*pdesc);
602 Real b = pdesc->dot(*tprev);
603 Real c = tprev->dot(*tprev) - delta*delta;
605 Real theta = (-b + std::sqrt(b*b - a*c)) / a;
606 xtemp->set(*(p[iterCG_-1]));
616 std::stringstream hist;
617 hist <<
" trust-region condition active \n";
618 std::cout << hist.str();
624 xtemp->set(*(Hps[iterCG_-1]));
627 r->plus(xtemp->dual());
630 rs.push_back(xvec_->clone());
632 (rs[iterCG_])->
set(r->dual());
641 std::stringstream hist;
642 hist <<
" maximum number of iterations reached \n";
643 std::cout << hist.str();
649 template<
typename Real>
657 Real tol_red_tang = 1e-3;
658 Real tol_red_all = 1e-1;
661 Real tol_fdiff = 1e-12;
666 Real rpred_over_pred = 0.5*(1-eta_);
669 std::stringstream hist;
670 hist <<
"\n Composite step acceptance\n";
671 std::cout << hist.str();
678 Real zerotol = std::sqrt(ROL_EPSILON<Real>());
679 std::vector<Real> augiters;
684 Real part_pred =
zero;
685 Real linc_preproj =
zero;
686 Real linc_postproj =
zero;
687 Real tangtol_start =
zero;
688 Real tangtol = tangtol_;
692 bool try_tCP =
false;
695 Ptr<Vector<Real> > xtrial = xvec_->clone();
696 Ptr<Vector<Real> > Jl = gvec_->clone();
697 Ptr<Vector<Real> > gfJl = gvec_->clone();
698 Ptr<Vector<Real> > Jnc = cvec_->clone();
699 Ptr<Vector<Real> > t_orig = xvec_->clone();
700 Ptr<Vector<Real> > t_dual = gvec_->clone();
701 Ptr<Vector<Real> > Jt_orig = cvec_->clone();
702 Ptr<Vector<Real> > t_m_tCP = xvec_->clone();
703 Ptr<Vector<Real> > ltemp = lvec_->clone();
704 Ptr<Vector<Real> > xtemp = xvec_->clone();
705 Ptr<Vector<Real> > rt = cvec_->clone();
706 Ptr<Vector<Real> > Hn = gvec_->clone();
707 Ptr<Vector<Real> > Hto = gvec_->clone();
708 Ptr<Vector<Real> > cxxvec = gvec_->clone();
709 Ptr<Vector<Real> > czero = cvec_->clone();
711 Real Jnc_normsquared =
zero;
712 Real c_normsquared =
zero;
719 Jnc_normsquared = Jnc->dot(*Jnc);
720 c_normsquared = c.
dot(c);
722 for (
int ct=0; ct<ct_max; ct++) {
726 t_m_tCP->scale(-one);
728 if (t_m_tCP->norm() ==
zero) {
734 linc_preproj = Jt_orig->norm();
736 rpred = two*rpred_over_pred*pred;
739 tangtol_start = tangtol;
741 while (std::abs(rpred)/pred > rpred_over_pred) {
744 tangtol = tol_red_tang*tangtol;
746 if (tangtol < mintol) {
748 std::stringstream hist;
749 hist <<
"\n The projection of the tangential step cannot be done with sufficient precision.\n";
750 hist <<
" Is the quasi-normal step very small? Continuing with no global convergence guarantees.\n";
751 std::cout << hist.str();
757 Real tol = setTolOSS(tangtol);
759 t_dual->set(t_orig->dual());
762 totalIterLS_ = totalIterLS_ + augiters.size();
763 printInfoLS(augiters);
766 linc_postproj = rt->norm();
773 obj.
hessVec(*Hn, n, x, zerotol);
778 obj.
hessVec(*Hto, *t_orig, x, zerotol);
789 f_new = obj.
value(*xtrial, zerotol);
790 obj.
gradient(gf_new, *xtrial, zerotol);
791 con.
value(c_new, *xtrial, zerotol);
793 computeLagrangeMultiplier(l_new, *xtrial, gf_new, con);
796 part_pred = - Wg.
dot(*t_orig);
801 part_pred -= n.
apply(*gfJl);
804 part_pred -= half*n.
apply(*Hn);
807 part_pred -= half*t_orig->apply(*Hto);
809 ltemp->axpy(-one, l);
812 part_pred -= Jnc->apply(*ltemp);
814 if ( part_pred < -half*penalty_*(c_normsquared-Jnc_normsquared) ) {
815 penalty_ = ( -two * part_pred / (c_normsquared-Jnc_normsquared) ) + beta;
818 pred = part_pred + penalty_*(c_normsquared-Jnc_normsquared);
823 rpred = - rt->apply(*ltemp) - penalty_ * rt->dot(*rt) - two * penalty_ * rt->dot(*Jnc);
831 tangtol = tangtol_start;
837 if ( t_orig->norm()/xtemp->norm() < tntmax_ ) {
841 t_m_tCP->set(*t_orig);
842 t_m_tCP->scale(-one);
844 if ((t_m_tCP->norm() > 0) && try_tCP) {
846 std::stringstream hist;
847 hist <<
" ---> now trying tangential Cauchy point\n";
848 std::cout << hist.str();
854 std::stringstream hist;
855 hist <<
" ---> recomputing quasi-normal step and re-solving tangential subproblem\n";
856 std::cout << hist.str();
875 lmhtol_ *= tol_red_all;
876 qntol_ *= tol_red_all;
877 pgtol_ *= tol_red_all;
878 projtol_ *= tol_red_all;
879 tangtol_ *= tol_red_all;
882 computeQuasinormalStep(n, c, x, zeta_*Delta_, con);
884 solveTangentialSubproblem(t, tCP, Wg, x, g, n, l, Delta_, obj, con);
885 totalIterCG_ += iterCG_;
900 if (std::abs(fdiff / (f+em24)) < tol_fdiff) {
906 ared = fdiff + (c.
apply(l) - c_new.
apply(l_new)) + penalty_*(c.
dot(c) - c_new.
dot(c_new));
919 std::stringstream hist;
920 hist <<
"\n Trial step info ...\n";
921 hist <<
" n_norm = " << nnorm_ <<
"\n";
922 hist <<
" t_norm = " << tnorm_ <<
"\n";
923 hist <<
" s_norm = " << snorm_ <<
"\n";
924 hist <<
" xtrial_norm = " << xtrial->norm() <<
"\n";
925 hist <<
" f_old = " << f <<
"\n";
926 hist <<
" f_trial = " << f_new <<
"\n";
927 hist <<
" f_old-f_trial = " << f-f_new <<
"\n";
928 hist <<
" ||c_old|| = " << c.
norm() <<
"\n";
929 hist <<
" ||c_trial|| = " << c_new.
norm() <<
"\n";
930 hist <<
" ||Jac*t_preproj|| = " << linc_preproj <<
"\n";
931 hist <<
" ||Jac*t_postproj|| = " << linc_postproj <<
"\n";
932 hist <<
" ||t_tilde||/||t|| = " << t_orig->norm() / t.
norm() <<
"\n";
933 hist <<
" ||t_tilde||/||n+t|| = " << t_orig->norm() / snorm_ <<
"\n";
934 hist <<
" # projections = " << num_proj <<
"\n";
935 hist <<
" penalty param = " << penalty_ <<
"\n";
936 hist <<
" ared = " << ared_ <<
"\n";
937 hist <<
" pred = " << pred_ <<
"\n";
938 hist <<
" ared/pred = " << ared_/pred_ <<
"\n";
939 std::cout << hist.str();
944 template<
typename Real>
958 Real zerotol = std::sqrt(ROL_EPSILON<Real>());
961 Ptr<Vector<Real> > g = gvec_->clone();
962 Ptr<Vector<Real> > ajl = gvec_->clone();
963 Ptr<Vector<Real> > gl = gvec_->clone();
964 Ptr<Vector<Real> > c = cvec_->clone();
969 if ((std::abs(ared_) < em12) && std::abs(pred_) < em12) {
975 Delta_ = std::max(seven*snorm_, Delta_);
977 else if (ratio >= zp8) {
978 Delta_ = std::max(two*snorm_, Delta_);
985 Delta_ = half*std::max(nnorm_, tnorm_);
991 Real val = obj.
value(x, zerotol);
994 computeLagrangeMultiplier(l, x, *g, con);
996 gl->set(*g); gl->plus(*ajl);
998 con.
value(*c, x, zerotol);
1000 state_->gradientVec->set(*gl);
1001 state_->constraintVec->set(*c);
1003 state_->value = val;
1004 state_->gnorm = gl->norm();
1005 state_->cnorm = c->norm();
1007 state_->snorm = snorm_;
1014 template<
typename Real>
1021 std::ostream &outStream ) {
1022 Real zerotol = std::sqrt(ROL_EPSILON<Real>());
1035 Ptr<Vector<Real> > ajl = gvec_->clone();
1036 Ptr<Vector<Real> > gl = gvec_->clone();
1040 state_->value = obj.
value(x, zerotol);
1043 con.
value(*cvec_, x, zerotol);
1044 state_->cnorm = cvec_->norm();
1049 computeLagrangeMultiplier(l, x, *gvec_, con);
1051 gl->set(*gvec_); gl->plus(*ajl);
1053 state_->gnorm = gl->norm();
1057 template<
typename Real>
1064 std::ostream &outStream ) {
1066 initialize(x,g,emul,eres,obj,econ,outStream);
1069 if (verbosity_ > 0) writeOutput(outStream,
true);
1072 Ptr<Vector<Real> > s = x.
clone();
1074 while (status_->check(*state_)) {
1075 computeTrial(*s, x, emul, obj, econ);
1076 updateRadius(x, emul, *s, obj, econ);
1079 if (verbosity_ > 0) writeOutput(outStream,printHeader_);
1086 template<
typename Real>
1088 std::stringstream hist;
1090 hist << std::string(144,
'-') << std::endl;
1091 hist <<
"Composite Step status output definitions" << std::endl << std::endl;
1092 hist <<
" iter - Number of iterates (steps taken)" << std::endl;
1093 hist <<
" fval - Objective function value" << std::endl;
1094 hist <<
" cnorm - Norm of the constraint violation" << std::endl;
1095 hist <<
" gLnorm - Norm of the gradient of the Lagrangian" << std::endl;
1096 hist <<
" snorm - Norm of the step" << std::endl;
1097 hist <<
" delta - Trust-region radius" << std::endl;
1098 hist <<
" nnorm - Norm of the quasinormal step" << std::endl;
1099 hist <<
" tnorm - Norm of the tangential step" << std::endl;
1100 hist <<
" #fval - Number of times the objective was computed" << std::endl;
1101 hist <<
" #grad - Number of times the gradient was computed" << std::endl;
1102 hist <<
" iterCG - Number of projected CG iterations" << std::endl;
1103 hist <<
" flagCG - Flag returned by projected CG" << std::endl;
1104 hist <<
" accept - Acceptance flag for the trial step" << std::endl;
1105 hist <<
" linsys - Number of augmented solver calls/iterations" << std::endl;
1106 hist << std::string(144,
'-') << std::endl;
1109 hist << std::setw(6) << std::left <<
"iter";
1110 hist << std::setw(15) << std::left <<
"fval";
1111 hist << std::setw(15) << std::left <<
"cnorm";
1112 hist << std::setw(15) << std::left <<
"gLnorm";
1113 hist << std::setw(15) << std::left <<
"snorm";
1114 hist << std::setw(10) << std::left <<
"delta";
1115 hist << std::setw(10) << std::left <<
"nnorm";
1116 hist << std::setw(10) << std::left <<
"tnorm";
1117 hist << std::setw(8) << std::left <<
"#fval";
1118 hist << std::setw(8) << std::left <<
"#grad";
1119 hist << std::setw(8) << std::left <<
"iterCG";
1120 hist << std::setw(8) << std::left <<
"flagCG";
1121 hist << std::setw(8) << std::left <<
"accept";
1122 hist << std::setw(8) << std::left <<
"linsys";
1128 template<
typename Real>
1130 std::stringstream hist;
1131 hist << std::endl <<
"Composite-Step Trust-Region Solver (Type E, Equality Constraints)";
1137 template<
typename Real>
1139 std::stringstream hist;
1140 hist << std::scientific << std::setprecision(6);
1141 if (state_->iter == 0) writeName(os);
1142 if (print_header) writeHeader(os);
1143 if (state_->iter == 0 ) {
1145 hist << std::setw(6) << std::left << state_->iter;
1146 hist << std::setw(15) << std::left << state_->value;
1147 hist << std::setw(15) << std::left << state_->cnorm;
1148 hist << std::setw(15) << std::left << state_->gnorm;
1149 hist << std::setw(15) << std::left <<
"---";
1150 hist << std::setw(10) << std::left <<
"---";
1151 hist << std::setw(10) << std::left <<
"---";
1152 hist << std::setw(10) << std::left <<
"---";
1153 hist << std::setw(8) << std::left <<
"---";
1154 hist << std::setw(8) << std::left <<
"---";
1155 hist << std::setw(8) << std::left <<
"---";
1156 hist << std::setw(8) << std::left <<
"---";
1157 hist << std::setw(8) << std::left <<
"---";
1158 hist << std::setw(8) << std::left <<
"---";
1163 hist << std::setw(6) << std::left << state_->iter;
1164 hist << std::setw(15) << std::left << state_->value;
1165 hist << std::setw(15) << std::left << state_->cnorm;
1166 hist << std::setw(15) << std::left << state_->gnorm;
1167 hist << std::setw(15) << std::left << state_->snorm;
1168 hist << std::scientific << std::setprecision(2);
1169 hist << std::setw(10) << std::left << Delta_;
1170 hist << std::setw(10) << std::left << nnorm_;
1171 hist << std::setw(10) << std::left << tnorm_;
1172 hist << std::scientific << std::setprecision(6);
1173 hist << std::setw(8) << std::left << state_->nfval;
1174 hist << std::setw(8) << std::left << state_->ngrad;
1175 hist << std::setw(8) << std::left << iterCG_;
1176 hist << std::setw(8) << std::left << flagCG_;
1177 hist << std::setw(8) << std::left << flagAC_;
1178 hist << std::left << totalCallLS_ <<
"/" << totalIterLS_;
1185 template<
typename Real>
1186 template<
typename T>
1188 return (T(0) < val) - (val < T(0));
1192 template<
typename Real>
1195 std::stringstream hist;
1196 hist << std::scientific << std::setprecision(8);
1197 hist << std::endl <<
" Augmented System Solver:" << std::endl;
1198 hist <<
" True Residual" << std::endl;
1199 for (
unsigned j=0; j<res.size(); j++) {
1200 hist <<
" " << std::left << std::setw(14) << res[j] << std::endl;
1203 std::cout << hist.str();
1208 template<
typename Real>
1210 return tolOSSfixed_ ? tolOSS_ : intol;
Provides the interface to evaluate objective functions.
void accept(Vector< Real > &s, Vector< Real > &n, Vector< Real > &t, Real f_new, Vector< Real > &c_new, Vector< Real > &gf_new, Vector< Real > &l_new, Vector< Real > &g_new, const Vector< Real > &x, const Vector< Real > &l, Real f, const Vector< Real > &gf, const Vector< Real > &c, const Vector< Real > &g, Vector< Real > &tCP, Vector< Real > &Wg, Objective< Real > &obj, Constraint< Real > &con)
Check acceptance of subproblem solutions, adjust merit function penalty parameter, ensure global convergence.
virtual void applyJacobian(Vector< Real > &jv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply the constraint Jacobian at , , to vector .
virtual void scale(const Real alpha)=0
Compute where .
virtual ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
virtual Real apply(const Vector< Real > &x) const
Apply to a dual vector. This is equivalent to the call .
virtual void plus(const Vector &x)=0
Compute , where .
virtual void update(const Vector< Real > &x, UpdateType type, int iter=-1)
Update constraint function.
virtual void axpy(const Real alpha, const Vector &x)
Compute where .
CompositeStepAlgorithm(ParameterList &list)
virtual Real value(const Vector< Real > &x, Real &tol)=0
Compute value.
virtual void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply Hessian approximation to vector.
virtual void writeExitStatus(std::ostream &os) const
virtual void writeHeader(std::ostream &os) const override
Print iterate header.
void computeTrial(Vector< Real > &s, const Vector< Real > &x, const Vector< Real > &l, Objective< Real > &obj, Constraint< Real > &con)
Compute trial step.
virtual void zero()
Set to zero vector.
Defines the linear algebra or vector space interface.
virtual void value(Vector< Real > &c, const Vector< Real > &x, Real &tol)=0
Evaluate the constraint operator at .
virtual void update(const Vector< Real > &x, UpdateType type, int iter=-1)
Update objective function.
virtual Real dot(const Vector &x) const =0
Compute where .
Objective_SerialSimOpt(const Ptr< Obj > &obj, const V &ui) z0_ zero()
void solveTangentialSubproblem(Vector< Real > &t, Vector< Real > &tCP, Vector< Real > &Wg, const Vector< Real > &x, const Vector< Real > &g, const Vector< Real > &n, const Vector< Real > &l, Real delta, Objective< Real > &obj, Constraint< Real > &con)
Solve tangential subproblem.
Provides an interface to check status of optimization algorithms for problems with equality constrain...
void computeLagrangeMultiplier(Vector< Real > &l, const Vector< Real > &x, const Vector< Real > &gf, Constraint< Real > &con)
Compute Lagrange multipliers by solving the least-squares problem minimizing the gradient of the Lagr...
void updateRadius(Vector< Real > &x, Vector< Real > &l, const Vector< Real > &s, Objective< Real > &obj, Constraint< Real > &con)
Update trust-region radius, take step, etc.
void computeQuasinormalStep(Vector< Real > &n, const Vector< Real > &c, const Vector< Real > &x, Real delta, Constraint< Real > &con)
Compute quasi-normal step by minimizing the norm of the linearized constraint.
virtual void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol)
Compute gradient.
virtual const Vector & dual() const
Return dual representation of , for example, the result of applying a Riesz map, or change of basis...
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...
virtual void applyAdjointHessian(Vector< Real > &ahuv, const Vector< Real > &u, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply the derivative of the adjoint of the constraint Jacobian at to vector in direction ...
const Ptr< CombinedStatusTest< Real > > status_
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 writeName(std::ostream &os) const override
Print step name.
void initialize(Vector< Real > &x, const Vector< Real > &g, Vector< Real > &l, const Vector< Real > &c, Objective< Real > &obj, Constraint< Real > &con, std::ostream &outStream=std::cout)
Initialize algorithm by computing a few quantities.
virtual std::vector< Real > solveAugmentedSystem(Vector< Real > &v1, Vector< Real > &v2, const Vector< Real > &b1, const Vector< Real > &b2, const Vector< Real > &x, Real &tol)
Approximately solves the augmented system where , , , , is an identity or Riesz operator...
void initialize(const Vector< Real > &x, const Vector< Real > &g, const Vector< Real > &mul, const Vector< Real > &c)
virtual void set(const Vector &x)
Set where .
virtual Real norm() const =0
Returns where .
void printInfoLS(const std::vector< Real > &res) const
virtual void writeOutput(std::ostream &os, const bool print_header=false) const override
Print iterate status.
Real setTolOSS(const Real intol) const
Defines the general constraint operator interface.