Solver Ladder & Optimization¶
Non-linear optimization subject to non-linear inequality constraints can be sensitive to starting points and conditioning. Risk Bridge implements a hierarchical solver ladder to maximize numerical stability and convergence reliability.
The Solver Ladder Architecture¶
Start
│
▼
┌──────────────────────────────────────┐
│ Step 1: Unconstrained Warm Start │
│ - BFGS with analytic gradient │
│ - Minimizes joint NLL l(θ) │
└──────────────────┬───────────────────┘
│ Yields θ_ML
▼
┌──────────────────────────────────────┐
│ Step 2: Primary Constrained Solver │
│ - Method: trust-constr │
│ - Warm-started at θ_ML │
│ - Uses analytic objective gradient │
│ and analytic constraint Jacobian │
└──────────────────┬───────────────────┘
│
Feasible? ├────────────► Success (Done)
│ No
▼
┌──────────────────────────────────────┐
│ Step 3: Secondary Fallback Solver │
│ - Method: SLSQP │
│ - Warm-started at θ_ML │
│ - Uses analytic gradient & Jacobian │
└──────────────────┬───────────────────┘
│
Feasible? ├────────────► Success (Done)
│ No
▼
┌──────────────────────────────────────┐
│ Step 4: Diagnostic Validation │
│ - Compute max_violation = max |g_k| │
│ - If max_violation <= tol: Accept │
│ - Else: Flag cmle_success = False │
└──────────────────────────────────────┘
1. Step 1: Unconstrained Warm Start (BFGS)¶
Before attempting constrained estimation, the unconstrained MLE is computed:
We use the Broyden–Fletcher–Goldfarb–Shanno (BFGS) quasi-Newton algorithm with exact analytic gradients. This step converges rapidly because \(\ell(\theta)\) is smooth and well-behaved over source data.
The resulting \(\hat{\theta}_{\text{ML}}\) serves two critical roles: 1. It provides an unconstrained benchmark against which the impact of calibration constraints is measured. 2. It serves as a warm start for constrained optimization.
2. Step 2: Primary Constrained Solver (trust-constr)¶
Starting from \(\hat{\theta}_{\text{ML}}\), we invoke SciPy's trust-constr algorithm:
- Algorithm: An interior-point trust-region algorithm specifically suited for non-linear equality and inequality constraints.
- Analytic Jacobians: Both the objective gradient and the \(K \times p_\theta\) constraint Jacobian \(J(\theta)\) are computed analytically:
- Numerical Guardrails:
- Probability terms are clamped away from exact boundaries: \(\hat{p} \in [10^{-12}, 1 - 10^{-12}]\).
- Scale parameter \(\sigma\) is lower-bounded: \(\sigma \ge 10^{-8}\).
3. Step 3: Fallback Solver (SLSQP)¶
If trust-constr terminates prematurely or fails to satisfy feasibility, the ladder falls back to Sequential Least Squares Programming (SLSQP):
- Solves a sequence of quadratic programming subproblems.
- Warm-started at \(\hat{\theta}_{\text{ML}}\).
- Uses the same analytic gradients and constraint Jacobians.
4. Step 4: Rigorous Feasibility Acceptance¶
Regardless of whether the underlying solver flags convergence, Risk Bridge independently audits the solution by evaluating the constraint violations at the final parameter estimate \(\hat{\theta}\):
The constrained fit is accepted as valid (cmle_success = True) if and only if:
where \(\epsilon\) is the configured --calibration-tolerance. Both the solver status string and cmle_max_violation are preserved in fit_diagnostics.csv.