Skip to main content

Module second_opinion

Module second_opinion 

Source
Expand description

The second-opinion ladder: re-solving a failure along a different trajectory before believing it.

A local-infeasibility verdict on a nonconvex problem is a local statement, and an Invalid_Number_Detected is a statement about the callbacks at one point. Both are frequently artifacts of the trajectory the solve happened to take, or of the point it started from, rather than facts about the model. The ladder re-solves along up to three deliberately different trajectories and promotes a re-solve only if it converges.

This module holds the policy — which rungs apply to which failure, what each rung changes, and how a ladder’s outcome resolves. It reads options and returns descriptions; it runs no solves. The driver that applies a rung and calls back into the solver lives in pounce-restoration, because each rung has to rebuild the restoration sub-IPM’s factory provider and that provider is defined one crate up the dependency graph.

Split out of pounce-cli’s main.rs so the Python, C and Rust embedding surfaces get the same ladder rather than each re-deriving it — the asymmetry mattered, because a caller driving POUNCE from a modelling layer is precisely the one most likely to hand over an uninitialized (and so all-zero, and so possibly rank-deficient) starting point.

Structs§

SecondOpinionAvailability
What the baseline options already provide, so a rung that would be a no-op can be dropped instead of burning a solve to re-derive the same answer.
SecondOpinionRung
One rung of the local-infeasibility second-opinion ladder: a label for the console plus the option assignments that define this re-solve’s trajectory.

Enums§

SecondOpinionTrigger
Which failure opened the ladder. Not every rung is evidence about every failure: an Invalid_Number_Detected is a statement about the callbacks at a point, and re-running the same callbacks at the same point under a different linear-solver scaling or a different barrier strategy evaluates the same non-finite quantity again. Only the rung that moves the point applies there.

Functions§

narration_is_wanted
Whether the ladder’s narration should reach the console.
resolve_scaling_retry_outcome
Resolve the final (status, statistics) after an MC64 hypersensitivity re-solve (code review L23).
scaling_retry_promoted
Did a second-opinion re-solve converge well enough to overturn the original local-infeasibility verdict? Only a clean or acceptable-level solve promotes; everything else (including a second infeasibility verdict) leaves the original verdict standing.
second_opinion_rungs
Build the ladder of second-opinion re-solves for a failing verdict, in the order they should be tried. Each rung varies exactly one knob from the baseline options.