Currently ConstrainedQuadraticModel.iter_constraint_data() always iterates over every constraint in the model.
We should consider adding some keyword arguments to make that a bit easier when handling constraints in bulk. I am imagining something like
def iter_constraint_data(sample_like, *, filter_function=None):
if callable(filter_function):
yield from filter(filter_function, self.iter_constraint_data(sample_like))
return
...
and/or
def iter_constraint_data(sample_like, *, labels=None):
...
if labels is None:
labels = self.constraint_labels
for label in labels:
constraint = self.constraint(label)
lhs = constraint.lhs.energy((sample, labels))
rhs = constraint.rhs
sense = constraint.sense
...