45 #include "MoochoPack_LineSearchFailureNewDecompositionSelection_Step.hpp" 46 #include "MoochoPack_MoochoAlgorithmStepNames.hpp" 47 #include "MoochoPack_moocho_algo_conversion.hpp" 48 #include "MoochoPack_Exceptions.hpp" 49 #include "IterationPack_print_algorithm_step.hpp" 53 LineSearchFailureNewDecompositionSelection_Step::LineSearchFailureNewDecompositionSelection_Step(
54 const line_search_step_ptr_t &line_search_step
55 ,
const new_decomp_strategy_ptr_t &new_decomp_strategy
57 :line_search_step_(line_search_step)
58 ,new_decomp_strategy_(new_decomp_strategy)
59 ,last_ls_failure_k_(-100)
67 return line_search_step().do_step(_algo,step_poss,type,assoc_step_poss);
70 NLPAlgo &algo = rsqp_algo(_algo);
73 EJournalOutputLevel olevel = algo.algo_cntr().journal_output_level();
76 if( static_cast<int>(olevel) >= static_cast<int>(PRINT_BASIC_ALGORITHM_INFO) ) {
77 out <<
"\nLine search failed " 78 <<
" (k = " << algo.
state().
k() <<
")\n" 79 <<
"LineSearchFailure description: " << lsf_excpt.what() <<
"\n";
82 if( last_ls_failure_k_ == s.
k() - 1 ) {
83 if( static_cast<int>(olevel) >=
static_cast<int>(PRINT_BASIC_ALGORITHM_INFO) ) {
84 out <<
"\nThe line search failed again even with a new decomposition!" 85 <<
" (k = " << algo.
state().
k() <<
")\n" 91 if( static_cast<int>(olevel) >= static_cast<int>(PRINT_BASIC_ALGORITHM_INFO) ) {
92 out <<
"\nSelecting a new decomposition..." 93 <<
" (k = " << algo.
state().
k() <<
")\n";
96 last_ls_failure_k_ = s.
k();
97 return new_decomp_strategy().new_decomposition(algo,step_poss,type,assoc_step_poss);
105 ,std::ostream& out,
const std::string& L
109 << L <<
"do line search step : " << typeName(line_search_step()) << std::endl;
110 line_search_step().print_step(algo,step_poss,type,assoc_step_poss,out,L+
" ");
112 << L <<
"end line search step\n" 113 << L <<
"if thrown line_search_failure then\n" 114 << L <<
" if line search failed at the last iteration also then\n" 115 << L <<
" throw line_search_failure\n" 117 << L <<
" new decomposition selection : " << typeName(new_decomp_strategy()) << std::endl
119 new_decomp_strategy().print_new_decomposition(
120 rsqp_algo(algo),step_poss,type,assoc_step_poss,out, L +
" " );
122 << L <<
" end new decomposition selection\n" 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
rSQP Algorithm control class.
virtual std::ostream & journal_out() const
Thrown if a line search failure occurs.
Reduced space SQP state encapsulation interface.
AlgorithmTracker & track()
bool do_step(Algorithm &algo, poss_type step_poss, IterationPack::EDoStepType type, poss_type assoc_step_poss)
NLPAlgoState & rsqp_state()
<<std aggr>="">> members for algo_cntr