52 namespace MoochoPack {
57 :skip_bfgs_prop_const_(skip_bfgs_prop_const)
77 IterQuantityAccess<MatrixSymOp>
79 if( rHL.updated_k(-1) ) {
80 bool skip_update =
true;
81 if( !s.Ypy().updated_k(-1) || !s.Zpz().updated_k(-1)
82 || !s.rGL().updated_k(-1) || !s.c().updated_k(-1) )
86 <<
"\n*** Warning, rHL_km1 is updated but one or more of the quantities Ypy_km1, Zpz_km1\n"
87 ",rGL_km1 and c_km1 are not updated. Therefore, there is not sufficient information\n"
88 "to determine if to skip the BFGS update or not. Check storage requirements for\n"
89 " the above quantities\n"
90 "The BFGS wupdate will be skipped in this case ...\n";
100 nrm_rGL_km1 = s.rGL().get_k(-1).norm_2(),
101 nrm_c_km1 = s.c().get_k(-1).norm_2(),
102 nrm_Zpz_km1 = s.Zpz().get_k(-1).norm_2(),
103 nrm_Ypy_km1 = s.Ypy().get_k(-1).norm_2();
106 ratio = ( skip_bfgs_prop_const() /
::sqrt( nrm_rGL_km1 + nrm_c_km1 ) )
107 * ( nrm_Zpz_km1 / nrm_Ypy_km1 );
109 skip_update = ratio < 1.0;
113 <<
"ratio = (skip_bfgs_prop_const/sqrt(||rGL_km1||+||c_km1||))*(||Zpz_km1||/||Ypy_km1||)\n"
114 <<
" = (" << skip_bfgs_prop_const() <<
"/sqrt("<<nrm_rGL_km1<<
"+"<<nrm_c_km1<<
"))\n"
115 <<
" * ("<<nrm_Zpz_km1<<
"/"<<nrm_Ypy_km1<<
")\n"
116 <<
" = " << ratio << std::endl
117 <<
"ratio " << (skip_update ?
'<' :
'>' ) <<
" 1\n"
119 ?
"Skipping BFGS update ...\n"
120 :
"Perform BFGS update if you can ...\n" );
126 <<
"\nrHL_k = rHL_km1\n";
128 const MatrixSymOp &rHL_km1 = rHL.get_k(-1);
129 rHL.set_k(0) = rHL_km1;
133 out <<
"\nrHL_k =\n" << rHL.get_k(0);
143 , std::ostream&
out,
const std::string& L )
const
146 << L <<
"*** Check if we should do the BFGS update\n"
147 << L <<
"if rHL_km1 is update then\n"
148 << L <<
" If Ypy_km1, Zpz_km1, rGL_km1, or c_km1 is not updated then\n"
149 << L <<
" *** Warning, insufficient information to determine if we should\n"
150 << L <<
" *** perform the update. Check for sufficient backward storage.\n"
151 << L <<
" rHL_k = rHL_km1\n"
153 << L <<
" *** Check if we are in the proper region\n"
154 << L <<
" ratio = (skip_bfgs_prop_const/sqrt(norm(rGL_km1,2)+norm(c_km1,2)))\n"
155 << L <<
" * (norm(Zpz_km1,2)/norm(Ypy_km1,2) )\n"
156 << L <<
" if ratio < 1 then \n"
157 << L <<
" rHL_k = rHL_km1\n"
rSQP Algorithm control class.
bool do_step(Algorithm &algo, poss_type step_poss, IterationPack::EDoStepType type, poss_type assoc_step_poss)
virtual std::ostream & journal_out() const
Return a reference to a std::ostream to be used to output debug information and the like...
EJournalOutputLevel
enum for journal output.
Reduced space SQP state encapsulation interface.
void print_algorithm_step(const Algorithm &algo, Algorithm::poss_type step_poss, EDoStepType type, Algorithm::poss_type assoc_step_poss, std::ostream &out)
Prints to 'out' the algorithm step.
CheckSkipBFGSUpdateStd_Step(value_type skip_bfgs_prop_const=10.0)
AlgorithmTracker & track()
quasi_newton_stats_iq_member quasi_newton_stats_
void sqrt(DVectorSlice *vs_lhs, const DVectorSlice &vs_rhs)
vs_lhs = sqrt(vs_rhs)
void print_step(const Algorithm &algo, poss_type step_poss, IterationPack::EDoStepType type, poss_type assoc_step_poss, std::ostream &out, const std::string &leading_str) const
AbstractLinAlgPack::value_type value_type
Acts as the central hub for an iterative algorithm.
NLPAlgoState & rsqp_state()
<<std aggr>="">> members for algo_cntr
NLPAlgo & rsqp_algo(Algorithm &algo)
Convert from a Algorithm to a NLPAlgo.