56 T my_max(
const T& v1,
const T& v2 ) {
return v1 > v2 ? v1 : v2; }
59 namespace MoochoPack {
65 using std::setprecision;
70 :AlgorithmTracker(journal_out)
103 if( quasi_newt_stats ) {
117 const NLPObjGrad &nlp =
dyn_cast<
const NLPObjGrad>(algo.nlp());
118 const NLPFirstOrder *nlp_foi =
dynamic_cast<const NLPFirstOrder*
>(&nlp);
123 std::ostream&
o = this->
o();
139 if( quasi_newt_stats ) {
146 o <<
left << setw(stat_w) <<
"status" <<
"= "
147 <<
right << setw(val_w);
148 switch( algo_return ) {
162 o <<
"interrupted_solved";
165 o <<
"interrupted_not_solved";
170 o <<
"; # solved, except, max_iter, max_run_time\n";
172 o <<
left << setw(stat_w) <<
"niter" <<
"= "
173 <<
right << setw(val_w) << s.
k()
174 <<
"; # Number of rSQP iterations (plus 1?)\n";
176 o <<
left << setw(stat_w) <<
"nfunc" <<
"= "
177 <<
right << setw(val_w) << my_max(nlp.num_f_evals(),(m? nlp.num_c_evals():0) )
178 <<
"; # max( number f(x) evals, number c(x) evals )\n";
180 o <<
left << setw(stat_w) <<
"ngrad" <<
"= "
181 <<
right << setw(val_w) << my_max(nlp.num_Gf_evals(),(m?(nlp_foi?nlp_foi->num_Gc_evals():s.
k()+1):0))
182 <<
"; # max( number Gf(x) evals, number Gc(x) evals )\n";
184 o <<
left << setw(stat_w) <<
"CPU" <<
"= "
186 <<
"; # Number of CPU seconds total\n";
188 o <<
left << setw(stat_w) <<
"obj_func" <<
"= "
189 <<
right << setw(val_w);
190 if(s.f().updated_k(0))
194 o <<
"; # Objective function value f(x) at final point\n";
196 o <<
left << setw(stat_w) <<
"feas_kkt_err" <<
"= "
197 <<
right << setw(val_w);
198 if(s.feas_kkt_err().updated_k(0))
199 o << s.feas_kkt_err().get_k(0);
200 else if(s.c().updated_k(0))
201 o << s.c().get_k(0).norm_inf();
204 o <<
"; # Feasibility error at final point (scaled ||c(x)||inf, feas_err_k)\n";
206 o <<
left << setw(stat_w) <<
"opt_kkt_err" <<
"= "
207 <<
right << setw(val_w);
208 if(s.opt_kkt_err().updated_k(0))
209 o << s.opt_kkt_err().get_k(0);
210 else if(s.rGL().updated_k(0))
211 o << s.rGL().get_k(0).norm_inf();
212 else if(s.rGL().updated_k(-1))
213 o << s.rGL().get_k(-1).norm_inf();
216 o <<
"; # Optimality error at final point (scaled ||rGL||inf, opt_err_k)\n";
218 o <<
left << setw(stat_w) <<
"nact" <<
"= "
219 <<
right << setw(val_w);
220 if(s.nu().updated_k(0))
221 o << s.nu().get_k(0).nz();
222 else if(s.nu().updated_k(-1))
223 o << s.nu().get_k(-1).nz();
226 o <<
"; # Number of total active constraints at the final point\n";
228 const IterQuantityAccess<index_type> &num_basis = s.num_basis();
229 const int lu_k = num_basis.last_updated();
230 o <<
left << setw(stat_w) <<
"nbasis_change" <<
"= "
231 <<
right << setw(val_w) << ( lu_k != IterQuantity::NONE_UPDATED
232 ? num_basis.get_k(lu_k)
234 <<
"; # Number of basis changes\n";
236 o <<
left << setw(stat_w) <<
"nquasi_newton" <<
"= "
238 <<
"; # Number of quasi-newton updates\n";
AbstractLinAlgPack::size_type size_type
StopWatchPack::stopwatch timer_
const ostream_ptr_t & get_output_stream() const
Get the output stream for statistics outputting.
Class for storing statistics about the Quasi-Newton updating.
void reset()
Stops and resets the clock if it is running.
void initialize()
Restarts the timer.
rSQP Algorithm control class.
EUpdate
Set to this value if a statistic is not known.
void output_final(const Algorithm &algo, EAlgoReturn algo_return) const
T_To & dyn_cast(T_From &from)
Reduced space SQP state encapsulation interface.
quasi_newton_stats_iq_member quasi_newton_stats_
void start()
Starts timing if it has already not been started.
void set_output_stream(const ostream_ptr_t &o)
void output_iteration(const Algorithm &algo) const
Acts as the central hub for an iterative algorithm.
NLPAlgoState & rsqp_state()
<<std aggr>="">> members for algo_cntr
double stop()
Stops timing and returns the time (sec.) since start() was called.
double read()
Reads the elapsed time (sec.) and leaves the clock running.
NLPAlgo & rsqp_algo(Algorithm &algo)
Convert from a Algorithm to a NLPAlgo.
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)