- ConstrainedQuadraticModel.add_discrete(variables: Collection[Hashable], label: Optional[Hashable] = None) Hashable ¶
Add an iterable of binary variables as a disjoint one-hot constraint.
Adds a special kind of one-hot constraint. These one-hot constraints must be disjoint, that is they must not have any overlapping variables.
variables – An iterable of variables.
label – Label for the constraint. Must be unique. If no label is provided, then one is generated using
Label of the added constraint.