59 namespace MoochoPack {
62 const direct_line_search_ptr_t& direct_line_search
64 :direct_line_search_(direct_line_search)
77 NLP &nlp = algo.nlp();
100 IterQuantityAccess<value_type>
101 &alpha_iq = s.alpha();
102 IterQuantityAccess<VectorMutable>
107 VectorMutable &x_kp1 = x_iq.get_k(+1);
108 const Vector &x_k = x_iq.get_k(0);
109 VectorMutable &c_kp1 = c_iq.get_k(+1);
110 const Vector &c_k = c_iq.get_k(0);
111 const Vector &d_k = d_iq.get_k(0);
126 out <<
"\nBegin definition of NLP merit function phi_c.value(c(x)):\n";
128 out <<
"end definition of the NLP merit funciton\n";
133 Dphi_k = phi_c.
deriv();
134 if( (
int)olevel >= (
int)PRINT_ALGORITHM_STEPS ) {
135 out <<
"\nDphi_k = " << Dphi_k << std::endl;
139 ,
"LineSearchNLE_Step::do_step(...) : "
140 "Error, d_k is not a descent direction for the merit function "
141 "since Dphi_k = " << Dphi_k <<
" >= 0" );
146 nlp.unset_quantities();
149 const Vector* xd[2] = { &x_k, &d_k };
150 MeritFuncCalc1DQuadratic phi_calc_1d( phi_c_calc, 1, xd, &x_kp1 );
152 if( !direct_line_search().do_line_search(
153 phi_calc_1d, phi_k, &alpha_k, &phi_kp1
154 ,( static_cast<int>(olevel) >= static_cast<int>(PRINT_ALGORITHM_STEPS)
155 ? &out : static_cast<std::ostream*>(0) )
162 <<
"\nThe maximum number of linesearch iterations has been exceeded "
163 <<
"(k = " << algo.
state().
k() <<
")\n"
164 <<
"(phi_k - phi_kp1)/phi_k = " << ((phi_k - phi_kp1)/phi_k)
165 <<
"\nso we will reject the step and declare a line search failure.\n";
168 ,
"LineSearchNLE_Step::do_step(): Line search failure" );
171 nlp.unset_quantities();
173 if( (
int)olevel >= (
int)PRINT_ALGORITHM_STEPS ) {
174 out <<
"\nalpha_k = " << alpha_k;
175 out <<
"\n||x_kp1||inf = " << x_kp1.norm_inf();
176 out <<
"\n||c_kp1||inf = " << c_kp1.norm_inf();
177 out <<
"\nphi_kp1 = " << phi_kp1;
182 out <<
"\nx_kp1 =\n" << x_kp1;
183 out <<
"\nc_kp1 =\n" << c_kp1;
191 ,std::ostream&
out,
const std::string& L
195 << L <<
"*** Preform a line search for c(x_k + alpha_k*d_k) along the full space search direction d_k.\n"
196 << L <<
"ToDo: Fill this in!\n";
AbstractLinAlgPack::size_type size_type
value_type calc_deriv(const Vector &c_k)
void print_merit_func(std::ostream &out, const std::string &leading_str) const
bool do_step(Algorithm &algo, poss_type step_poss, IterationPack::EDoStepType type, poss_type assoc_step_poss)
value_type value(const Vector &c) const
LineSearchNLE_Step(const direct_line_search_ptr_t &direct_line_search=Teuchos::null)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
void Vp_StV(VectorMutable *v_lhs, const value_type &alpha, const Vector &v_rhs)
v_lhs = alpha * v_rhs + v_lhs
rSQP Algorithm control class.
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
virtual std::ostream & journal_out() const
Return a reference to a std::ostream to be used to output debug information and the like...
Thrown if a line search failure occurs.
EJournalOutputLevel
enum for journal output.
void V_VpV(VectorMutable *v_lhs, const V1 &V1_rhs1, const V2 &V2_rhs2)
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.
AlgorithmTracker & track()
A merit function for the square of the constriant values.
Adds the ability to compute phi(c(x)) at x directly instead of having to compute c first...
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.