Skip to main content

Module tolerance

Module tolerance 

Source
Expand description

Scale-aware significance tests for feasibility and optimality decisions.

§Why this exists

Multiplying a constraint row by a positive constant leaves the feasible set exactly unchanged — it is the same problem written differently. So a solver’s verdict must not depend on it. Comparing a scale-dependent quantity (a constraint residual) against an absolute threshold breaks that invariant, and has produced defects in the restoration gates, presolve certification, and the solution verifier.

The sharpest example: x >= 2 over x ∈ [0, 1] reports Infeasible_Problem_Detected as written, and Solve_Succeeded when every row is multiplied by 1e-12 — because at that scale the residual falls under an absolute tolerance. Same empty feasible set, opposite verdicts.

§The rule

Compare a residual against tol * scale, where scale is the quantity’s own natural magnitude. Both sides then move together under row scaling, so the test is invariant.

A clamped form — tol * max(scale, 1) — looks safer and is wrong: the clamp reinstates the absolute floor for scale < 1, which is exactly the down-scaled direction that fails. This was measured, not assumed:

  k    residual   scale     tol*max(s,1)  fires?  |  tol*s     fires?
-12    1.00e-12   1.00e-12  1.00e-08      false   |  1.00e-20  true
 -8    1.00e-08   1.00e-08  1.00e-08      false   |  1.00e-16  true
  0    1.00e+00   1.00e+00  1.00e-08      true    |  1.00e-08  true
 12    1.00e+12   1.00e+12  1.00e+04      true    |  1.00e+04  true

§Direction of failure

Both functions fail closed: a residual that cannot be judged (NaN, or non-finite) is reported not significant. For an infeasibility test that is the safe direction — it withholds a verdict rather than fabricating one. A caller that needs the opposite polarity must handle non-finite values itself rather than inverting the result.

Functions§

is_negligible
Whether value is small enough, relative to its own natural magnitude, to be treated as satisfied — the accepting direction.
is_significant
Whether value is large enough, relative to its own natural magnitude, to be treated as a real quantity rather than numerical noise.
row_scale_from_factor
The natural magnitude of a row, from the NLP scaling factor applied to it.