pympcc.SensitivityResult

class pympcc.SensitivityResult(dx_dp, dlam_dp, active_row_labels, rank_deficit=0, used_pseudoinverse=False, kkt_condition=None, skipped_reason=None)[source]

Bases: object

Result of a parametric sensitivity solve.

Parameters:
dx_dp

Parametric derivative of the primal solution. Shape (n, 0) when the check was skipped.

Type:

ndarray, shape (n, n_p)

dlam_dp

Parametric derivative of the Lagrange multipliers on the active constraint rows, in the order described by active_row_labels.

Type:

ndarray, shape (n_active, n_p)

active_row_labels

Per-row labels for the active constraint Jacobian. Each entry is one of ("h", k), ("G", i), ("H", i), ("g", j), ("xL", j), or ("xU", j). The caller’s dc_dp rows must match this order.

Type:

list[tuple]

rank_deficit

0 when the KKT matrix is non-singular. Positive only when the regularised lstsq fallback was used.

Type:

int

used_pseudoinverse

True when the dense solve failed and lstsq with Tikhonov regularisation was used instead.

Type:

bool

kkt_condition

np.linalg.cond of the KKT matrix; None when the matrix was empty or the check was skipped.

Type:

float or None

skipped_reason

Set when prerequisites for IFT were not met: "not_converged" (result.success was False); "biactive_pairs" (I_00 — IFT requires LICQ); "no_hessian_callable_and_fd_failed" (FD fallback raised).

Type:

str or None

__init__(dx_dp, dlam_dp, active_row_labels, rank_deficit=0, used_pseudoinverse=False, kkt_condition=None, skipped_reason=None)
Parameters:
Return type:

None

Methods

__init__(dx_dp, dlam_dp, active_row_labels)

Attributes

dx_dp: ndarray
dlam_dp: ndarray
active_row_labels: list
rank_deficit: int = 0
used_pseudoinverse: bool = False
kkt_condition: float | None = None
skipped_reason: str | None = None