44 #ifndef ROL_COMPOSITESTEP_H 45 #define ROL_COMPOSITESTEP_H 51 #include "Teuchos_SerialDenseMatrix.hpp" 52 #include "Teuchos_LAPACK.hpp" 67 Teuchos::RCP<Vector<Real> >
xvec_;
68 Teuchos::RCP<Vector<Real> >
gvec_;
69 Teuchos::RCP<Vector<Real> >
cvec_;
70 Teuchos::RCP<Vector<Real> >
lvec_;
120 template <
typename T>
int sgn(T val) {
121 return (T(0) < val) - (val < T(0));
126 std::stringstream hist;
127 hist << std::scientific << std::setprecision(8);
128 hist <<
"\n Augmented System Solver:\n";
129 hist <<
" True Residual\n";
130 for (
unsigned j=0; j<res.size(); j++) {
131 hist <<
" " << std::left << std::setw(14) << res[j] <<
"\n";
134 std::cout << hist.str();
139 return tolOSSfixed_ ? tolOSS_ : intol;
152 Teuchos::ParameterList& steplist = parlist.sublist(
"Step").sublist(
"Composite Step");
155 tolOSS_ = steplist.sublist(
"Optimality System Solver").get(
"Nominal Relative Tolerance", 1e-8);
156 tolOSSfixed_ = steplist.sublist(
"Optimality System Solver").get(
"Fix Tolerance",
true);
158 maxiterCG_ = steplist.sublist(
"Tangential Subproblem Solver").get(
"Iteration Limit", 20);
159 tolCG_ = steplist.sublist(
"Tangential Subproblem Solver").get(
"Relative Tolerance", 1e-2);
161 int outLvl = steplist.get(
"Output Level", 0);
209 state->descentVec = x.
clone();
210 state->gradientVec = g.
clone();
211 state->constraintVec = c.
clone();
218 Teuchos::RCP<Vector<Real> > ajl = gvec_->clone();
219 Teuchos::RCP<Vector<Real> > gl = gvec_->clone();
221 algo_state.
nfval = 0;
222 algo_state.
ncval = 0;
223 algo_state.
ngrad = 0;
232 con.
value(*cvec_, x, zerotol);
233 algo_state.
cnorm = cvec_->norm();
240 gl->set(*gvec_); gl->plus(*ajl);
242 algo_state.
gnorm = gl->norm();
253 Teuchos::RCP<Vector<Real> > n = xvec_->clone();
254 Teuchos::RCP<Vector<Real> > c = cvec_->clone();
255 Teuchos::RCP<Vector<Real> > t = xvec_->clone();
256 Teuchos::RCP<Vector<Real> > tCP = xvec_->clone();
257 Teuchos::RCP<Vector<Real> > g = gvec_->clone();
258 Teuchos::RCP<Vector<Real> > gf = gvec_->clone();
259 Teuchos::RCP<Vector<Real> > Wg = xvec_->clone();
260 Teuchos::RCP<Vector<Real> > ajl = gvec_->clone();
263 Teuchos::RCP<Vector<Real> > l_new = lvec_->clone();
264 Teuchos::RCP<Vector<Real> > c_new = cvec_->clone();
265 Teuchos::RCP<Vector<Real> > g_new = gvec_->clone();
266 Teuchos::RCP<Vector<Real> > gf_new = gvec_->clone();
269 f = obj.
value(x, zerotol);
274 con.
value(*c, x, zerotol);
290 accept(s, *n, *t, f_new, *c_new, *gf_new, *l_new, *g_new, x, l, f, *gf, *c, *g, *tCP, *Wg, obj, con, algo_state);
305 Teuchos::RCP<Vector<Real> > g = gvec_->clone();
306 Teuchos::RCP<Vector<Real> > ajl = gvec_->clone();
307 Teuchos::RCP<Vector<Real> > gl = gvec_->clone();
308 Teuchos::RCP<Vector<Real> > c = cvec_->clone();
313 if ((std::abs(ared_) < 1e-12) && std::abs(pred_) < 1e-12) {
319 Delta_ = std::max(7.0*snorm_, Delta_);
321 else if (ratio >= 0.8) {
322 Delta_ = std::max(2.0*snorm_, Delta_);
329 Delta_ = half*std::max(nnorm_, tnorm_);
335 Real val = obj.
value(x, zerotol);
340 gl->set(*g); gl->plus(*ajl);
342 con.
value(*c, x, zerotol);
345 state->gradientVec->set(*gl);
346 state->constraintVec->set(*c);
348 algo_state.
value = val;
349 algo_state.
gnorm = gl->norm();
350 algo_state.
cnorm = c->norm();
375 std::stringstream hist;
377 hist << std::setw(6) << std::left <<
"iter";
378 hist << std::setw(15) << std::left <<
"fval";
379 hist << std::setw(15) << std::left <<
"cnorm";
380 hist << std::setw(15) << std::left <<
"gLnorm";
381 hist << std::setw(15) << std::left <<
"snorm";
382 hist << std::setw(10) << std::left <<
"delta";
383 hist << std::setw(10) << std::left <<
"nnorm";
384 hist << std::setw(10) << std::left <<
"tnorm";
385 hist << std::setw(8) << std::left <<
"#fval";
386 hist << std::setw(8) << std::left <<
"#grad";
387 hist << std::setw(8) << std::left <<
"iterCG";
388 hist << std::setw(8) << std::left <<
"flagCG";
389 hist << std::setw(8) << std::left <<
"accept";
390 hist << std::setw(8) << std::left <<
"linsys";
396 std::stringstream hist;
397 hist <<
"\n" <<
" Composite-step trust-region solver";
407 std::stringstream hist;
408 hist << std::scientific << std::setprecision(6);
409 if ( algo_state.
iter == 0 ) {
415 if ( algo_state.
iter == 0 ) {
417 hist << std::setw(6) << std::left << algo_state.
iter;
418 hist << std::setw(15) << std::left << algo_state.
value;
419 hist << std::setw(15) << std::left << algo_state.
cnorm;
420 hist << std::setw(15) << std::left << algo_state.
gnorm;
425 hist << std::setw(6) << std::left << algo_state.
iter;
426 hist << std::setw(15) << std::left << algo_state.
value;
427 hist << std::setw(15) << std::left << algo_state.
cnorm;
428 hist << std::setw(15) << std::left << algo_state.
gnorm;
429 hist << std::setw(15) << std::left << algo_state.
snorm;
430 hist << std::scientific << std::setprecision(2);
431 hist << std::setw(10) << std::left <<
Delta_;
432 hist << std::setw(10) << std::left <<
nnorm_;
433 hist << std::setw(10) << std::left <<
tnorm_;
434 hist << std::scientific << std::setprecision(6);
435 hist << std::setw(8) << std::left << algo_state.
nfval;
436 hist << std::setw(8) << std::left << algo_state.
ngrad;
437 hist << std::setw(8) << std::left <<
iterCG_;
438 hist << std::setw(8) << std::left <<
flagCG_;
439 hist << std::setw(8) << std::left <<
flagAC_;
440 hist << std::left << totalCallLS_ <<
"/" <<
totalIterLS_;
460 std::vector<Real> augiters;
463 std::stringstream hist;
464 hist <<
"\n Lagrange multiplier step\n";
465 std::cout << hist.str();
469 Teuchos::RCP<Vector<Real> > ajl = gvec_->clone();
473 Teuchos::RCP<Vector<Real> > b1 = gvec_->clone();
474 Teuchos::RCP<Vector<Real> > b2 = cvec_->clone();
476 b1->set(gf); b1->plus(*ajl); b1->scale(-1.0);
481 Teuchos::RCP<Vector<Real> > v1 = xvec_->clone();
482 Teuchos::RCP<Vector<Real> > v2 = lvec_->clone();
485 Real b1norm = b1->norm();
491 totalIterLS_ = totalIterLS_ + augiters.size();
526 std::stringstream hist;
527 hist <<
"\n Quasi-normal step\n";
528 std::cout << hist.str();
534 std::vector<Real> augiters;
537 Teuchos::RCP<Vector<Real> > nCP = xvec_->clone();
538 Teuchos::RCP<Vector<Real> > nCPdual = gvec_->clone();
539 Teuchos::RCP<Vector<Real> > nN = xvec_->clone();
540 Teuchos::RCP<Vector<Real> > ctemp = cvec_->clone();
541 Teuchos::RCP<Vector<Real> > dualc0 = lvec_->clone();
542 dualc0->set(c.
dual());
544 nCP->set(nCPdual->dual());
547 Real normsquare_ctemp = ctemp->dot(*ctemp);
548 if (normsquare_ctemp != zero) {
549 nCP->scale( -(nCP->dot(*nCP))/normsquare_ctemp );
554 Real norm_nCP = nCP->norm();
555 if (norm_nCP >= delta) {
557 n.
scale( delta/norm_nCP );
559 std::stringstream hist;
560 hist <<
" taking partial Cauchy step\n";
561 std::cout << hist.str();
571 Real tol =
setTolOSS(qntol_*ctemp->norm());
574 nCPdual->set(nCP->dual());
575 nCPdual->scale(-one);
577 Teuchos::RCP<Vector<Real> > dn = xvec_->clone();
578 Teuchos::RCP<Vector<Real> > y = lvec_->clone();
582 totalIterLS_ = totalIterLS_ + augiters.size();
590 Real norm_nN = nN->norm();
591 if (norm_nN <= delta) {
595 std::stringstream hist;
596 hist <<
" taking full Newton step\n";
597 std::cout << hist.str();
604 Real aa = dn->dot(*dn);
605 Real bb = dn->dot(*nCP);
606 Real cc = norm_nCP*norm_nCP - delta*delta;
607 Real tau = (-bb+sqrt(bb*bb-aa*cc))/aa;
611 std::stringstream hist;
612 hist <<
" taking dogleg step\n";
613 std::cout << hist.str();
638 bool orthocheck =
true;
640 Real tol_ortho = 0.5;
648 std::vector<Real> augiters;
653 Teuchos::RCP<Vector<Real> > r = gvec_->clone();
654 Teuchos::RCP<Vector<Real> > pdesc = xvec_->clone();
655 Teuchos::RCP<Vector<Real> > tprev = xvec_->clone();
656 Teuchos::RCP<Vector<Real> > Wr = xvec_->clone();
657 Teuchos::RCP<Vector<Real> > Hp = gvec_->clone();
658 Teuchos::RCP<Vector<Real> > xtemp = xvec_->clone();
659 Teuchos::RCP<Vector<Real> > gtemp = gvec_->clone();
660 Teuchos::RCP<Vector<Real> > ltemp = lvec_->clone();
661 Teuchos::RCP<Vector<Real> > czero = cvec_->clone();
664 obj.
hessVec(*gtemp, n, x, zerotol);
668 Real normg = r->norm();
676 std::vector<Real> normWr(maxiterCG_+1, zero);
678 std::vector<Teuchos::RCP<Vector<Real > > > p;
679 std::vector<Teuchos::RCP<Vector<Real > > > Hps;
680 std::vector<Teuchos::RCP<Vector<Real > > > rs;
681 std::vector<Teuchos::RCP<Vector<Real > > > Wrs;
686 std::stringstream hist;
687 hist <<
"\n Tangential subproblem\n";
688 hist << std::setw(6) << std::right <<
"iter" << std::setw(18) <<
"||Wr||/||Wr0||" << std::setw(15) <<
"||s||";
689 hist << std::setw(15) <<
"delta" << std::setw(15) <<
"||c'(x)s||" <<
"\n";
690 std::cout << hist.str();
695 std::stringstream hist;
696 hist <<
" >>> Tangential subproblem: Initial gradient is zero! \n";
697 std::cout << hist.str();
699 iterCG_ = 0; Wg.
zero(); flagCG_ = 0;
704 while (iterCG_ < maxiterCG_) {
717 totalIterLS_ = totalIterLS_ + augiters.size();
723 Wrs.push_back(xvec_->clone());
724 (Wrs[iterCG_-1])->
set(*Wr);
727 if (normWg == zero) {
731 std::stringstream hist;
732 hist <<
" Initial projected residual is close to zero! \n";
733 std::cout << hist.str();
741 rs.push_back(xvec_->clone());
743 (rs[0])->
set(r->dual());
751 totalIterLS_ = totalIterLS_ + augiters.size();
755 Wrs.push_back(xvec_->clone());
756 (Wrs[iterCG_-1])->
set(*Wr);
760 normWr[iterCG_-1] = Wr->norm();
763 Teuchos::RCP<Vector<Real> > ct = cvec_->clone();
765 Real linc = ct->norm();
766 std::stringstream hist;
767 hist << std::scientific << std::setprecision(6);
768 hist << std::setw(6) << std::right << iterCG_-1 << std::setw(18) << normWr[iterCG_-1]/normWg << std::setw(15) << t.
norm();
769 hist << std::setw(15) << delta << std::setw(15) << linc <<
"\n";
770 std::cout << hist.str();
774 if (normWr[iterCG_-1]/normWg < tolCG_) {
778 std::stringstream hist;
779 hist <<
" || W(g + H*(n+s)) || <= cgtol*|| W(g + H*n)|| \n";
780 std::cout << hist.str();
787 Teuchos::SerialDenseMatrix<int,Real> Wrr(iterCG_,iterCG_);
788 Teuchos::SerialDenseMatrix<int,Real> T(iterCG_,iterCG_);
789 Teuchos::SerialDenseMatrix<int,Real> Tm1(iterCG_,iterCG_);
790 for (
int i=0; i<
iterCG_; i++) {
791 for (
int j=0; j<
iterCG_; j++) {
792 Wrr(i,j) = (Wrs[i])->dot(*rs[j]);
793 T(i,j) = Wrr(i,j)/(normWr[i]*normWr[j]);
796 Tm1(i,j) = Tm1(i,j) - 1.0;
800 if (Tm1.normOne() >= tol_ortho) {
801 Teuchos::LAPACK<int,Real> lapack;
802 std::vector<int> ipiv(iterCG_);
804 std::vector<Real> work(3*iterCG_);
806 lapack.GETRF(iterCG_, iterCG_, T.values(), T.stride(), &ipiv[0], &info);
807 lapack.GETRI(iterCG_, T.values(), T.stride(), &ipiv[0], &work[0], 3*
iterCG_, &info);
809 for (
int i=0; i<
iterCG_; i++) {
810 Tm1(i,i) = Tm1(i,i) - 1.0;
812 if (Tm1.normOne() > S_max) {
815 std::stringstream hist;
816 hist <<
" large nonorthogonality in W(R)'*R detected \n";
817 std::cout << hist.str();
825 p.push_back(xvec_->clone());
826 (p[iterCG_-1])->
set(*Wr);
827 (p[iterCG_-1])->scale(-one);
828 for (
int j=1; j<
iterCG_; j++) {
829 Real scal = (p[iterCG_-1])->dot(*(Hps[j-1])) / (p[j-1])->dot(*(Hps[j-1]));
830 Teuchos::RCP<Vector<Real> > pj = xvec_->clone();
833 (p[iterCG_-1])->plus(*pj);
837 Hps.push_back(xvec_->clone());
839 obj.
hessVec(*Hp, *(p[iterCG_-1]), x, zerotol);
844 (Hps[iterCG_-1])->
set(Hp->dual());
846 pHp = (p[iterCG_-1])->dot(*(Hps[iterCG_-1]));
848 rp = (p[iterCG_-1])->dot(*(rs[iterCG_-1]));
850 normp = (p[iterCG_-1])->norm();
855 pdesc->set(*(p[iterCG_-1]));
856 if ((std::abs(rp) >= rptol*normp*normr) && (
sgn(rp) == 1)) {
860 Real a = pdesc->dot(*pdesc);
861 Real b = pdesc->dot(t);
862 Real c = t.
dot(t) - delta*delta;
864 Real theta = (-b + std::sqrt(b*b - a*c)) / a;
865 xtemp->set(*(p[iterCG_-1]));
873 std::stringstream hist;
874 hist <<
" negative curvature detected \n";
875 std::cout << hist.str();
881 if (std::abs(rp) < rptol*normp*normr) {
884 std::stringstream hist;
885 hist <<
" Zero alpha due to inexactness. \n";
886 std::cout << hist.str();
895 xtemp->set(*(p[iterCG_-1]));
901 if (normt >= delta) {
902 pdesc->set(*(p[iterCG_-1]));
906 Real a = pdesc->dot(*pdesc);
907 Real b = pdesc->dot(*tprev);
908 Real c = tprev->dot(*tprev) - delta*delta;
910 Real theta = (-b + std::sqrt(b*b - a*c)) / a;
911 xtemp->set(*(p[iterCG_-1]));
921 std::stringstream hist;
922 hist <<
" trust-region condition active \n";
923 std::cout << hist.str();
929 xtemp->set(*(Hps[iterCG_-1]));
932 r->plus(xtemp->dual());
935 rs.push_back(xvec_->clone());
946 std::stringstream hist;
947 hist <<
" maximum number of iterations reached \n";
948 std::cout << hist.str();
963 Real tol_red_tang = 1e-3;
964 Real tol_red_all = 1e-1;
967 Real tol_fdiff = 1e-12;
972 Real rpred_over_pred = 0.5*(1-
eta_);
975 std::stringstream hist;
976 hist <<
"\n Composite step acceptance\n";
977 std::cout << hist.str();
985 std::vector<Real> augiters;
990 Real part_pred = zero;
991 Real linc_preproj = zero;
992 Real linc_postproj = zero;
993 Real tangtol_start = zero;
998 bool try_tCP =
false;
1001 Teuchos::RCP<Vector<Real> > xtrial = xvec_->clone();
1002 Teuchos::RCP<Vector<Real> > Jl = gvec_->clone();
1003 Teuchos::RCP<Vector<Real> > gfJl = gvec_->clone();
1004 Teuchos::RCP<Vector<Real> > Jnc = cvec_->clone();
1005 Teuchos::RCP<Vector<Real> > t_orig = xvec_->clone();
1006 Teuchos::RCP<Vector<Real> > t_dual = gvec_->clone();
1007 Teuchos::RCP<Vector<Real> > Jt_orig = cvec_->clone();
1008 Teuchos::RCP<Vector<Real> > t_m_tCP = xvec_->clone();
1009 Teuchos::RCP<Vector<Real> > ltemp = lvec_->clone();
1010 Teuchos::RCP<Vector<Real> > xtemp = xvec_->clone();
1011 Teuchos::RCP<Vector<Real> > rt = cvec_->clone();
1012 Teuchos::RCP<Vector<Real> > Hn = gvec_->clone();
1013 Teuchos::RCP<Vector<Real> > Hto = gvec_->clone();
1014 Teuchos::RCP<Vector<Real> > cxxvec = gvec_->clone();
1015 Teuchos::RCP<Vector<Real> > czero = cvec_->clone();
1017 Real Jnc_normsquared = zero;
1018 Real c_normsquared = zero;
1025 Jnc_normsquared = Jnc->dot(*Jnc);
1026 c_normsquared = c.
dot(c);
1028 for (
int ct=0; ct<ct_max; ct++) {
1032 t_m_tCP->scale(-one);
1034 if (t_m_tCP->norm() == zero) {
1040 linc_preproj = Jt_orig->norm();
1042 rpred = two*rpred_over_pred*pred;
1045 tangtol_start = tangtol;
1047 while (std::abs(rpred)/pred > rpred_over_pred) {
1050 tangtol = tol_red_tang*tangtol;
1052 if (tangtol < mintol) {
1054 std::stringstream hist;
1055 hist <<
"\n The projection of the tangential step cannot be done with sufficient precision.\n";
1056 hist <<
" Is the quasi-normal step very small? Continuing with no global convergence guarantees.\n";
1057 std::cout << hist.str();
1065 t_dual->set(t_orig->dual());
1068 totalIterLS_ = totalIterLS_ + augiters.size();
1072 linc_postproj = rt->norm();
1079 obj.
hessVec(*Hn, n, x, zerotol);
1082 obj.
hessVec(*Hto, *t_orig, x, zerotol);
1091 f_new = obj.
value(*xtrial, zerotol);
1092 obj.
gradient(gf_new, *xtrial, zerotol);
1093 con.
value(c_new, *xtrial, zerotol);
1098 part_pred = - Wg.
dot(*t_orig);
1102 part_pred -= n.
dot(gfJl->dual());
1104 part_pred -= half*n.
dot(Hn->dual());
1106 part_pred -= half*t_orig->dot(Hto->dual());
1108 ltemp->axpy(-one, l);
1110 part_pred -= Jnc->dot(ltemp->dual());
1112 if ( part_pred < -half*penalty_*(c_normsquared-Jnc_normsquared) ) {
1113 penalty_ = ( -two * part_pred / (c_normsquared-Jnc_normsquared) ) + beta;
1116 pred = part_pred + penalty_*(c_normsquared-Jnc_normsquared);
1120 rpred = - rt->dot(ltemp->dual()) - penalty_ * rt->dot(*rt) - two * penalty_ * rt->dot(*Jnc);
1128 tangtol = tangtol_start;
1134 if ( t_orig->norm()/xtemp->norm() <
tntmax_ ) {
1138 t_m_tCP->set(*t_orig);
1139 t_m_tCP->scale(-one);
1141 if ((t_m_tCP->norm() > 0) && try_tCP) {
1143 std::stringstream hist;
1144 hist <<
" ---> now trying tangential Cauchy point\n";
1145 std::cout << hist.str();
1151 std::stringstream hist;
1152 hist <<
" ---> recomputing quasi-normal step and re-solving tangential subproblem\n";
1153 std::cout << hist.str();
1171 if (!tolOSSfixed_) {
1172 lmhtol_ *= tol_red_all;
1173 qntol_ *= tol_red_all;
1174 pgtol_ *= tol_red_all;
1175 projtol_ *= tol_red_all;
1176 tangtol_ *= tol_red_all;
1195 if (std::abs(fdiff / (f+1e-24)) < tol_fdiff) {
1200 ared = fdiff + (c.
dot(l.
dual()) - c_new.
dot(l_new.
dual())) + penalty_*(c.
dot(c) - c_new.
dot(c_new));
1213 std::stringstream hist;
1214 hist <<
"\n Trial step info ...\n";
1215 hist <<
" n_norm = " << nnorm_ <<
"\n";
1216 hist <<
" t_norm = " << tnorm_ <<
"\n";
1217 hist <<
" s_norm = " << snorm_ <<
"\n";
1218 hist <<
" xtrial_norm = " << xtrial->norm() <<
"\n";
1219 hist <<
" f_old = " << f <<
"\n";
1220 hist <<
" f_trial = " << f_new <<
"\n";
1221 hist <<
" f_old-f_trial = " << f-f_new <<
"\n";
1222 hist <<
" ||c_old|| = " << c.
norm() <<
"\n";
1223 hist <<
" ||c_trial|| = " << c_new.
norm() <<
"\n";
1224 hist <<
" ||Jac*t_preproj|| = " << linc_preproj <<
"\n";
1225 hist <<
" ||Jac*t_postproj|| = " << linc_postproj <<
"\n";
1226 hist <<
" ||t_tilde||/||t|| = " << t_orig->norm() / t.
norm() <<
"\n";
1227 hist <<
" ||t_tilde||/||n+t|| = " << t_orig->norm() / snorm_ <<
"\n";
1228 hist <<
" # projections = " << num_proj <<
"\n";
1229 hist <<
" penalty param = " << penalty_ <<
"\n";
1230 hist <<
" ared = " << ared_ <<
"\n";
1231 hist <<
" pred = " << pred_ <<
"\n";
1232 hist <<
" ared/pred = " << ared_/pred_ <<
"\n";
1233 std::cout << hist.str();
Provides the interface to evaluate objective functions.
Teuchos::RCP< Vector< Real > > lvec_
virtual const Vector & dual() const
Return dual representation of , for example, the result of applying a Riesz map, or change of basis...
std::string printHeader(void) const
Print iterate header.
virtual void scale(const Real alpha)=0
Compute where .
Real setTolOSS(const Real intol) const
virtual void plus(const Vector &x)=0
Compute , where .
virtual void axpy(const Real alpha, const Vector &x)
Compute where .
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.
virtual Real value(const Vector< Real > &x, Real &tol)=0
Compute value.
Provides the interface to compute optimization steps.
virtual void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply Hessian approximation to vector.
Teuchos::RCP< StepState< Real > > getState(void)
Contains definitions of custom data types in ROL.
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 ...
virtual Teuchos::RCP< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
virtual void zero()
Set to zero vector.
Defines the linear algebra or vector space interface.
virtual Real dot(const Vector &x) const =0
Compute where .
std::string print(AlgorithmState< Real > &algo_state, bool pHeader=false) const
Print iterate status.
virtual void update(const Vector< Real > &x, bool flag=true, int iter=-1)
Update constraint functions. x is the optimization variable, flag = true if optimization variable is ...
State for algorithm class. Will be used for restarts.
virtual void gradient(Vector< Real > &g, const Vector< Real > &x, Real &tol)
Compute gradient.
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...
Defines the equality constraint operator interface.
Teuchos::RCP< Vector< Real > > cvec_
void computeQuasinormalStep(Vector< Real > &n, const Vector< Real > &c, const Vector< Real > &x, Real delta, EqualityConstraint< Real > &con)
Compute quasi-normal step by minimizing the norm of the linearized constraint.
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 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 .
void compute(Vector< Real > &s, const Vector< Real > &x, const Vector< Real > &l, Objective< Real > &obj, EqualityConstraint< Real > &con, AlgorithmState< Real > &algo_state)
Compute step.
Implements the computation of optimization steps with composite-step trust-region methods...
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, EqualityConstraint< Real > &con)
Solve tangential subproblem.
void computeLagrangeMultiplier(Vector< Real > &l, const Vector< Real > &x, const Vector< Real > &gf, EqualityConstraint< Real > &con)
Compute Lagrange multipliers by solving the least-squares problem minimizing the gradient of the Lagr...
Provides the interface to apply upper and lower bound constraints.
Teuchos::RCP< Vector< Real > > gvec_
CompositeStep(Teuchos::ParameterList &parlist)
virtual void applyJacobian(Vector< Real > &jv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply the constraint Jacobian at , , to vector .
Teuchos::RCP< Vector< Real > > xvec_
void initialize(Vector< Real > &x, const Vector< Real > &g, Vector< Real > &l, const Vector< Real > &c, Objective< Real > &obj, EqualityConstraint< Real > &con, AlgorithmState< Real > &algo_state)
Initialize step.
virtual void set(const Vector &x)
Set where .
void printInfoLS(const std::vector< Real > &res) const
virtual Real norm() const =0
Returns where .
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, bool flag=true, int iter=-1)
Update objective function.
void update(Vector< Real > &x, Vector< Real > &l, const Vector< Real > &s, Objective< Real > &obj, EqualityConstraint< Real > &con, AlgorithmState< Real > &algo_state)
Update step, if successful.
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, EqualityConstraint< Real > &con, AlgorithmState< Real > &algo_state)
Check acceptance of subproblem solutions, adjust merit function penalty parameter, ensure global convergence.
static const double ROL_EPSILON
Platform-dependent machine epsilon.
std::string printName(void) const
Print step name.