Skip to main content

Module print

Module print 

Source
Expand description

Re-export of the shared Ipopt-style console printers.

The printer implementations live in pounce_solve_report::console so the algorithm’s output layer can emit the problem-statistics and end-of-run summary blocks itself, gated on print_level (#206). The CLI still owns the up-front banner and the convex-QP summary, and re-exports the shared functions here so existing print::… call sites are unchanged. This module carries no implementation of its own — the single source of truth is console.

Structs§

EvalCounts
Evaluation-callback tallies for the end-of-run summary, decoupled from any particular TNLP wrapper so both the CLI’s CountingTnlp and the Python bindings’ callback problem can supply them.
ProblemStats
PartialEq is load-bearing, not a convenience: IpoptApplication compares each attempt’s block against the last one it printed so a retry does not reprint an identical header. See emit_problem_stats.

Functions§

collect_stats
Gather everything the banner block needs, reported over the reduced problem that the algorithm actually solves — i.e. after fixed_variable_treatment removes fixed (x_l == x_u) variables under make_parameter. This mirrors Ipopt, whose banner is computed from the post-IpTNLPAdapter problem; computing it from the raw TNLP instead made pounce over-report variables and bucket fixed vars as “lower and upper bounds” (#140).
fmt_ipopt
Format a number in Ipopt’s scientific notation: 16-digit mantissa, signed 2-digit exponent (e.g. 3.7952009505566139e+03). Rust’s {:.16e} is close but emits a 1-digit exponent without leading sign, which makes side-by-side diffs against ipopt output messy.
logo_rows
Render the POUNCE wordmark as styled rows (one String per line): steel-sheen letters with three molten claw slashes, in the project palette. Emits ANSI styling only when color; otherwise plain #// block characters. Shared by the solve header (print_logo) and the interactive debugger’s open banner (rendered to stderr).
print_banner
print_convex_end
The end-of-run verdict block for the convex path: wall-clock total, EXIT: banner, and the POUNCE <version>: line — the same three lines, in the same order and spelling, that print_summary ends the NLP path’s log with.
print_convex_summary
Emit an Ipopt-style end-of-run summary for the dedicated convex (LP / QP / conic) IPM path. That path otherwise prints only a compact one-line result, so the Number of Iterations....: and Objective...............: lines the general NLP path emits are missing. Downstream consumers that parse Ipopt’s summary block — notably the benchmark harness’s extract_obj/extract_iters in benchmarks/scripts/run_nl_bench.sh — then see a null objective and zero iterations even though the solve succeeded. This prints the same labelled lines (objective + KKT residual rows) so those consumers capture the real values. The convex solver reports a single (unscaled, user-sense) objective and residuals, so the “(scaled)”/“(unscaled)” columns carry the same value.
print_convex_summary_measured
print_convex_summary with the two columns distinct (gh#984 review): (scaled) is the measurement the convex arm’s Optimal verdict is judged on – each residual above its own finite-precision floor, stationarity and complementarity in the objective’s unit (QpSolution::kkt_residuals_above_floor) – and (unscaled) the plain absolute residuals. Ipopt’s two columns have the same division of labour: its convergence test reads the scaled one. Each array is [primal, dual, complementarity, kkt_error].
print_exit_verdict
The two lines that end a run: EXIT: <verdict> and POUNCE <version>: <verdict>.
print_logo
Print the branded POUNCE ASCII wordmark, mimicking the project logo.
print_problem_stats
print_summary
print_summary_with_widening
print_summary told whether a bound_relax_factor widening was applied to the solved model. At bound_relax_factor = 0 there is no widening, so the red “before the bound_relax_factor widening” line would attribute a gap to a widening that never happened — what it would actually be comparing is the user-unit declared violation against the scaled residual above it (gh#987). The line is printed only when widening_applied is true.
status_message