46 #include "MoochoPack_CalcLambdaIndepStd_AddedStep.hpp"
47 #include "MoochoPack_moocho_algo_conversion.hpp"
48 #include "IterationPack_print_algorithm_step.hpp"
49 #include "ConstrainedOptPack_ComputeMinMult.hpp"
50 #include "ConstrainedOptPack/src/VectorWithNorms.h"
51 #include "AbstractLinAlgPack_SpVectorOp.hpp"
52 #include "AbstractLinAlgPack/src/AbstractLinAlgPack_MatrixOp.hpp"
53 #include "DenseLinAlgPack_LinAlgOpPack.hpp"
54 #include "DenseLinAlgPack_DVectorOp.hpp"
55 #include "DenseLinAlgPack_DVectorOut.hpp"
57 namespace LinAlgOpPack {
63 , poss_type step_poss, IterationPack::EDoStepType type, poss_type assoc_step_poss)
70 using DenseLinAlgPack::norm_inf;
74 using ConstrainedOptPack::min_abs;
77 using LinAlgOpPack::V_StMtV;
78 using LinAlgOpPack::Vp_MtV;
80 NLPAlgo &algo = rsqp_algo(_algo);
81 NLPAlgoState &s = algo.rsqp_state();
82 Range1D decomp = s.equ_decomp();
84 EJournalOutputLevel olevel = algo.algo_cntr().journal_output_level();
85 std::ostream& out = algo.track().journal_out();
88 if( static_cast<int>(olevel) >= static_cast<int>(PRINT_ALGORITHM_STEPS) ) {
89 using IterationPack::print_algorithm_step;
90 print_algorithm_step( algo, step_poss, type, assoc_step_poss, out );
99 if( !s.lambda().updated_k(0) ) s.lambda().set_k(0).v().resize( algo.nlp().m() );
101 DVectorSlice lambda_decomp = s.lambda().get_k(0).v()(decomp);
104 if( algo.nlp().has_bounds() ) {
106 DVector _tmp = s.Gf().get_k(0)();
107 DVectorSlice _vs_tmp = _tmp;
108 Vp_V( &_vs_tmp, s.nu().get_k(0)() );
110 V_StMtV( &lambda_decomp, -1.0, s.Y().get_k(0),
trans, _vs_tmp );
114 V_StMtV( &lambda_decomp, -1.0, s.Y().get_k(0),
trans, s.Gf().get_k(0)() );
118 if( algo.nlp().r() < algo.nlp().m() ) {
119 Range1D undecomp = s.equ_undecomp();
120 Vp_StMtV( &lambda_decomp, -1.0, s.U().get_k(0),
trans, s.lambda().get_k(0).v()(undecomp) );
125 s.decomp_sys().solve_transAtY( lambda_decomp,
trans, &lambda_decomp );
127 if( static_cast<int>(olevel) >= static_cast<int>(PRINT_ALGORITHM_STEPS) ) {
128 out <<
"\nmax(|lambda_k(equ_decomp)(i)|) = " << norm_inf(lambda_decomp)
129 <<
"\nmin(|lambda_k(equ_decomp)(i)|) = " << min_abs(lambda_decomp) << std::endl;
132 if( static_cast<int>(olevel) >= static_cast<int>(PRINT_VECTORS) ) {
133 out <<
"\nlambda_k(equ_decomp) = \n" << lambda_decomp;
140 , poss_type step_poss, IterationPack::EDoStepType type, poss_type assoc_step_poss
141 , std::ostream& out,
const std::string& L )
const
144 << L <<
"*** Calculate the Lagrange multipliers for the decomposed constraints\n"
145 << L <<
"lambda_k(equ_decomp) = - inv(Gc_k(:,equ_decomp)'*Y_k)\n"
146 << L <<
" * (Y_k'*(Gf_k + nu_k) + U_k'*lambda_k(equ_undecomp))\n";
void Vt_S(VectorMutable *v_lhs, const value_type &alpha)
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
void Vp_StV(VectorMutable *v_lhs, const value_type &alpha, const Vector &v_rhs)
bool do_step(Algorithm &algo, poss_type step_poss, IterationPack::EDoStepType type, poss_type assoc_step_poss)
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)
void Vp_V(VectorMutable *v_lhs, const V &V_rhs)