Numerical Stability and Modeling Quality
Numerical modeling is the discipline of making the mathematical meaning of a model survive finite precision, finite domains, and solver encodings. Four declarations matter repeatedly: variable bounds, units and scaling, the derivation of any Big-M constant, and the interpretation of tolerances at strict or equality boundaries.
This page develops those ideas through a small production model. It also shows when a reformulation is exact, when it is an intentional approximation, and how a symmetry-breaking rule can remove duplicate witnesses without changing the business optimum. The discussion is solver-neutral and does not invent a current OSPF API.
1. Why bounds and units are model semantics
A finite bound is more than a performance hint. It determines which plans the model permits and often supplies the proof needed for a conditional or disjunctive formulation. If
Units are equally important. A residual of
Scaling is an algebraic change of variables intended to keep coefficients and residuals at comparable magnitudes. It should be recorded as part of the model transformation, not applied only to the matrix printed for a solver.
2. A complete bounded example: two identical plants
2.1 Business statement and data
There are two identical plants. Total production must be five integer units. An open plant can produce at most six units, costs 4 USD to open, and costs 1 USD per produced unit. A “large batch” means strictly more than three units at a plant. The large-batch indicator is useful for a downstream rule, so the model must classify it correctly.
| plant | production bound | fixed opening cost | unit cost |
|---|---|---|---|
| $4 | $1 | ||
| $4 | $1 |
The plants are identical in every datum and rule. Therefore swapping plant labels must not change feasibility or cost.
2.2 Variables, intermediates, and constraints
Let
Define the total-quantity and total-cost intermediates
The demand and activation rules are
The second row is exact because
For integer production, “strictly more than three” is exactly
Finally, choose one representative from the two plant-label symmetries:
The cost objective is
The cost definition is written explicitly even though
2.3 Deriving the Big-M values
For the lower branch, when
Thus
For the upper branch, when
Thus
Using one generic value
More generally, for an upper conditional row
the smallest valid non-negative value is determined by
For a lower conditional row
use
The maximum is taken over the declared domain and background constraints, not over an unbounded mathematical variable. For an affine
2.4 Hand-checking an optimum
Consider
The total quantity is
Any feasible plan must open at least one plant because
Without the symmetry row,
3. Scaling and tolerance in declared units
Suppose a related time variable is originally measured in minutes:
Define hours by
For example, the minute equation
Every related quantity must be converted too. A residual tolerance of
A Big-M of
4. Strict inequalities and the exact/approximate boundary
4.1 Integer variables: exact conversion
For integer
The two Big-M rows in the plant example therefore classify every integer value in
| valid | |
|---|---|
There is no reason to use a tiny numeric epsilon such as
4.2 Continuous variables: a declared margin is a policy choice
For a real
Then
The margin should come from measurement resolution, contractual policy, or a declared separation requirement. It should not be chosen merely because it is smaller than the solver's feasibility tolerance. If values in the open gap are meaningful, model that third state explicitly or use a formulation whose semantics allow it; do not silently label the two-branch approximation exact.
4.3 Numerical tolerance is not a strict-boundary margin
For an equality
That band describes how a computed solution is classified. A business margin
5. Symmetry breaking
Two interchangeable plants create two label-swapped witnesses. The condition
Symmetry breaking is exact with respect to objective values: every solution can be permuted into one satisfying the representative rule, with the same objective and business interpretation. It does not improve the business plan by itself; it reduces duplicate search branches and can make the representative selection more predictable, but it does not guarantee a unique full plan when other symmetries remain.
The rule becomes invalid if plant
6. Exact reformulations versus approximations
The following classification is useful when reviewing a numerical model:
| construction | status in the stated model |
|---|---|
| exact activation link | |
| exact discrete strict conversion | |
| exact indicator branches | |
| exact change of coordinates | |
| declared conservative approximation | |
| accepting $ | a(x)-b |
| exact objective-preserving representative choice |
Exactness describes a mathematical transformation for the declared domains, bounds, and units. A numerical acceptance tolerance is a separate reporting or solver convention; it does not turn an approximation or an open-boundary policy into an exact equality. If a bound is only an estimate, a Big-M derived from it is not a proof. If input data are rounded during scaling, the transformation is no longer algebraically exact.
7. Conceptual organization in OSPF
Numerical semantics can be kept visible through the following conceptual responsibilities:
- A data or domain context owns physical units, finite bounds, integrality, data precision, and any equivalence classes used for symmetry.
- A model context owns the original business rules: activation, strict service thresholds, equalities, and permitted approximation margins.
- A compiler boundary derives row-specific bounds and Big-M values, applies recorded scaling, and preserves whether each transformation is exact, tolerance-based, or approximate. It should retain the source rule that justified each generated row.
- A solving-results context reports scaled and business-unit values, residuals, branch indicators, objective values, symmetry representative choices, and any unresolved numerical or optimality status.
This separation is the subject of compiler architecture. Solving results gives the reporting perspective: a solution value without its units, residual tolerances, or proof status is incomplete. When asking why a target cannot improve, critical constraint analysis should use the original bounded rule and its declared business semantics, not an unexplained internal Big-M row.
The organization above is conceptual and deliberately avoids implying a particular current class or function name.
8. Common pitfalls
8.1 Guessing a universal Big-M
An oversized constant can weaken the continuous relaxation and amplify round-off; an undersized one removes valid plans. Derive each M from finite bounds and state the derivation. If no reliable bound exists, first reformulate or obtain one rather than hiding the uncertainty in a larger number.
8.2 Letting a bound disagree with the data
If the declared capacity is six but an input row permits production eight, either the model is infeasible for valid data or the bound is false. Big-M derivations, scaling, and symmetry claims all depend on the same bound being authoritative.
8.3 Using machine epsilon for a business boundary
A strict service threshold is not made meaningful by adding
8.4 Comparing residuals before converting units
A residual of
8.5 Applying symmetry breaking to non-identical objects
Ordering two machines by an arbitrary ID is not safe if their capacities or availability differ. Verify full interchangeability, including optional rules and costs, before imposing a representative order.
8.6 Treating an approximation as an equivalence
An epsilon margin creates a gap; a rounded coefficient changes a boundary; an approximate nonlinear envelope may omit feasible points. Label the choice, quantify the affected unit, and include it in the result and review evidence.
8.7 Forgetting objective and report scaling
Changing a variable from minutes to hours while leaving its objective coefficient unchanged changes the relative value of that objective. The same applies to weighted multi-objective terms. Transform constraints, objectives, tolerances, and displayed values consistently.