dimod.ConstrainedQuadraticModel.violations

ConstrainedQuadraticModel.violations(sample_like, *, skip_satisfied: bool = False, clip: bool = False) Dict[Hashable, Union[int, float, numpy.number]][source]

Return a dictionary mapping constraint labels to the amount the constraints are violated.

This method is a shortcut for dict(cqm.iter_violations(sample)).