SampledConstraintCollection#
- class SampledConstraintCollection#
Live, read-only mapping of all constraint result families, including removed constraints. Each access returns a snapshot.
Keys must be typed constraint IDs; integers raise TypeError. Missing IDs raise KeyError. The view keeps its owner alive and observes subsequent owner mutations.
- __contains__(key: object) bool#
- __getitem__(key: ConstraintID) SampledConstraint#
- __getitem__(key: IndicatorConstraintID) SampledIndicatorConstraint
- __getitem__(key: OneHotConstraintID) SampledOneHotConstraint
- __getitem__(key: Sos1ConstraintID) SampledSos1Constraint
- __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) SampledConstraint | None#
- get(key: ConstraintID, default: _T) SampledConstraint | _T
- get(key: IndicatorConstraintID, default: None = None) SampledIndicatorConstraint | None
- get(key: IndicatorConstraintID, default: _T) SampledIndicatorConstraint | _T
- get(key: OneHotConstraintID, default: None = None) SampledOneHotConstraint | None
- get(key: OneHotConstraintID, default: _T) SampledOneHotConstraint | _T
- get(key: Sos1ConstraintID, default: None = None) SampledSos1Constraint | None
- get(key: Sos1ConstraintID, default: _T) SampledSos1Constraint | _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: Literal["regular"]) ConstraintFamilyView[ConstraintID, SampledConstraint]#
- of_kind(kind: Literal["indicator"]) ConstraintFamilyView[IndicatorConstraintID, SampledIndicatorConstraint]
- of_kind(kind: Literal["one_hot"]) ConstraintFamilyView[OneHotConstraintID, SampledOneHotConstraint]
- of_kind(kind: Literal["sos1"]) ConstraintFamilyView[Sos1ConstraintID, SampledSos1Constraint]
Return a live view of one family without collecting rows. Uses the same kind strings 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.