OneHotConstraint

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) = 1 where all x_i are binary.

__copy__() OneHotConstraint#
__deepcopy__(_memo: Any) 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.