OneHotConstraint#
- class OneHotConstraint#
A one-hot constraint: exactly one variable must be 1, the rest must be 0.
This is a structural constraint — no explicit function is stored. The implicit constraint is
sum(x_i) = 1where allx_iare binary.- __copy__() OneHotConstraint#
- __new__(variables: Sequence[int]) OneHotConstraint#
Create a new one-hot constraint.
Args:
variables: List of binary decision variable IDs (exactly one must be 1)
- __repr__() str#
- property variables: list[int]#
Read-only property.