Sos1Constraint#
- class Sos1Constraint#
A SOS1 (Special Ordered Set type 1) constraint: at most one variable can be non-zero.
This is a structural constraint — no explicit function is stored. Unlike OneHotConstraint, SOS1 allows all variables to be zero.
- __copy__() Sos1Constraint#
- __new__(variables: Sequence[int], name: Optional[str] = None, subscripts: Sequence[int] = [], description: Optional[str] = None, parameters: Mapping[str, str] = {}) Sos1Constraint#
Create a new SOS1 constraint.
Args:
variables: List of decision variable IDs (at most one can be non-zero)name/subscripts/description/parameters: Optional metadata. Drained into the host's SoA store on insertion.
- __repr__() str#
- set_description(description: str) Sos1Constraint#
Set the description. Returns self for method chaining (snapshot mutation).
- set_name(name: str) Sos1Constraint#
Set the name. Returns self for method chaining (snapshot mutation).
- set_parameters(parameters: Mapping[str, str]) Sos1Constraint#
Replace all parameters. Returns self for method chaining (snapshot mutation).
- set_subscripts(subscripts: Sequence[int]) Sos1Constraint#
Set the subscripts. Returns self for method chaining (snapshot mutation).
- property parameters: dict[str, str]#
Read-only property.
- property subscripts: list[int]#
Read-only property.
- property variables: list[int]#
Read-only property.