61 namespace LinAlgOpPack {
66 namespace MoochoPack {
104 if( algo.nlp().num_bounded_x() )
106 true, std::logic_error
107 ,
"TangentialStepWithoutBounds_Step::do_step(...): Error, "
108 "can't solve for pz for NLP with undecomposed constraints or "
109 "has bounds on the variables");
114 VectorMutable &qp_grad_k = s.qp_grad().set_k(0) = s.rGf().get_k(0);
116 IterQuantityAccess<value_type> &zeta_iq = s.zeta();
117 IterQuantityAccess<VectorMutable> &w_iq = s.w();
118 if( w_iq.updated_k(0) && zeta_iq.updated_k(0) ) {
120 Vp_StV( &qp_grad_k, zeta_iq.get_k(0), w_iq.get_k(0) );
124 VectorMutable &pz_k = s.pz().set_k(0);
125 const MatrixSymOpNonsing &rHL_k =
dyn_cast<MatrixSymOpNonsing>(s.rHL().get_k(0));
130 s.nu().set_k(0) = 0.0;
134 pz_norm_inf = pz_k.norm_inf();
135 out <<
"\n||pz_k||inf = " << pz_norm_inf << endl;
137 if( static_cast<int>(ns_olevel) >= static_cast<int>(
PRINT_VECTORS) )
138 out <<
"\npz_k = \n" << pz_k << std::endl;
141 const bool dampen_pz = max_pz_norm() >= 0.0 && s.
k() <= num_pz_damp_iters();
144 <<
"\nChecking if we need to dampen pz:"
145 <<
" ( (max_pz_norm="<<max_pz_norm()<<
") >= 0.0 )"
146 <<
" && ( (k="<<s.
k()<<
") <= (num_pz_damp_iters="<<num_pz_damp_iters()<<
") ) : "
147 << ( dampen_pz ?
"true, dampen pz ..." :
"false, no dampen pz!" )
153 if (pz_norm_inf < 0.0 )
154 pz_norm_inf = pz_k.norm_inf();
155 const value_type pz_damp_factor = ( max_pz_norm() / pz_norm_inf );
158 <<
"\npz_damp_factor = max_pz_norm / ||pz||inf = "
159 << max_pz_norm() <<
" / " << pz_norm_inf <<
" = "
162 Vt_S( &pz_k, pz_damp_factor );
169 out <<
"\n||pz_k||inf = " << s.pz().get_k(0).norm_inf()
170 <<
"\n||Zpz_k||2 = " << s.Zpz().get_k(0).norm_2() << std::endl;
173 if( static_cast<int>(ns_olevel) >= static_cast<int>(
PRINT_VECTORS) ) {
174 out <<
"\npz_k = \n" << s.pz().get_k(0);
178 if( static_cast<int>(olevel) >= static_cast<int>(
PRINT_VECTORS) ) {
179 out <<
"\nnu_k = \n" << s.nu().get_k(0);
180 out <<
"\nZpz_k = \n" << s.Zpz().get_k(0);
184 if(algo.algo_cntr().check_results()) {
195 , std::ostream&
out,
const std::string& L )
const
198 << L <<
"*** Calculate the null space step by solving an unconstrainted QP\n"
199 << L <<
"qp_grad_k = rGf_k + zeta_k * w_k\n"
201 << L <<
" min qp_grad_k' * pz_k + 1/2 * pz_k' * rHL_k * pz_k\n"
202 << L <<
" pz_k <: R^(n-r)\n"
203 << L <<
"Zpz_k = Z_k * pz_k\n"
204 << L <<
"nu_k = 0\n";
void Vt_S(VectorMutable *v_lhs, const value_type &alpha)
v_lhs *= alpha
#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 V_StV(VectorMutable *v_lhs, value_type alpha, const V &V_rhs)
v_lhs = alpha * V_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
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.
T_To & dyn_cast(T_From &from)
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.
void V_InvMtV(VectorMutable *v_lhs, const MatrixNonsing &M_rhs1, BLAS_Cpp::Transp trans_rhs1, const Vector &v_rhs2)
v_lhs = inv(op(M_rhs1)) * v_rhs2
AlgorithmTracker & track()
void Vp_StMtV(VectorMutable *v_lhs, value_type alpha, const MatrixOp &M_rhs1, BLAS_Cpp::Transp trans_rhs1, const Vector &v_rhs2, value_type beta=1.0)
v_lhs = alpha * op(M_rhs1) * v_rhs2 + beta * v_lhs (BLAS xGEMV)
bool assert_print_nan_inf(const value_type &val, const char name[], bool throw_excpt, std::ostream *out)
This function asserts if a value_type scalare is a NaN or Inf and optionally prints out these entires...
TangentialStepWithoutBounds_Step()
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
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.