56 namespace MoochoPack {
59 const calc_fd_prod_ptr_t& calc_fd_prod
61 :calc_fd_prod_(calc_fd_prod)
75 NLP &nlp = algo.nlp();
76 const Range1D equ_decomp = s.equ_decomp();
88 nb = nlp.num_bounded_x();
91 IterQuantityAccess<VectorMutable>
94 const Vector::vec_ptr_t
95 cd_k = c_iq.get_k(0).sub_view(equ_decomp);
97 &Ypy_k = Ypy_iq.get_k(0);
102 out <<
"\nGc_k exists; compute descent_c = c_k(equ_decomp)'*Gc_k(:,equ_decomp)'*Ypy_k ...\n";
104 const MatrixOp::mat_ptr_t
105 Gcd_k = s.Gc().get_k(0).sub_view(
Range1D(),equ_decomp);
106 VectorSpace::vec_mut_ptr_t
107 t = cd_k->space().create_member();
109 if( static_cast<int>(olevel) >=
static_cast<int>(
PRINT_VECTORS) ) {
110 out <<
"\nGc_k(:,equ_decomp)'*Ypy_k =\n" << *t;
112 descent_c =
dot( *cd_k, *t );
116 out <<
"\nGc_k does not exist; compute descent_c = c_k(equ_decomp)'*FDGc_k(:,equ_decomp)'*Ypy_k "
117 <<
"using finite differences ...\n";
119 VectorSpace::vec_mut_ptr_t
120 t = nlp.space_c()->create_member();
121 calc_fd_prod().calc_deriv_product(
122 s.x().get_k(0),nb?&nlp.xl():NULL,nb?&nlp.xu():NULL
123 ,Ypy_k,NULL,&c_iq.get_k(0),
true,&nlp
127 if( static_cast<int>(olevel) >=
static_cast<int>(
PRINT_VECTORS) ) {
128 out <<
"\nFDGc_k(:,equ_decomp)'*Ypy_k =\n" << *t->sub_view(equ_decomp);
130 descent_c =
dot( *cd_k, *t->sub_view(equ_decomp) );
134 out <<
"\ndescent_c = " << descent_c << std::endl;
137 if( descent_c > 0.0 ) {
139 out <<
"\nError, descent_c > 0.0; this is not a descent direction\n"
140 <<
"Throw TestFailed and terminate the algorithm ...\n";
144 ,
"CheckDescentQuasiNormalStep_Step::do_step(...) : Error, descent for the decomposed constraints "
145 "with respect to the quasi-normal step c_k(equ_decomp)'*FDGc_k(:,equ_decomp)'*Ypy_k = "
146 << descent_c <<
" > 0.0; This is not a descent direction!\n" );
154 ,
poss_type assoc_step_poss, std::ostream&
out,
const std::string& L
158 << L <<
"*** Check for descent in the decomposed equality constraints for the quasi-normal step\n"
159 << L <<
"if Gc_k exists then\n"
160 << L <<
" descent_c = c_k(equ_decomp)'*Gc_k(:,equ_decomp)'*Ypy_k\n"
162 << L <<
" descent_c = c_k(equ_decomp)'*FDGc(:,equ_decomp)'*Ypy_k (finite diff.)\n"
164 << L <<
"if descent > 0.0 then\n"
165 << L <<
" throw TestFailed exception!\n"
AbstractLinAlgPack::size_type size_type
CheckDescentQuasiNormalStep_Step(const calc_fd_prod_ptr_t &calc_fd_prod)
Constructor.
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
Thrown if a runtime test failed.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
rSQP Algorithm control class.
const std::string Gc_name
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.
AlgorithmTracker & track()
virtual iq_id_type get_iter_quant_id(const std::string &iq_name) const
Return the iteration quantity id (iq_id) for the iteration quantity.
value_type dot(const Vector &v_rhs1, const Vector &v_rhs2)
result = v_rhs1' * v_rhs2
void V_MtV(VectorMutable *v_lhs, const MatrixOp &M_rhs1, BLAS_Cpp::Transp trans_rhs1, const V &V_rhs2)
v_lhs = op(M_rhs1) * V_rhs2.
AbstractLinAlgPack::value_type value_type
bool do_step(Algorithm &algo, poss_type step_poss, IterationPack::EDoStepType type, poss_type assoc_step_poss)
Acts as the central hub for an iterative algorithm.
NLPAlgoState & rsqp_state()
<<std aggr>="">> members for algo_cntr
RangePack::Range1D Range1D
NLPAlgo & rsqp_algo(Algorithm &algo)
Convert from a Algorithm to a NLPAlgo.