Skip to main content

certificate_masked

Function certificate_masked 

Source
pub fn certificate_masked(
    obj_scale: Number,
    unscaled_err: Number,
    threshold: Number,
    acceptable_tol: Number,
) -> bool
Expand description

Is a passing strict certificate masked by an extreme objective scale (gh #200)?

Gradient-based scaling picks df = nlp_scaling_max_gradient / max‖∇f‖, floored at nlp_scaling_min_value = 1e-8. On a flat quartic the initial gradient is enormous (quartc: ~4e12 → df pinned at the floor), and the strict test then runs on the scaled aggregate. Because a quartic’s gradient vanishes cubically toward its minimum while df stays fixed at its initial value, the scaled error crosses tol roughly 30% of the way in: the solver certifies optimality at quartc objective 248.88 when the true minimum is ~0, with an unscaled dual infeasibility of 0.84.

This predicate deliberately does not try to decide whether the stop is genuinely false — it only asks whether the conditions that make a false stop possible are present. Distinguishing a masked certificate from an honest one at a small scale cannot be done from the residual magnitude: meyer3 sits at the same 1e-8 scale floor as quartc while being genuinely converged, and the unscaled error is a dimensional quantity, so any absolute cutoff separating them would move if the objective were rescaled — precisely the sensitivity this bug is about. An earlier revision of this work did exactly that (a 5e-2 bar fitted to the gap in one benchmark suite); it is not defensible and was removed.

Instead the caller tests the hypothesis: it refuses to stop, continues, and sees whether the iterates actually go anywhere. If they do, the stop was false. If they do not, the certificate is honoured unchanged — so the mechanism is never worse than not having it (see terminate_vetoed_or).