mario.set_singular_policy
- mario.set_singular_policy(policy: str)#
Choose how solve-based calculations handle singular production systems.
- Parameters:
policy –
"raise"(default) reports singular components as an error."partial"solves only equations independent of those components, retaining all axes and placingNaNat affected coefficients. Partial results emitmario.PartialResultWarningwith the singular node labels and the number of affected coefficients.
Notes
Partial calculations require
compute_method='solve'and adirectorautolinear strategy, with SciPy or UMFPACK. No data are changed, and no pseudo-inverse, regularization or arbitrary zero values are used. Only the retained equations satisfy the residual check; the full system can be inconsistent or have nonunique solutions. Explicit inverse requests still raise an error when the system is singular.MARIO’s compute reductions propagate undefined values. For reductions performed directly on returned pandas objects, use
skipna=False; pandas otherwise skips NaN by default. Matrices already materialized are not recalculated by changing this setting.Use
ComputeOptions(singular_policy='partial')for a per-call override instead of changing the session default.Examples
>>> mario.set_compute_method("solve") >>> mario.set_singular_policy("partial") >>> fc = db.fc # warns if any coefficients cannot be determined