13#ifndef INCLUDE_PIPAL_OUTPUT_HXX
14#define INCLUDE_PIPAL_OUTPUT_HXX
26 template <
typename Real>
29 static_assert(std::is_floating_point_v<Real>,
30 "Pipal::Output<Real>: Real must be a floating-point type.");
36 std::ostream &
s{std::cout};
47 this->t = SteadyClock::now();
48 this->l =
"======+=========================+====================================+=========================+===========================================================================+=======================";
49 this->q =
"Iter. | Objective Infeas. | Pen. Par. I.P. Par. Opt. Error | Merit P.I.P. Err.| Shift ||P.Step|| ||D.Step|| Lin. Red. Quad. Red. Quality | Pri. Step. Dual Step.";
50 this->n =
"----------- ---------- | ---------- ---------- ---------- ----------- ----------- ----------- | ---------- ----------";
68 <<
" " << i.
name <<
'\n'
74 <<
" Number of variables....................... : " << i.
nV <<
'\n'
75 <<
" Number of equality constraints............ : " << i.
nE <<
'\n'
76 <<
" Number of inequality constraints.......... : " << i.
nI <<
'\n'
80 <<
"Problem sparsity\n"
81 <<
"================\n"
82 <<
" Nonzeros in Hessian of Lagrangian......... : " << z.
Hnnz <<
'\n'
83 <<
" Nonzeros in equality constraint Jacobian.. : " << z.
JEnnz <<
'\n'
84 <<
" Nonzeros in inequality constraint Jacobian : " << z.
JInnz <<
'\n'
113 << std::scientific << std::setprecision(4) << std::showpos << z.
phi <<
" " << std::noshowpos
115 << d.
ltred <<
" " << d.
qtred <<
" " << d.
m << std::noshowpos <<
" | ";
129 << std::setw(5) << c.k <<
" | " << std::scientific << std::setprecision(4) << std::showpos << z.
f
130 << std::noshowpos <<
" " << z.
v <<
" | " << z.
rho <<
" " << z.
mu <<
" " << z.
kkt[1] <<
" | ";
139 this->s << std::scientific << std::setprecision(4) << a.
p <<
" " << a.
d;
140 if (a.
s == 1) { this->s <<
" SOC"; }
158 << this->n <<
'\n' << this->l <<
'\n'
165 case 0: this->s <<
" EXIT: No termination message set\n";
break;
166 case 1: this->s <<
" EXIT: Optimal solution found\n";
break;
167 case 2: this->s <<
" EXIT: Infeasible stationary point found\n";
break;
168 case 3: this->s <<
" EXIT: Iteration limit reached\n";
break;
169 case 4: this->s <<
" EXIT: Invalid bounds\n";
break;
170 case 5: this->s <<
" EXIT: Function evaluation error\n";
break;
171 default: this->s <<
" EXIT: Unknown termination\n";
break;
177 <<
"============\n" << std::showpos
178 <<
" Objective function........................ : " << z.
fu <<
'\n'
179 <<
" Feasibility violation..................... : " << z.
vu <<
'\n'
180 <<
" Optimality error (feasibility)............ : " << z.
kkt(0) <<
'\n'
181 <<
" Optimality error (penalty)................ : " << z.
kkt(1) <<
'\n'
182 <<
" Optimality error (penalty-interior-point). : " << z.
kkt(2) <<
'\n'
183 <<
" Penalty parameter......................... : " << z.
rho <<
'\n'
184 <<
" Interior-point parameter.................. : " << z.
mu <<
'\n'
189 <<
"Final counters" <<
'\n'
190 <<
"==============" <<
'\n'
191 <<
" Iterations................................ : " << c.k <<
'\n'
192 <<
" Function evaluations...................... : " << c.f <<
'\n'
193 <<
" Gradient evaluations...................... : " << c.g <<
'\n'
194 <<
" Hessian evaluations....................... : " << c.H <<
'\n'
195 <<
" Matrix factorizations..................... : " << c.M <<
'\n'
196 <<
" CPU millseconds........................... : "
197 << std::scientific << std::setprecision(4)
198 << std::chrono::duration_cast<MicroSeconds>(SteadyClock::now() - this->t).count()/1.0e3
std::string q
Definition Output.hxx:38
void printBreak(Counter const &c) const
Print a formatted break line and column headers periodically.
Definition Output.hxx:93
void printFooter(Counter const &c, Iterate< Real > const &z, Integer const b) const
Print final summary footer and termination message.
Definition Output.hxx:151
Output()
Default constructor.
Definition Output.hxx:46
TimePoint t
Definition Output.hxx:40
void printAcceptance(Acceptance< Real > const &a) const
Print acceptance information for the chosen trial step.
Definition Output.hxx:138
void printIterate(Counter const &c, Iterate< Real > const &z) const
Print a single iterate row to the console table.
Definition Output.hxx:124
void printHeader(Input< Real > const &i, Iterate< Real > const &z) const
Print problem header information.
Definition Output.hxx:64
std::string l
Definition Output.hxx:37
std::ostream & s
Definition Output.hxx:36
~Output()=default
Default destructor.
std::chrono::steady_clock SteadyClock
Definition Output.hxx:33
std::string n
Definition Output.hxx:39
std::chrono::microseconds MicroSeconds
Definition Output.hxx:32
SteadyClock::time_point TimePoint
Definition Output.hxx:34
void printDirection(Iterate< Real > const &z, Direction< Real > const &d) const
Print a summary of the current search direction.
Definition Output.hxx:108
Namespace for the Pipal library.
Definition Acceptance.hxx:16
PIPAL_DEFAULT_INTEGER_TYPE Integer
The Integer type as used for the API.
Definition Types.hxx:110
struct Counter { Integer f{0}; Integer g{0}; Integer H{0}; Integer k{0}; Integer M{0}; Counter()=default; Counter(Counter const &)=delete; Counter &operator=(Counter const &)=delete; } Counter
Internal counters for solver statistics.
Definition Types.hxx:285
Class for managing the acceptance criteria of the solver.
Definition Types.hxx:486
bool s
Definition Types.hxx:490
Real d
Definition Types.hxx:489
Real p
Definition Types.hxx:488
Class for managing the current search direction of the solver.
Definition Types.hxx:446
Real l_norm
Definition Types.hxx:456
Real qtred
Definition Types.hxx:460
Real x_norm
Definition Types.hxx:448
Real m
Definition Types.hxx:461
Real ltred
Definition Types.hxx:459
Class for managing the current iterate of the solver.
Definition Types.hxx:377
Real rho
Definition Types.hxx:381
Real v
Definition Types.hxx:401
Integer Hnnz
Definition Types.hxx:400
Real shift
Definition Types.hxx:407
Real mu
Definition Types.hxx:383
Real fu
Definition Types.hxx:385
Integer JEnnz
Definition Types.hxx:391
Real vu
Definition Types.hxx:402
Integer JInnz
Definition Types.hxx:397
Real f
Definition Types.hxx:384
Vector< Real > kkt
Definition Types.hxx:409
Real phi
Definition Types.hxx:404