46 #include "AbstractLinAlgPack_MatrixSymDiagStd.hpp"
47 #include "AbstractLinAlgPack_VectorAuxiliaryOps.hpp"
48 #include "AbstractLinAlgPack_assert_print_nan_inf.hpp"
49 #include "AbstractLinAlgPack_VectorOut.hpp"
50 #include "AbstractLinAlgPack_LinAlgOpPack.hpp"
51 #include "IterationPack_print_algorithm_step.hpp"
52 #include "NLPInterfacePack_NLPFirstOrder.hpp"
53 #include "MoochoPack_IpState.hpp"
54 #include "MoochoPack_PostEvalNewPointBarrier_Step.hpp"
55 #include "MoochoPack_moocho_algo_conversion.hpp"
57 #include "OptionsFromStreamPack_StringToBool.hpp"
59 #include "Teuchos_dyn_cast.hpp"
61 namespace MoochoPack {
69 using IterationPack::print_algorithm_step;
77 NLP &nlp = algo.nlp();
79 EJournalOutputLevel olevel = algo.algo_cntr().journal_output_level();
82 if(!nlp.is_initialized())
83 nlp.initialize(algo.algo_cntr().check_results());
86 if( static_cast<int>(olevel) >=
static_cast<int>(PRINT_ALGORITHM_STEPS) )
88 using IterationPack::print_algorithm_step;
89 print_algorithm_step( _algo, step_poss, type, assoc_step_poss, out );
92 IterQuantityAccess<VectorMutable> &x_iq = s.x();
93 IterQuantityAccess<MatrixSymDiagStd> &Vl_iq = s.Vl();
94 IterQuantityAccess<MatrixSymDiagStd> &Vu_iq = s.Vu();
102 VectorMutable& x = x_iq.get_k(0);
103 MatrixSymDiagStd& invXu = s.invXu().set_k(0);
104 MatrixSymDiagStd& invXl = s.invXl().set_k(0);
119 using AbstractLinAlgPack::assert_print_nan_inf;
120 assert_print_nan_inf(invXu.diag(),
"invXu",
true, &out);
121 assert_print_nan_inf(invXl.diag(),
"invXl",
true, &out);
125 if ( Vu_iq.last_updated() == IterQuantity::NONE_UPDATED )
127 VectorMutable& vu = Vu_iq.set_k(0).diag();
129 Vp_StV(&vu, s.barrier_parameter().get_k(-1), invXu.diag());
131 if( static_cast<int>(olevel) >=
static_cast<int>(PRINT_ALGORITHM_STEPS) )
133 out <<
"\nInitialize Vu with barrier_parameter * invXu ...\n";
137 if ( Vl_iq.last_updated() == IterQuantity::NONE_UPDATED )
139 VectorMutable& vl = Vl_iq.set_k(0).diag();
141 Vp_StV(&vl, s.barrier_parameter().get_k(-1), invXl.diag());
143 if( static_cast<int>(olevel) >=
static_cast<int>(PRINT_ALGORITHM_STEPS) )
145 out <<
"\nInitialize Vl with barrier_parameter * invXl ...\n";
149 if (s.num_basis().updated_k(0))
152 if (Vu_iq.updated_k(-1))
153 { Vu_iq.set_k(0,-1); }
154 if (Vl_iq.updated_k(-1))
155 { Vl_iq.set_k(0,-1); }
157 VectorMutable& vu = Vu_iq.set_k(0).diag();
158 VectorMutable& vl = Vl_iq.set_k(0).diag();
163 if( (
int)olevel >= (
int)PRINT_VECTORS )
165 out <<
"\nx resorted vl and vu to the original order\n" << x;
171 if( (
int)olevel >= (
int)PRINT_VECTORS )
173 out <<
"\nx resorted to new basis \n" << x;
180 if( (
int)olevel >= (int)PRINT_VECTORS )
182 out <<
"x=\n" << s.x().get_k(0);
183 out <<
"xl=\n" << nlp.xl();
184 out <<
"vl=\n" << s.Vl().get_k(0).diag();
185 out <<
"xu=\n" << nlp.xu();
186 out <<
"vu=\n" << s.Vu().get_k(0).diag();
190 VectorMutable& v = s.nu().set_k(0);
191 v = Vu_iq.get_k(0).diag();
192 Vp_StV(&v,-1.0,Vl_iq.get_k(0).diag());
195 if( static_cast<int>(olevel) >=
static_cast<int>(PRINT_VECTORS) )
197 out <<
"invXu_k.diag()=\n" << invXu.diag();
198 out <<
"invXl_k.diag()=\n" << invXl.diag();
199 out <<
"Vu_k.diag()=\n" << Vu_iq.get_k(0).diag();
200 out <<
"Vl_k.diag()=\n" << Vl_iq.get_k(0).diag();
201 out <<
"nu_k=\n" << s.nu().get_k(0);
208 void PostEvalNewPointBarrier_Step::print_step(
209 const Algorithm& _algo, poss_type step_poss, IterationPack::EDoStepType type
210 ,poss_type assoc_step_poss, std::ostream& out,
const std::string& L
215 out << L <<
"# Evaluate information specific to primal / dual barrier algorithms (Post EvalNewPoint)\n"
216 << L <<
"invXl_k = diag(i, 1/(x(i)-xl))"
217 << L <<
"invXu_k = diag(i, 1/(xu-x(i)))\n"
218 << L <<
"if (Vu_k not updated) then\n"
219 << L <<
" Vu_k = mu_k*invXu_k\n"
221 << L <<
"if (Vl_k not updated) then\n"
222 << L <<
" Vl_k = mu_k*invXl_k\n"
224 << L <<
"nu_k_k = Vu_k.diag() - Vl_k.diag()\n";
void inv_of_difference(const value_type alpha, const Vector &v0, const Vector &v1, VectorMutable *z)
void Vp_StV(VectorMutable *v_lhs, const value_type &alpha, const Vector &v_rhs)
T_To & dyn_cast(T_From &from)
rSQP Algorithm control class.
virtual std::ostream & journal_out() const
bool do_step(Algorithm &algo, poss_type step_poss, IterationPack::EDoStepType type, poss_type assoc_step_poss)
AlgorithmTracker & track()
void correct_lower_bound_multipliers(const Vector &xl, const value_type inf_bound_limit, VectorMutable *vl)
void correct_upper_bound_multipliers(const Vector &xu, const value_type inf_bound_limit, VectorMutable *vu)