42 #include "MoochoPack_NewDecompositionSelectionStd_Strategy.hpp"
43 #include "MoochoPack_MoochoAlgorithmStepNames.hpp"
44 #include "MoochoPack_NLPAlgo.hpp"
45 #include "MoochoPack_NLPAlgoState.hpp"
47 namespace MoochoPack {
49 NewDecompositionSelectionStd_Strategy::NewDecompositionSelectionStd_Strategy(
50 const decomp_sys_handler_ptr_t &decomp_sys_handler
52 :decomp_sys_handler_(decomp_sys_handler)
61 EJournalOutputLevel olevel = algo.algo_cntr().journal_output_level();
65 if( !get_decomp_sys_handler().
get() ) {
66 if( static_cast<int>(olevel) >= static_cast<int>(PRINT_BASIC_ALGORITHM_INFO) ) {
67 out <<
"\nWe are asked to select a new basis but there is no\n"
68 "decomposition system set so we have no choice but to terminiate\n"
70 <<
" (k = " << algo.
state().
k() <<
")\n";
78 if( s.
k() >= algo.algo_cntr().
max_iter() ) {
79 if( static_cast<int>(olevel) >=
static_cast<int>(PRINT_BASIC_ALGORITHM_INFO) ) {
80 out <<
"\nThe maximum number of rSQP iterations\n"
81 <<
" have been exceeded so quit "
82 <<
" (k = " << algo.
state().
k() <<
")\n";
89 decomp_sys_handler().select_new_decomposition(
true);
90 if( (
int)olevel >= (
int)PRINT_ALGORITHM_STEPS ) {
91 out <<
"x_kp1 = x_k\n"
93 <<
"goto EvalNewPoint\n";
95 s.x().set_k(1) = s.x().get_k(0);
96 s.alpha().set_k(0) = 0.0;
106 ,std::ostream& out,
const std::string& L
110 << L <<
"if k > max_iter then\n"
111 << L <<
" terminate the algorithm\n"
113 << L <<
"Select a new basis at current point\n"
114 << L <<
"x_kp1 = x_k\n"
115 << L <<
"alpha_k = 0\n"
117 << L <<
"goto EvalNewPoint\n";
virtual void max_iter(size_t max_iter)
bool new_decomposition(NLPAlgo &algo, Algorithm::poss_type step_poss, IterationPack::EDoStepType type, Algorithm::poss_type assoc_step_poss)
rSQP Algorithm control class.
virtual void terminate(bool success)
virtual std::ostream & journal_out() const
void print_new_decomposition(const NLPAlgo &algo, Algorithm::poss_type step_poss, IterationPack::EDoStepType type, Algorithm::poss_type assoc_step_poss, std::ostream &out, const std::string &leading_str) const
Reduced space SQP state encapsulation interface.
virtual void do_step_next(const std::string &step_name)
AlgorithmTracker & track()
virtual void output_iteration(const Algorithm &algo) const
NLPAlgoState & rsqp_state()
<<std aggr>="">> members for algo_cntr
virtual void next_iteration(bool incr_k=true)