pympcc.sensitivity¶
- pympcc.sensitivity(result, problem, *, dgrad_L_dp, dc_dp, fd_h=None, regularize_eps=1e-12, active_tol=1e-06)[source]¶
Compute
dx*/dpvia implicit differentiation through the KKT system.Solves the saddle-point system
[[H, J_c^T], [J_c, 0]] · [dx; dλ] = − [dgrad_L_dp; dc_dp]
where
H = ∇²_xx L(x*, λ*)andJ_cis the active constraint Jacobian. Skips withskipped_reasonset when MPCC-LICQ prerequisites fail (non-converged result, or biactive pairs present).- Parameters:
result (MPCCResult) – Converged solve result. When
tnlp_refine=Truewas used, the TNLP-refined multipliers are picked up automatically; otherwise a zero-multiplier fallback is used and aUserWarningis emitted (only when no analytic Hessian is available).problem (MPCCProblem) – Source problem (original space, not presolve-reduced).
dgrad_L_dp (array-like, shape (n,) or (n, n_p)) –
∂(∇_x L)/∂patx*with(x, λ)held fixed. When parameters enter onlyf, this is∂(∇_x f)/∂p; otherwise callers must include the cross-termΣ_i λ_i · ∂(∇_x c_i)/∂p. A 1-D input is treated as a single parameter column.dc_dp (array-like, shape (n_active,) or (n_active, n_p)) –
∂c/∂patx*, with rows ordered to matchactive_row_labels(). SeeSensitivityResultfor the per-row label format.fd_h (float, optional) – Step size for the central-difference Hessian fallback when
problem.lagrangian_hessianis not provided. Defaults toproblem.fd_h.regularize_eps (float) – Tikhonov ridge added to the KKT diagonal when the dense solve fails. Default
1e-12.active_tol (float) – Active-set detection tolerance (default
1e-6).
- Return type: