InactiveConstraintCollection

InactiveConstraintCollection#

class InactiveConstraintCollection#

Live mapping of all inactive constraint families in a model.

Obtained from inactive_constraints or inactive_constraints. Each access returns an independent snapshot, including labels, provenance, and inactivity reasons. Changing that snapshot does not update its owner; a later lookup reads the owner’s current state.

Both ConstraintRole.FEASIBILITY_CHECK and ConstraintRole.EVALUATION_ONLY belong to this collection. Both are excluded from the active formulation and still evaluated numerically. Deactivation can follow relaxation, an equivalent lowering, or another transformation; the collection’s presence does not identify which guarantee holds. See inactive_constraints for their evaluation semantics and deactivate_constraint() for a complete relax, inspect, evaluate, and restore example.

The collection keeps its owner alive. The typed-key, get, live-view, iteration, and snapshot equality rules are documented in ActiveConstraintCollection. Use of_kind and ConstraintFamilyView to inspect one family. A model’s constraints_df(kind=..., min_role=ConstraintRole.EVALUATION_ONLY) includes both active and inactive rows.

__contains__(key: object) → bool#
__eq__(other: Any) → Any#
__getitem__(key: ConstraintID) → InactiveConstraint#
__getitem__(key: IndicatorConstraintID) → InactiveIndicatorConstraint
__getitem__(key: OneHotConstraintID) → InactiveOneHotConstraint
__getitem__(key: Sos1ConstraintID) → InactiveSos1Constraint
__getitem__(key: ConstraintIDBase) → ConstraintView

Fetch the constraint identified by a typed ID from the current owner.

__iter__() → Iterator[ConstraintIDBase]#

Iterate a snapshot of typed IDs; constraint rows are not collected.

__len__() → int#
__repr__() → str#
get(key: ConstraintID, default: None = None) → InactiveConstraint | None#
get(key: ConstraintID, default: _T) → InactiveConstraint | _T
get(key: IndicatorConstraintID, default: None = None) → InactiveIndicatorConstraint | None
get(key: IndicatorConstraintID, default: _T) → InactiveIndicatorConstraint | _T
get(key: OneHotConstraintID, default: None = None) → InactiveOneHotConstraint | None
get(key: OneHotConstraintID, default: _T) → InactiveOneHotConstraint | _T
get(key: Sos1ConstraintID, default: None = None) → InactiveSos1Constraint | None
get(key: Sos1ConstraintID, default: _T) → InactiveSos1Constraint | _T
get(key: ConstraintIDBase, default: None = None) → ConstraintView | None
get(key: ConstraintIDBase, default: ConstraintView) → ConstraintView
get(key: ConstraintIDBase, default: _T) → ConstraintView | _T
items() → ItemsView[ConstraintIDBase, ConstraintView]#

Live item view; each row is fetched when visited.

keys() → KeysView[ConstraintIDBase]#

Live key view. Iteration order is family order, then numeric ID.

of_kind(kind: ConstraintKind[ConstraintID]) → ConstraintFamilyView[ConstraintID, InactiveConstraint]#
of_kind(kind: ConstraintKind[IndicatorConstraintID]) → ConstraintFamilyView[IndicatorConstraintID, InactiveIndicatorConstraint]
of_kind(kind: ConstraintKind[OneHotConstraintID]) → ConstraintFamilyView[OneHotConstraintID, InactiveOneHotConstraint]
of_kind(kind: ConstraintKind[Sos1ConstraintID]) → ConstraintFamilyView[Sos1ConstraintID, InactiveSos1Constraint]
of_kind(kind: ConstraintKind[_K]) → ConstraintFamilyView[_K, ConstraintView]

Return a live view of one family without collecting rows. Uses the same ConstraintKind selector as constraints_df. Integer keys are promoted; wrong-family IDs are rejected. The view retains this collection and its owner; row lifecycle and iteration snapshot rules match the original collection.

values() → ValuesView[ConstraintView]#

Live value view; each row is fetched when visited.