Skip to main content

collect_stats

Function collect_stats 

Source
pub fn collect_stats(
    tnlp: &Rc<RefCell<dyn TNLP>>,
    lo_inf: Number,
    up_inf: Number,
    fixed_treatment: FixedVarTreatment,
) -> Option<ProblemStats>
Expand description

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).

To stay byte-for-byte consistent with the solve, the counts are taken from a throwaway TNLPAdapter built with the same options — reusing the exact production classification (including the make_parameter → relax_bounds auto-switch). The Jacobian / Hessian nnz are read from the raw structure and filtered to drop entries in fixed-variable columns (the columns Ipopt removes). Returns None if any required TNLP call fails.