63 namespace MoochoPack {
98 const MatrixSymDiagStd &invXu = s.invXu().get_k(0);
99 const MatrixSymDiagStd &invXl = s.invXl().get_k(0);
100 const value_type &mu = s.barrier_parameter().get_k(0);
101 const MatrixOp &Z_k = s.Z().get_k(0);
105 Vp_StV( rhs.
get(), -1.0*mu, invXl.diag() );
109 out <<
"\n||Gf_k + mu_k*(invXu_k-invXl_k)||inf = " << rhs->norm_inf() << std::endl;
113 out <<
"\nGf_k + mu_k*(invXu_k-invXl_k) =\n" << *
rhs;
116 VectorMutable &qp_grad_k = s.qp_grad().set_k(0);
121 out <<
"\n||Z_k'*(Gf_k + mu_k*(invXu_k-invXl_k))||inf = " << qp_grad_k.norm_inf() << std::endl;
123 if( (
int)olevel >= (
int)PRINT_VECTORS )
125 out <<
"\nZ_k'*(Gf_k + mu_k*(invXu_k-invXl_k)) =\n" << qp_grad_k;
130 const Vector &w_sigma = s.w_sigma().get_k(0);
135 Vp_StV(&qp_grad_k, zeta, w_sigma);
137 if( (
int)olevel >= (
int)PRINT_ALGORITHM_STEPS )
139 out <<
"\n||qp_grad_k||inf = " << qp_grad_k.norm_inf() << std::endl;
141 if( (
int)olevel >= (
int)PRINT_VECTORS )
143 out <<
"\nqp_grad_k =\n" << qp_grad_k;
148 const MatrixSymOp &rHL_k = s.rHL().get_k(0);
149 const MatrixSymOp &rHB_k = s.rHB().get_k(0);
150 MatrixSymOpNonsing &B_k =
dyn_cast<MatrixSymOpNonsing>(s.B().set_k(0));
151 if (B_k.cols() != Z_k.cols())
154 dyn_cast<MatrixSymInitDiag>(B_k).init_identity(Z_k.space_rows(), 0.0);
159 if( (
int)olevel >= (
int)PRINT_VECTORS )
161 out <<
"\nB_k = rHL_k =\n" << B_k;
164 if( (
int)olevel >= (
int)PRINT_VECTORS )
166 out <<
"\nB_k = rHL_k + rHB_k =\n" << B_k;
170 VectorMutable &pz_k = s.pz().set_k(0);
177 if( (
int)olevel >= (int)PRINT_ALGORITHM_STEPS )
179 out <<
"\n||pz||inf = " << s.pz().get_k(0).norm_inf()
183 if( (
int)olevel >= (int)PRINT_VECTORS )
185 out <<
"\npz_k = \n" << s.pz().get_k(0);
186 out <<
"\nnu_k = \n" << s.nu().get_k(0);
187 out <<
"\nZpz_k = \n" << s.Zpz().get_k(0);
191 if(algo.algo_cntr().check_results())
202 , std::ostream&
out,
const std::string& L )
const
205 << L <<
"*** Calculate the null space step by solving an unconstrainted QP\n"
206 << L <<
"zeta_k = 1.0\n"
207 << L <<
"qp_grad_k = Z_k'*(Gf_k + mu_k*(invXu_k-invXl_k)) + zeta_k*w_sigma_k\n"
208 << L <<
"B_k = rHL_k + rHB_k\n"
209 << L <<
"pz_k = -inv(B_k)*qp_grad_k\n"
210 << L <<
"Zpz_k = Z_k*pz_k\n"
void Vt_S(VectorMutable *v_lhs, const value_type &alpha)
v_lhs *= alpha
void Vp_StV(VectorMutable *v_lhs, const value_type &alpha, const Vector &v_rhs)
v_lhs = alpha * v_rhs + v_lhs
void assign(VectorMutable *v_lhs, const V &V_rhs)
v_lhs = V_rhs.
rSQP Algorithm control class.
void V_StV(VectorMutable *v_lhs, value_type alpha, const V &V_rhs)
v_lhs = alpha * V_rhs.
void Mp_StM(DMatrixSlice *vs_lhs, value_type alpha, const MatrixOp &mwo_rhs1, BLAS_Cpp::Transp trans_rhs1)
m_lhs += alpha * op(mwo_rhs1).
bool do_step(Algorithm &algo, poss_type step_poss, IterationPack::EDoStepType type, poss_type assoc_step_poss)
void V_InvMtV(DVectorSlice *vs_lhs, const MatrixOpNonsing &mwo_rhs1, BLAS_Cpp::Transp trans_rhs1, const DVectorSlice &vs_rhs2)
vs_lhs = inv(op(mwo_rhs1)) * vs_rhs2.
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.
void M_StM(MatrixOp *M_lhs, value_type alpha, const MatrixOp &M_rhs, BLAS_Cpp::Transp trans_rhs)
gm_lhs = alpha * M_rhs.
T_To & dyn_cast(T_From &from)
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 Mp_StM(MatrixOp *mwo_lhs, value_type alpha, const MatrixOp &M_rhs, BLAS_Cpp::Transp trans_rhs)
void print_step(const IterationPack::Algorithm &algo, poss_type step_poss, IterationPack::EDoStepType type, poss_type assoc_step_poss, std::ostream &out, const std::string &leading_str) const
Called by Algorithm::print_algorithm() to print out what this step does in Matlab like format...
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...
const f_dbl_prec const f_int const f_int const f_int f_dbl_prec rhs[]
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.
value_type sum(const Vector &v_rhs)
result = sum( v_rhs(i), i = 1,,,dim )
NLPAlgo & rsqp_algo(Algorithm &algo)
Convert from a Algorithm to a NLPAlgo.